invite.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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. <style>
  14. .my-tips{
  15. position: fixed;
  16. top: 50%;
  17. left: 50%;
  18. transform: translate(-50%, -50%);
  19. font-size: 0.28rem;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <div class="my-tips">当前功能维护中,暂无法使用</div>
  25. <!-- <div class="invite-container pr">
  26. <div class="rules" onclick="handleShow()">活动规则</div>
  27. <div class="h658">
  28. <img src="../static/img/invite/inviteTop.png" class="bottom-img" alt="">
  29. <div class="recv-cont">
  30. <div class="title" id="title">
  31. </div>
  32. <div class="recv-btn-container">
  33. <div onclick="appDown()" class="recv-btn"></div>
  34. </div>
  35. <div class="recv-ipt" id="recv_ipt">
  36. <span class="fl">
  37. <span>我的邀请码:</span>
  38. <span class="fw500" id="invitationCode"></span>
  39. </span>
  40. <span class="copy-btn-style btn-code-copy fr">点击复制</span>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="load-menu">
  45. <div class="center-reward-con">
  46. <div class="top-title">我的奖励</div>
  47. <div id="goode">
  48. <div class="reward-second-title"></div>
  49. <ul class="goodFriend-title-list">
  50. <li class="tac">被邀好友帐号</li>
  51. <li class="tac">获时长数(小时)</li>
  52. <li class="tac">邀请时间</li>
  53. </ul>
  54. </div>
  55. </div>
  56. <div class="center-reward-con mt40">
  57. <div class="top-title">邀请榜TOP10</div>
  58. <div id="rank">
  59. <ul class="goodFriend-title-list">
  60. <li class="tac">排名</li>
  61. <li class="tac">用户名</li>
  62. <li class="tac">邀请数量</li>
  63. <li class="tac">奖励(时长)</li>
  64. </ul>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="mask">
  69. <div class="dialog">
  70. <div class="code-title-font"></div>
  71. <div class="tb-codes">
  72. <p class="fw500">好友购机,买一送一</p>
  73. <p>被邀好友购买任意套餐,您可获其等额时长返现(仅限首单);邀请越多返现越多,返现无上限。请用户参与活动前认真阅读规则,若因未按规则参与活动而造成的损失,由用户自行承担。</p>
  74. <p class="fw500">规则</p>
  75. <p>1、好友购机前,邀请人账户内无云手机(无云手机购买记录者),或仅有免费试用时长的用户,则无法获时长奖励;</p>
  76. <p>2、邀请成功后,双方自动成为好友,邀请奖励将通过好友消息的方式进行发放,邀请方需要点击【领取】,才可领取成功,时长奖励返现至您账户内时长最多的云手机。邀请奖励领取期限为24小时,超过领取期限则无法领取奖励。</p>
  77. <p>3、如发现有刷单等行为用户,将对该账号及其所关联账号进行冻结处理;</p>
  78. <p>4、本活动最终解释权归双子星云手机所有。</p>
  79. </div>
  80. </div>
  81. <div class="close" onclick="handleClose()"></div>
  82. </div>
  83. </div>
  84. <input type="text" style="opacity: 0;z-index: -10;position: fixed;" id="passwordCopy" value="">
  85. <input type="text" style="opacity: 0;z-index: -10;position: fixed;" id="inviteCopy" value=""> -->
  86. <script>
  87. toastr.options.positionClass = 'toast-center-center';
  88. toastr.options.timeOut = '1500';
  89. </script>
  90. <!-- <script type="text/javascript">
  91. let timer, flag = true;
  92. var url = window.location.href;
  93. url = url.split('/')
  94. // var baseUrl = url[0] + '//' + url[2]
  95. var loc = window.location.search;
  96. var n1 = loc.length;//地址的总长度
  97. var n2 = loc.indexOf("=");//取得=号的位置
  98. // var id = loc.substr(n2 + 1, n1 - n2);//从=号后面的内容
  99. var id = loc.substr(n2 + 1, n1 - n2);//从=号后面的内容
  100. var u = navigator.userAgent;
  101. var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  102. var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
  103. if (!id) {
  104. if (isAndroid) {
  105. window.native.toGame('noToken');
  106. } else if (isiOS) {
  107. window.webkit.messageHandlers.getPackageName.postMessage('noToken');
  108. } else {
  109. toastr.error('请登录')
  110. }
  111. }
  112. $.ajax({
  113. url: baseUrl + '/api/activity/v3/invitation/getInvitationInfo',
  114. type: 'get',
  115. headers: {
  116. 'Authorization': id //id
  117. },
  118. contentType: "application/json",
  119. dataType: 'json',
  120. cache: false,
  121. success: function (res) {
  122. $('#invitationCode').text(res.data.invitationCode)
  123. //加载数据
  124. $('#passwordCopy').val($('#invitationCode').text());
  125. //复制按钮
  126. $('.btn-code-copy').on('click', function () {
  127. stopManyClick(() => {
  128. var input = document.getElementById("passwordCopy");
  129. // 选中文本
  130. input.select();
  131. // 执行浏览器复制命令
  132. // document.activeElement.blur();
  133. document.execCommand("copy");
  134. toastr.error('复制成功', 0)
  135. })
  136. });
  137. if (res.data.friendList.length > 0) {
  138. var str = ''
  139. for (var i = 0; i < res.data.friendList.length; i++) {
  140. var phone = res.data.friendList[i].newPhone
  141. var inviteMsg = res.data.friendList[i].duration
  142. var registerTime = res.data.friendList[i].createTime
  143. var nPhone = phone.substr(0, 3) + '****' + phone.substring(7, 11)
  144. str += '<div class="goodFriend-item">'
  145. str += '<span class="tal">' + nPhone + '</span>'
  146. str += Number(inviteMsg) && inviteMsg > 0 ? '<span class="tac cF04646">' + inviteMsg + '</span>' : '<span class="tac">' + inviteMsg + '</span>'
  147. str += '<span class="tar">' + registerTime + '</span>'
  148. str += '</div>';
  149. }
  150. } else if (res.data.friendList.length === 0) {
  151. str = '<div class="no-data">还没有邀请到好友哦~</div>'
  152. }
  153. $('#goode').append(str);
  154. },
  155. error: function () {
  156. str = '<div class="no-data">还没有邀请到好友哦~</div>'
  157. $('#goode').append(str)
  158. }
  159. })
  160. $("#recv_ipt").bind('input propertychange', function (e) {
  161. stopManyClick(() => {
  162. var ipt_phones = $('#recv_ipt').val();
  163. var c = $(this);
  164. if (/[^\d]/.test(c.val())) {//替换非数字字符
  165. var temp_amount = c.val().replace(/[^\d]/g, '');
  166. $(this).val(temp_amount);
  167. toastr.error('请输入正确的手机号')
  168. }
  169. if (ipt_phones.length >= 12) {
  170. toastr.error('请输入正确的手机号')
  171. var recvstr = ipt_phones.substring(0, 11)
  172. $("#recv_ipt").val(recvstr);
  173. }
  174. })
  175. });
  176. function handleShow() {
  177. $('.dialog').animate({ top: '2.4rem' }, "fast");
  178. $('.close').animate({ top: '10.56rem' }, "fast");
  179. $('.mask').show();
  180. document.documentElement.style.overflow = 'hidden';
  181. }
  182. function handleClose() {
  183. $('.dialog').animate({ top: '-6.96rem' }, "fast");
  184. $('.close').animate({ top: '-0.68rem' }, "fast");
  185. $('.mask').hide();
  186. document.documentElement.style.overflow = 'auto';
  187. }
  188. function appDown() {
  189. var u = navigator.userAgent;
  190. var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  191. var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
  192. if (!id) {
  193. if (isAndroid) {
  194. window.native.toGame('noToken');
  195. } else if (isiOS) {
  196. window.webkit.messageHandlers.getPackageName.postMessage('noToken');
  197. } else {
  198. toastr.error('请登录')
  199. }
  200. return
  201. }
  202. $.ajax({
  203. url: baseUrl + '/api/activity/v1/promote/getImPromoteUrl',
  204. type: 'get',
  205. headers: {
  206. 'Authorization': id //id
  207. },
  208. contentType: "application/json",
  209. dataType: 'json',
  210. cache: false,
  211. success: function (res) {
  212. var jsonStr = JSON.stringify(res.data)
  213. var jsonObj = JSON.parse(jsonStr)
  214. if (isiOS) {
  215. // WKWebView使用
  216. // 使用下方方法,会报错,为使界面执行逻辑通畅,因此使用try-catch
  217. try {
  218. getMessage(jsonObj);
  219. } catch (error) {
  220. console.log(error)
  221. }
  222. try {
  223. window.webkit.messageHandlers.getMessage.postMessage(jsonObj)
  224. } catch (error) {
  225. console.log(error)
  226. }
  227. } else if (isAndroid) {
  228. window.native.onClikWebView()
  229. } else {
  230. stopManyClick(() => {
  231. //加载数据
  232. var copyBefore = JSON.stringify(res.data.url);
  233. var copyUrl = copyBefore.split('"');
  234. console.log(copyUrl[1])
  235. $('#inviteCopy').val(copyUrl[1]);
  236. var input = document.getElementById("inviteCopy");
  237. // 选中文本
  238. input.select();
  239. // 执行浏览器复制命令
  240. document.execCommand("copy");
  241. toastr.error('复制成功')
  242. })
  243. }
  244. }
  245. })
  246. }
  247. // 查询季度排行榜
  248. function getInvitationRankList() {
  249. $.ajax({
  250. url: baseUrl + '/api/activity/v3/invitation/getInvitationRankList',
  251. type: 'get',
  252. headers: {
  253. 'Authorization': id //id
  254. },
  255. contentType: "application/json",
  256. dataType: 'json',
  257. cache: false,
  258. success: function (res) {
  259. var str = '';
  260. if (res.status === 0) {
  261. res.data.forEach(function (item, index) {
  262. var surfaceName = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/.test(item.surfaceName) ? item.surfaceName.substr(0, 3) + '****' + item.surfaceName.substring(7, 11) : item.surfaceName
  263. if (index === 0) {
  264. str += '<div class="rank-item">';
  265. str += '<span class="tac h52"><img class="icon" src="../static/img/invite/no1.png" alt=""></span>'
  266. str += '<span class="tac cF04646">' + surfaceName + '</span>'
  267. str += '<span class="tac cF04646">' + item.invitationNum + '</span>'
  268. str += '<span class="tac cF04646">' + item.duration + '</span>'
  269. str += '</div>';
  270. } else if (index === 1) {
  271. str += '<div class="rank-item">';
  272. str += '<span class="tac h52"><img class="icon" src="../static/img/invite/no2.png" alt=""></span>'
  273. str += '<span class="tac cF04646">' + surfaceName + '</span>'
  274. str += '<span class="tac cF04646">' + item.invitationNum + '</span>'
  275. str += '<span class="tac cF04646">' + item.duration + '</span>'
  276. str += '</div>';
  277. } else if (index === 2) {
  278. str += '<div class="rank-item">';
  279. str += '<span class="tac h52"><img class="icon" src="../static/img/invite/no3.png" alt=""></span>'
  280. str += '<span class="tac cF04646">' + surfaceName + '</span>'
  281. str += '<span class="tac cF04646">' + item.invitationNum + '</span>'
  282. str += '<span class="tac cF04646">' + item.duration + '</span>'
  283. str += '</div>';
  284. } else if (index < 10) {
  285. str += '<div class="rank-item">';
  286. str += '<span class="tac c333">' + (index + 1) + '</span>'
  287. str += '<span class="tac">' + surfaceName + '</span>'
  288. str += '<span class="tac">' + item.invitationNum + '</span>'
  289. str += '<span class="tac">' + item.duration + '</span>'
  290. str += '</div>';
  291. }
  292. });
  293. }
  294. $('#rank').append(str);
  295. }
  296. })
  297. }
  298. getInvitationRankList()
  299. // 查询最新获得奖励
  300. function getInvitationRecently() {
  301. $.ajax({
  302. url: baseUrl + '/api/activity/v3/invitation/getInvitationRecently',
  303. type: 'get',
  304. headers: {
  305. 'Authorization': id //id
  306. },
  307. contentType: "application/json",
  308. dataType: 'json',
  309. cache: false,
  310. success: function (res) {
  311. if (res.status === 0) {
  312. console.log(res.data)
  313. if (res.data.length <= 10) {
  314. let datas = ['173', '134', '152', '136', '138', '173', '134', '152', '136', '138'];
  315. var str = '<ul class="list">'
  316. datas.forEach(function (item) {
  317. str += '<li>恭喜' + item + '*******成功获得时长' + (item - 100) + '小时</li>'
  318. })
  319. str += '</ul>'
  320. } else {
  321. var str = '<ul class="list">'
  322. res.data.forEach(function (item) {
  323. str += '<li>恭喜' + item.username.substr(0, 3) + '*******成功获得时长' + item.duration + '小时</li>'
  324. })
  325. str += '</ul>'
  326. }
  327. $('#title').append(str);
  328. }
  329. }
  330. })
  331. }
  332. getInvitationRecently()
  333. //防止提示一秒内重复显示
  334. function stopManyClick(fn) {
  335. if (flag) {
  336. fn();
  337. }
  338. flag = false;
  339. if (timer) { clearTimeout(timer); }
  340. timer = setTimeout(() => { flag = true }, 1500);
  341. }
  342. </script> -->
  343. </body>
  344. </html>