invite.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. window.onload = window.onresize = function () {
  58. verticalAlign()
  59. }
  60. function verticalAlign() {
  61. var html = document.documentElement;
  62. var BodyWidth = html.getBoundingClientRect().width;
  63. if (BodyWidth > 750) {
  64. html.style.fontSize = 750 / 7.5 + 'px';
  65. } else {
  66. html.style.fontSize = BodyWidth / 7.5 + 'px';
  67. }
  68. }
  69. </script>
  70. <script>
  71. toastr.options.positionClass = 'toast-center-center';
  72. toastr.options.timeOut = '3000';
  73. </script>
  74. <script type="text/javascript" th:inline="javascript">
  75. var url = window.location.href;
  76. url = url.split('/')
  77. // var baseUrl = url[0] + '//' + url[2]
  78. var loc = window.location.search;
  79. var n1 = loc.length;//地址的总长度
  80. var n2 = loc.indexOf("=");//取得=号的位置
  81. var id = loc.substr(n2 + 1, n1 - n2);//从=号后面的内容
  82. var u = navigator.userAgent;
  83. var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  84. var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
  85. if (isiOS) {
  86. var btnMsg = '立即邀请'
  87. } else if (isAndroid) {
  88. btnMsg = '立即邀请'
  89. } else {
  90. btnMsg = '复制邀请链接'
  91. }
  92. $('#recv_btn').append(btnMsg)
  93. $.ajax({
  94. url: baseUrl + '/api/user/v3/invitation/client/getInvitationInfo',
  95. type: 'get',
  96. headers: {
  97. 'Authorization': id //id
  98. },
  99. contentType: "application/json",
  100. dataType: 'json',
  101. success: function (res) {
  102. $('#invitationCode').text(res.data.invitationCode)
  103. //加载数据
  104. $('#passwordCopy').val($('#invitationCode').text());
  105. //复制按钮
  106. $('.btn-code-copy').on('click', function () {
  107. var input = document.getElementById("passwordCopy");
  108. // 选中文本
  109. input.select();
  110. // 执行浏览器复制命令
  111. document.execCommand("copy");
  112. toastr.error('复制成功', 0)
  113. });
  114. if (res.data.friendList.length > 0) {
  115. var str = '<ul class="goodFriend-title-list"><li class="tal">被邀请好友帐号</li><li class="tac">获时长数(小时)</li><li class="tar">邀请时间</li></ul>'
  116. for (var i = 0; i < res.data.friendList.length; i++) {
  117. var phone = res.data.friendList[i].newPhone
  118. var inviteMsg = res.data.friendList[i].duration
  119. var registerTime = res.data.friendList[i].createTime
  120. var nPhone = phone.substr(0, 3) + '****' + phone.substring(7, 11)
  121. str += '<div class="goodFriend-item">'
  122. str += '<span class="tal">' + nPhone + '</span>'
  123. str += Number(inviteMsg) && inviteMsg > 0 ? '<span class="tac cF04646">' + inviteMsg + '</span>' : '<span class="tac">' + inviteMsg + '</span>'
  124. str += '<span class="tar">' + registerTime + '</span>'
  125. str += '</div>';
  126. }
  127. } else if (res.data.friendList.length === 0) {
  128. str = '<div class="no-data">还没有邀请到好友哦~</div>'
  129. }
  130. $('#goode').append(str);
  131. }, error: function () {
  132. str = '<div class="no-data">还没有邀请到好友哦~</div>'
  133. $('#goode').append(str)
  134. }
  135. })
  136. $("#recv_ipt").bind('input propertychange', function (e) {
  137. var ipt_phones = $('#recv_ipt').val();
  138. var c = $(this);
  139. if (/[^\d]/.test(c.val())) {//替换非数字字符
  140. var temp_amount = c.val().replace(/[^\d]/g, '');
  141. $(this).val(temp_amount);
  142. toastr.error('请输入正确的手机号')
  143. }
  144. if (ipt_phones.length >= 12) {
  145. toastr.error('请输入正确的手机号')
  146. var recvstr = ipt_phones.substring(0, 11)
  147. $("#recv_ipt").val(recvstr);
  148. }
  149. });
  150. function appDown() {
  151. var u = navigator.userAgent;
  152. var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  153. var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
  154. if (isiOS) {
  155. $.ajax({
  156. url: baseUrl + '/api/user/v1/promote',
  157. type: 'get',
  158. headers: {
  159. 'Authorization': id //id
  160. },
  161. contentType: "application/json",
  162. dataType: 'json',
  163. cache: false,
  164. success: function (res) {
  165. var jsonStr = JSON.stringify(res.data)
  166. var jsonObj = JSON.parse(jsonStr)
  167. // WKWebView使用
  168. // 使用下方方法,会报错,为使界面执行逻辑通畅,因此使用try-catch
  169. try {
  170. getMessage(jsonObj);
  171. } catch (error) {
  172. console.log(error)
  173. }
  174. try {
  175. window.webkit.messageHandlers.getMessage.postMessage(jsonObj)
  176. } catch (error) {
  177. console.log(error)
  178. }
  179. }
  180. })
  181. } else if (isAndroid) {
  182. window.native.onClikWebView()
  183. } else {
  184. $.ajax({
  185. url: baseUrl + '/api/user/v1/promote',
  186. type: 'get',
  187. headers: {
  188. 'Authorization': id //id
  189. },
  190. contentType: "application/json",
  191. dataType: 'json',
  192. cache: false,
  193. success: function (res) {
  194. //加载数据
  195. var copyBefore = JSON.stringify(res.data.url);
  196. var copyUrl = copyBefore.split('"');
  197. $('#inviteCopy').val(copyUrl[1]);
  198. var input = document.getElementById("inviteCopy");
  199. // 选中文本
  200. input.select();
  201. // 执行浏览器复制命令
  202. document.execCommand("copy");
  203. toastr.error('复制成功')
  204. }
  205. })
  206. }
  207. }
  208. </script>
  209. </body>
  210. </html>