invite.html 11 KB

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