invite.html 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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">
  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 class="code-title-font">活动规则</div>
  40. <div class="tb-codes">
  41. <p class="fw500 fs28">一.邀好友,赚时长</p>
  42. <p class="fs26">邀请好友成功注册账号,即可获 24小时时长奖励;每月仅限获 500天奖励;</p>
  43. <p class="fw500 fs28">二.好友购机,买一送一</p>
  44. <p class="fs26 mb45">被邀好友购买任意套餐,您可获其等额时长返现(仅限首单);邀请越多返现越多,返现无上限;</p>
  45. <p class="fw500 fs26">规则</p>
  46. <p class="fs26">1. 账户内无云手机,或仅有2小时免费体验时长的用户,则无法获时长奖励;</p>
  47. <p class="fs26">2. 时长奖励直接下发至您账户内时长最多的云手机;</p>
  48. <p class="fs26">3. 如发现有刷单等行为用户,将对该账号及其所关联账号进行冻结处理;</p>
  49. <p class="fs26">4. 本活动最终解释权归双子星云手机所有。</p>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. <input type="text" style="opacity: 0;z-index: -10;position: fixed;" id="passwordCopy" value="">
  55. <input type="text" style="opacity: 0;z-index: -10;position: fixed;" id="inviteCopy" value="">
  56. <script>
  57. toastr.options.positionClass = 'toast-center-center';
  58. toastr.options.timeOut = '3000';
  59. </script>
  60. <script type="text/javascript" th:inline="javascript">
  61. var loc = window.location.search;
  62. var n1 = loc.length;//地址的总长度
  63. var n2 = loc.indexOf("=");//取得=号的位置
  64. var id = loc.substr(n2 + 1, n1 - n2);//从=号后面的内容
  65. var u = navigator.userAgent;
  66. var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  67. var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
  68. if (isiOS) {
  69. var btnMsg = '立即邀请'
  70. } else if (isAndroid) {
  71. btnMsg = '立即邀请'
  72. } else {
  73. btnMsg = '复制邀请链接'
  74. }
  75. $('#recv_btn').append(btnMsg)
  76. $.ajax({
  77. url: baseUrl + '/api/user/v3/invitation/client/getInvitationInfo',
  78. type: 'get',
  79. headers: {
  80. 'Authorization': id //id
  81. },
  82. contentType: "application/json",
  83. dataType: 'json',
  84. success: function (res) {
  85. $('#invitationCode').text(res.data.invitationCode)
  86. //加载数据
  87. $('#passwordCopy').val($('#invitationCode').text());
  88. //复制按钮
  89. $('.btn-code-copy').on('click', function () {
  90. var input = document.getElementById("passwordCopy");
  91. // 选中文本
  92. input.select();
  93. // 执行浏览器复制命令
  94. document.execCommand("copy");
  95. toastr.error('复制成功', 0)
  96. });
  97. if (res.data.friendList.length > 0) {
  98. var str = '<ul class="goodFriend-title-list"><li class="tal">被邀请好友帐号</li><li class="tac">获时长数(小时)</li><li class="tar">邀请时间</li></ul>'
  99. for (var i = 0; i < res.data.friendList.length; i++) {
  100. var phone = res.data.friendList[i].newPhone
  101. var inviteMsg = res.data.friendList[i].duration
  102. var registerTime = res.data.friendList[i].createTime
  103. var nPhone = phone.substr(0, 3) + '****' + phone.substring(7, 11)
  104. str += '<div class="goodFriend-item">'
  105. str += '<span class="tal">' + nPhone + '</span>'
  106. str += Number(inviteMsg) && inviteMsg > 0 ? '<span class="tac cF04646">' + inviteMsg + '</span>' : '<span class="tac">' + inviteMsg + '</span>'
  107. str += '<span class="tar">' + registerTime + '</span>'
  108. str += '</div>';
  109. }
  110. } else if (res.data.friendList.length === 0) {
  111. str = '<div class="no-data">还没有邀请到好友哦~</div>'
  112. }
  113. $('#goode').append(str);
  114. },
  115. error: function () {
  116. str = '<div class="no-data">还没有邀请到好友哦~</div>'
  117. $('#goode').append(str)
  118. },
  119. beforeSend: function(xhr) {
  120. xhr.setRequestHeader("Content-Type", "text/html;charset=utf-8");
  121. }
  122. })
  123. $("#recv_ipt").bind('input propertychange', function (e) {
  124. var ipt_phones = $('#recv_ipt').val();
  125. var c = $(this);
  126. if (/[^\d]/.test(c.val())) {//替换非数字字符
  127. var temp_amount = c.val().replace(/[^\d]/g, '');
  128. $(this).val(temp_amount);
  129. toastr.error('请输入正确的手机号')
  130. }
  131. if (ipt_phones.length >= 12) {
  132. toastr.error('请输入正确的手机号')
  133. var recvstr = ipt_phones.substring(0, 11)
  134. $("#recv_ipt").val(recvstr);
  135. }
  136. });
  137. function appDown() {
  138. var u = navigator.userAgent;
  139. var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  140. var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
  141. if (isiOS) {
  142. $.ajax({
  143. url: baseUrl + '/api/user/v1/promote',
  144. type: 'get',
  145. headers: {
  146. 'Authorization': id //id
  147. },
  148. contentType: "application/json",
  149. dataType: 'json',
  150. cache: false,
  151. success: function (res) {
  152. var jsonStr = JSON.stringify(res.data)
  153. var jsonObj = JSON.parse(jsonStr)
  154. // WKWebView使用
  155. // 使用下方方法,会报错,为使界面执行逻辑通畅,因此使用try-catch
  156. try {
  157. getMessage(jsonObj);
  158. } catch (error) {
  159. console.log(error)
  160. }
  161. try {
  162. window.webkit.messageHandlers.getMessage.postMessage(jsonObj)
  163. } catch (error) {
  164. console.log(error)
  165. }
  166. },
  167. beforeSend: function(xhr) {
  168. xhr.setRequestHeader("Content-Type", "text/html;charset=utf-8");
  169. }
  170. })
  171. } else if (isAndroid) {
  172. window.native.onClikWebView()
  173. } else {
  174. $.ajax({
  175. url: baseUrl + '/api/user/v1/promote',
  176. type: 'get',
  177. headers: {
  178. 'Authorization': id //id
  179. },
  180. contentType: "application/json",
  181. dataType: 'json',
  182. cache: false,
  183. success: function (res) {
  184. //加载数据
  185. var copyBefore = JSON.stringify(res.data.url);
  186. var copyUrl = copyBefore.split('"');
  187. $('#inviteCopy').val(copyUrl[1]);
  188. var input = document.getElementById("inviteCopy");
  189. // 选中文本
  190. input.select();
  191. // 执行浏览器复制命令
  192. document.execCommand("copy");
  193. toastr.error('复制成功')
  194. },
  195. beforeSend: function(xhr) {
  196. xhr.setRequestHeader("Content-Type", "text/html;charset=utf-8");
  197. }
  198. })
  199. }
  200. }
  201. </script>
  202. </body>
  203. </html>