invite1.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
  6. <title>邀请有礼</title>
  7. <link rel="icon" href="../static/img/favicon2.ico" type="img/x-ico">
  8. <link rel="stylesheet" href="../static/js/vender/toastr/toastr.min.css">
  9. <link rel="stylesheet" href="../static/css/invite.css">
  10. <script src="../static/js/vender/jquery-3.4.1.min.js"></script>
  11. <script src="../static/js/vender/toastr/toastr.min.js"></script>
  12. <script src="../static/js/vender/config.js"></script>
  13. </head>
  14. <body>
  15. <div class="invite-container">
  16. <div class="pr">
  17. <picture>
  18. <source media="(max-width: 640px)" srcset="../static/img/inviteTop.png 640w" />
  19. <source media="(min-width: 640px)" srcset="../static/img/inviteTop.png 1366w" />
  20. <img src="../static/img/inviteTop.png" class="bottom-img" alt="">
  21. </picture>
  22. <div class="recv-cont">
  23. <div class="recv-ipt" id="recv_ipt">
  24. <span id="invitationCode"></span>
  25. <span class="copy-btn-style btn-code-copy">复制</span>
  26. </div>
  27. <div onclick="appDown()" class="mt40">
  28. <div class="recv-btn" id="recv_btn"></div>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="load-menu">
  33. <div class="center-reward-con">
  34. <div class="top-title">你的奖励</div>
  35. <div class="reward-second-title">好友购机,返时长奖励</div>
  36. <div id="goode"></div>
  37. </div>
  38. <div>
  39. <div style="display: flex;justify-content: center;">
  40. <div class="code-title-font"></div>
  41. </div>
  42. <div class="tb-codes">
  43. <p class="fw500 fs28">好友购机,买一送一</p>
  44. <p class="fs26">被邀好友购买任意套餐,您可获其等额时长返现(仅限首单);邀请越多返现越多,返现无上限;</p>
  45. <p class="fs26 mb45">请在参与活动前认真阅读规则,因未按规则参与活动而造成的损失,由用户自行承担</p>
  46. <p class="fw500 fs26">规则</p>
  47. <p class="fs26">1. 好友购机前,邀请人账户内无云手机(无云机购买记录者),或仅有2小时免费体验时长的用户,则无法获时长奖励;</p>
  48. <p class="fs26">2. 邀请成功后,双方自动成为好友,邀请奖励将通过好友消息的方式进行发放,邀请方需要点击【领取】,才可领取成功。邀请奖励领取期限为24小时,超过领取期限则无法领取奖励。</p>
  49. <p class="fs26">3. 如发现有刷单等行为用户,将对该账号及其所关联账号进行冻结处理;</p>
  50. <p class="fs26">4. 本活动最终解释权归双子星云手机所有。</p>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <input type="text" style="opacity: 0;z-index: -10;position: fixed;" id="passwordCopy" value="">
  56. <input type="text" style="opacity: 0;z-index: -10;position: fixed;" id="inviteCopy" value="">
  57. <script>
  58. toastr.options.positionClass = 'toast-center-center';
  59. toastr.options.timeOut = '3000';
  60. </script>
  61. <script type="text/javascript">
  62. var url = window.location.href;
  63. url = url.split('/')
  64. // var baseUrl = url[0] + '//' + url[2]
  65. var loc = window.location.search;
  66. var n1 = loc.length;//地址的总长度
  67. var n2 = loc.indexOf("=");//取得=号的位置
  68. var id = loc.substr(n2 + 1, n1 - n2);//从=号后面的内容
  69. var u = navigator.userAgent;
  70. var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  71. var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
  72. if (isiOS) {
  73. var btnMsg = '立即邀请'
  74. } else if (isAndroid) {
  75. btnMsg = '立即邀请'
  76. } else {
  77. btnMsg = '复制邀请链接'
  78. }
  79. $('#recv_btn').append(btnMsg)
  80. $.ajax({
  81. url: baseUrl + '/api/user/v3/invitation/client/getInvitationInfo',
  82. type: 'get',
  83. headers: {
  84. 'Authorization': id //id
  85. },
  86. contentType: "application/json",
  87. dataType: 'json',
  88. cache: false,
  89. success: function (res) {
  90. $('#invitationCode').text(res.data.invitationCode)
  91. //加载数据
  92. $('#passwordCopy').val($('#invitationCode').text());
  93. //复制按钮
  94. $('.btn-code-copy').on('click', function () {
  95. var input = document.getElementById("passwordCopy");
  96. // 选中文本
  97. input.select();
  98. // 执行浏览器复制命令
  99. document.execCommand("copy");
  100. toastr.error('复制成功', 0)
  101. });
  102. if (res.data.friendList.length > 0) {
  103. var str = '<ul class="goodFriend-title-list"><li class="tal">被邀请好友帐号</li><li class="tac">获时长数(小时)</li><li class="tar">邀请时间</li></ul>'
  104. for (var i = 0; i < res.data.friendList.length; i++) {
  105. var phone = res.data.friendList[i].newPhone
  106. var inviteMsg = res.data.friendList[i].duration
  107. var registerTime = res.data.friendList[i].createTime
  108. var nPhone = phone.substr(0, 3) + '****' + phone.substring(7, 11)
  109. str += '<div class="goodFriend-item">'
  110. str += '<span class="tal">' + nPhone + '</span>'
  111. str += Number(inviteMsg) && inviteMsg > 0 ? '<span class="tac cF04646">' + inviteMsg + '</span>' : '<span class="tac">' + inviteMsg + '</span>'
  112. str += '<span class="tar">' + registerTime + '</span>'
  113. str += '</div>';
  114. }
  115. } else if (res.data.friendList.length === 0) {
  116. str = '<div class="no-data">还没有邀请到好友哦~</div>'
  117. }
  118. $('#goode').append(str);
  119. },
  120. error: function () {
  121. str = '<div class="no-data">还没有邀请到好友哦~</div>'
  122. $('#goode').append(str)
  123. }
  124. })
  125. $("#recv_ipt").bind('input propertychange', function (e) {
  126. var ipt_phones = $('#recv_ipt').val();
  127. var c = $(this);
  128. if (/[^\d]/.test(c.val())) {//替换非数字字符
  129. var temp_amount = c.val().replace(/[^\d]/g, '');
  130. $(this).val(temp_amount);
  131. toastr.error('请输入正确的手机号')
  132. }
  133. if (ipt_phones.length >= 12) {
  134. toastr.error('请输入正确的手机号')
  135. var recvstr = ipt_phones.substring(0, 11)
  136. $("#recv_ipt").val(recvstr);
  137. }
  138. });
  139. function appDown() {
  140. var u = navigator.userAgent;
  141. var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  142. var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
  143. if (isiOS) {
  144. $.ajax({
  145. url: baseUrl + '/api/user/v1/promote',
  146. type: 'get',
  147. headers: {
  148. 'Authorization': id //id
  149. },
  150. contentType: "application/json",
  151. dataType: 'json',
  152. cache: false,
  153. success: function (res) {
  154. var jsonStr = JSON.stringify(res.data)
  155. var jsonObj = JSON.parse(jsonStr)
  156. // WKWebView使用
  157. // 使用下方方法,会报错,为使界面执行逻辑通畅,因此使用try-catch
  158. try {
  159. getMessage(jsonObj);
  160. } catch (error) {
  161. console.log(error)
  162. }
  163. try {
  164. window.webkit.messageHandlers.getMessage.postMessage(jsonObj)
  165. } catch (error) {
  166. console.log(error)
  167. }
  168. }
  169. })
  170. } else if (isAndroid) {
  171. window.native.onClikWebView()
  172. } else {
  173. $.ajax({
  174. url: baseUrl + '/api/user/v1/promote',
  175. type: 'get',
  176. headers: {
  177. 'Authorization': id //id
  178. },
  179. contentType: "application/json",
  180. dataType: 'json',
  181. cache: false,
  182. success: function (res) {
  183. //加载数据
  184. var copyBefore = JSON.stringify(res.data.url);
  185. var copyUrl = copyBefore.split('"');
  186. $('#inviteCopy').val(copyUrl[1]);
  187. var input = document.getElementById("inviteCopy");
  188. // 选中文本
  189. input.select();
  190. // 执行浏览器复制命令
  191. document.execCommand("copy");
  192. toastr.error('复制成功')
  193. }
  194. })
  195. }
  196. }
  197. </script>
  198. </body>
  199. </html>