invite.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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 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">
  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. if (isiOS) {
  94. $.ajax({
  95. url: baseUrl + '/api/user/v3/invitation/client/getInvitationInfo',
  96. type: 'get',
  97. headers: {
  98. 'Authorization': id //id
  99. },
  100. contentType: "application/json",
  101. dataType: 'json',
  102. cache: false,
  103. success: function (res) {
  104. var jsonStr = JSON.stringify(res.data)
  105. var jsonObj = JSON.parse(jsonStr)
  106. // WKWebView使用
  107. // 使用下方方法,会报错,为使界面执行逻辑通畅,因此使用try-catch
  108. try {
  109. getMessage(jsonObj);
  110. } catch (error) {
  111. console.log(error)
  112. }
  113. try {
  114. window.webkit.messageHandlers.getMessage.postMessage(jsonObj)
  115. } catch (error) {
  116. console.log(error)
  117. }
  118. }
  119. })
  120. } else if (isAndroid) {
  121. window.native.onClikWebView()
  122. } else {
  123. $.ajax({
  124. url: baseUrl + '/api/user/v3/invitation/client/getInvitationInfo',
  125. type: 'get',
  126. headers: {
  127. 'Authorization': id //id
  128. },
  129. contentType: "application/json",
  130. dataType: 'json',
  131. cache: false,
  132. success: function (res) {
  133. $('#invitationCode').text(res.data.invitationCode)
  134. //加载数据
  135. $('#passwordCopy').val($('#invitationCode').text());
  136. //复制按钮
  137. $('.btn-code-copy').on('click', function () {
  138. var input = document.getElementById("passwordCopy");
  139. // 选中文本
  140. input.select();
  141. // 执行浏览器复制命令
  142. document.execCommand("copy");
  143. toastr.error('复制成功', 0)
  144. });
  145. if (res.data.friendList.length > 0) {
  146. var str = '<ul class="goodFriend-title-list"><li class="tal">被邀请好友帐号</li><li class="tac">获时长数(小时)</li><li class="tar">邀请时间</li></ul>'
  147. for (var i = 0; i < res.data.friendList.length; i++) {
  148. var phone = res.data.friendList[i].newPhone
  149. var inviteMsg = res.data.friendList[i].duration
  150. var registerTime = res.data.friendList[i].createTime
  151. var nPhone = phone.substr(0, 3) + '****' + phone.substring(7, 11)
  152. str += '<div class="goodFriend-item">'
  153. str += '<span class="tal">' + nPhone + '</span>'
  154. str += Number(inviteMsg) && inviteMsg > 0 ? '<span class="tac cF04646">' + inviteMsg + '</span>' : '<span class="tac">' + inviteMsg + '</span>'
  155. str += '<span class="tar">' + registerTime + '</span>'
  156. str += '</div>';
  157. }
  158. } else if (res.data.friendList.length === 0) {
  159. str = '<div class="no-data">还没有邀请到好友哦~</div>'
  160. }
  161. $('#goode').append(str);
  162. },
  163. error: function () {
  164. str = '<div class="no-data">还没有邀请到好友哦~</div>'
  165. $('#goode').append(str)
  166. }
  167. })
  168. }
  169. $("#recv_ipt").bind('input propertychange', function (e) {
  170. var ipt_phones = $('#recv_ipt').val();
  171. var c = $(this);
  172. if (/[^\d]/.test(c.val())) {//替换非数字字符
  173. var temp_amount = c.val().replace(/[^\d]/g, '');
  174. $(this).val(temp_amount);
  175. toastr.error('请输入正确的手机号')
  176. }
  177. if (ipt_phones.length >= 12) {
  178. toastr.error('请输入正确的手机号')
  179. var recvstr = ipt_phones.substring(0, 11)
  180. $("#recv_ipt").val(recvstr);
  181. }
  182. });
  183. function appDown() {
  184. var u = navigator.userAgent;
  185. var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  186. var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
  187. if (isiOS) {
  188. $.ajax({
  189. url: baseUrl + '/api/user/v1/promote',
  190. type: 'get',
  191. headers: {
  192. 'Authorization': id //id
  193. },
  194. contentType: "application/json",
  195. dataType: 'json',
  196. cache: false,
  197. success: function (res) {
  198. var jsonStr = JSON.stringify(res.data)
  199. var jsonObj = JSON.parse(jsonStr)
  200. // WKWebView使用
  201. // 使用下方方法,会报错,为使界面执行逻辑通畅,因此使用try-catch
  202. try {
  203. getMessage(jsonObj);
  204. } catch (error) {
  205. console.log(error)
  206. }
  207. try {
  208. window.webkit.messageHandlers.getMessage.postMessage(jsonObj)
  209. } catch (error) {
  210. console.log(error)
  211. }
  212. }
  213. })
  214. } else if (isAndroid) {
  215. window.native.onClikWebView()
  216. } else {
  217. $.ajax({
  218. url: baseUrl + '/api/user/v1/promote',
  219. type: 'get',
  220. headers: {
  221. 'Authorization': id //id
  222. },
  223. contentType: "application/json",
  224. dataType: 'json',
  225. cache: false,
  226. success: function (res) {
  227. //加载数据
  228. var copyBefore = JSON.stringify(res.data.url);
  229. var copyUrl = copyBefore.split('"');
  230. $('#inviteCopy').val(copyUrl[1]);
  231. var input = document.getElementById("inviteCopy");
  232. // 选中文本
  233. input.select();
  234. // 执行浏览器复制命令
  235. document.execCommand("copy");
  236. toastr.error('复制成功')
  237. }
  238. })
  239. }
  240. }
  241. </script>
  242. </body>
  243. </html>