invite.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  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/bootstrap/css/bootstrap.min.css">
  9. <link rel="stylesheet" href="../static/css/verify.css">
  10. <link rel="stylesheet" href="../static/js/vender/toastr/toastr.min.css">
  11. <link rel="stylesheet" href="../static/css/replacementActivities.css">
  12. <script>
  13. (function () {
  14. if (!window.Promise) {
  15. document.writeln('<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.min.js"><' + '/' + 'script>');
  16. }
  17. })();
  18. </script>
  19. <script src="../static/js/vender/jquery-3.4.1.min.js"></script>
  20. <script src="../static/js/vender/toastr/toastr.min.js"></script>
  21. <script src="../static/js/vender/config.js"></script>
  22. <script src="../static/js/vender/crypto-js.js"></script>
  23. <script src="../static/js/vender/ase.js"></script>
  24. <script src="../static/js/vender/verify.js"></script>
  25. </head>
  26. <body>
  27. <div class="container">
  28. <div class="share-node">
  29. <img class="share" onclick="share()" src="../static/img/replacementActivities/share.png" alt="">
  30. <div class="line"></div>
  31. <img class="qq" onclick="urlToQQ()" src="../static/img/replacementActivities/qq.png" alt="">
  32. <!-- <div class="line"></div>
  33. <a href="qq://mqqwpa://im/chat?chat_type=wpa&uin=800183764&version=1&src_type=web&web_src=oicqzone.com"><img
  34. class="cs" src="../static/img/replacementActivities/cs.png" alt=""></a> -->
  35. </div>
  36. <div class="date">2022.1.4-2022.2.8</div>
  37. <div class="header">
  38. <div class="login-container">
  39. <div class="login-bar">仅限2000份</div>
  40. <div class="ipt"></div>
  41. <div class="input-container">
  42. <div class="login-row-select">
  43. <div class="login-row-title">选择</div>
  44. <input class="login-row-ipt" id="select" placeholder="请选择平台" readonly />
  45. <img class="icon-down-img" src="../static/img/replacementActivities/arrow.png" />
  46. </div>
  47. <div class="options">
  48. <div class="icon-down-second">红手指</div>
  49. <div class="icon-down-first">多多云</div>
  50. <div class="icon-down-third">爱云兔</div>
  51. </div>
  52. <div class="login-row-account">
  53. <div class="login-row-title">账户</div>
  54. <input class="login-row-ipt" id="account" placeholder="请输入11位手机号码" />
  55. </div>
  56. <div class="tip-text1"></div>
  57. <div class="login-row-password">
  58. <div class="login-row-title">密码</div>
  59. <input class="login-row-ipt" type="password" id="password" placeholder="请输入密码" />
  60. </div>
  61. <div class="tip-text2"></div>
  62. <div class="form-btn" id="form-btn"></div>
  63. <div id="mpanel2"></div>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="mt55">
  68. <img class="w666h874" src="../static/img/replacementActivities/activityReward.png" alt="">
  69. </div>
  70. <div class="mt50">
  71. <img class="w670h476" src="../static/img/replacementActivities/inviteeReward.png" alt="">
  72. </div>
  73. <div class="mt50">
  74. <img class="w666h864" src="../static/img/replacementActivities/mattersNeedAttention.png" alt="">
  75. </div>
  76. <div class="mask1">
  77. <div class="dialog1">
  78. <img class="dialog-bg" src="../static/img/replacementActivities/dialog.png" />
  79. <div class="title1">已经注册过双子星</div>
  80. <img class="register-btn" src="../static/img/replacementActivities/register-btn.png" />
  81. <div class="register-text">您已是注册用户,可分享活动邀请有奖</div>
  82. <img class="close" onclick="registerHandle()" src="../static/img/replacementActivities/close.png" alt="">
  83. </div>
  84. <div class="tip">
  85. <img class="dialog2-bg" src="../static/img/replacementActivities/dialog2.png" />
  86. <div class="title1" style="left: 1.77rem;">已提交兑换申请</div>
  87. <div class="register-text">审核通过者,将在3个工作日内收到短<br />信通知并发放奖励,请留意短信消息。</div>
  88. <img class="close" onclick="handleClose('tip')" src="../static/img/replacementActivities/close.png" alt="">
  89. </div>
  90. <div class="tip1">
  91. <img class="dialog3-bg" src="../static/img/replacementActivities/dialog3.png" />
  92. <div class="title1" style="left: 1.75rem;text-align: center;">该账号已经申请<br />请等待审核</div>
  93. <img class="close" onclick="handleClose('tip1')" src="../static/img/replacementActivities/close.png" alt="">
  94. </div>
  95. </div>
  96. </div>
  97. <script>
  98. toastr.options.positionClass = 'toast-center-center';
  99. toastr.options.timeOut = '1500';
  100. </script>
  101. <script type="text/javascript">
  102. Date.prototype.Format = function (fmt) { // author: meizz
  103. var o = {
  104. "M+": this.getMonth() + 1, // 月份
  105. "d+": this.getDate(), // 日
  106. "h+": this.getHours(), // 小时
  107. "m+": this.getMinutes(), // 分
  108. "s+": this.getSeconds(), // 秒
  109. "q+": Math.floor((this.getMonth() + 3) / 3), // 季度
  110. "S": this.getMilliseconds() // 毫秒
  111. };
  112. if (/(y+)/.test(fmt))
  113. fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  114. for (var k in o)
  115. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  116. return fmt;
  117. }
  118. let timer, flag = true;
  119. let entryPageTime = new Date().Format("yyyy-MM-dd hh:mm:ss");
  120. let fromType = 0,
  121. account = '',
  122. password = '';
  123. var url = window.location.href;
  124. url = url.split('/')
  125. var loc = window.location.search,
  126. n1 = loc.length,//地址的总长度
  127. n2 = loc.indexOf("="),//取得=号的位置
  128. id = loc.substr(n2 + 1, n1 - n2),//从=号后面的内容
  129. u = navigator.userAgent,
  130. ua = navigator.userAgent.toLowerCase(),
  131. isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
  132. isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
  133. //埋点
  134. operate('dt_yhs_活动页面浏览');
  135. function operate(pointName, type, captchaVerification) {
  136. $.ajax({
  137. url: baseUrl + '/api/public/v1/systemBuriedPoint/stat',
  138. type: 'post',
  139. data: JSON.stringify({
  140. pointName: pointName
  141. }),
  142. contentType: "application/json",
  143. dataType: 'json',
  144. cache: false,
  145. success: function (res) {
  146. if (type === 'click') {
  147. changePhone(captchaVerification);
  148. }
  149. },
  150. })
  151. }
  152. // 跳转至QQ群
  153. function urlToQQ() {
  154. stopManyClick(() => {
  155. var oInput = document.createElement('input'); //创建一个input
  156. oInput.setAttribute("readonly", "readonly");//设置只读,否则移动端使用复制功能时可能会造成软件盘弹出
  157. oInput.value = '172567036';
  158. $('.ipt')[0].appendChild(oInput);//将input插入到body
  159. // oInput.select(); // 选择对象 ios不支持
  160. selectText(oInput, 0, oInput.value.length);
  161. document.execCommand("Copy"); // 执行浏览器复制命令
  162. toastr.error('QQ群号复制成功');
  163. oInput.style.display = 'none'; // 将input隐藏
  164. oInput.blur();
  165. oInput.remove(); // 将input销毁
  166. })
  167. }
  168. //点击分享
  169. $('.register-btn')[0].addEventListener('click', () => {
  170. if (!id) {
  171. copyUrl();
  172. } else if (isiOS) {
  173. $.ajax({
  174. url: baseUrl + '/api/user/v1/promote',
  175. type: 'get',
  176. headers: {
  177. 'Authorization': id //id
  178. },
  179. contentType: "application/json",
  180. dataType: 'json',
  181. cache: false,
  182. success: function (res) {
  183. var jsonStr = JSON.stringify(res.data)
  184. var jsonObj = JSON.parse(jsonStr)
  185. // WKWebView使用
  186. // 使用下方方法,会报错,为使界面执行逻辑通畅,因此使用try-catch
  187. try {
  188. getMessage(jsonObj);
  189. } catch (error) {
  190. console.log(error)
  191. }
  192. try {
  193. window.webkit.messageHandlers.getMessage.postMessage(jsonObj)
  194. } catch (error) {
  195. copyUrl();
  196. }
  197. }
  198. })
  199. } else if (isAndroid) {
  200. if (window.native) {
  201. window.native.onClikWebView()
  202. } else {
  203. copyUrl();
  204. }
  205. } else {
  206. copyUrl();
  207. }
  208. }, false);
  209. function share() {
  210. if (!id) {
  211. copyUrl();
  212. } else if (isiOS) {
  213. $.ajax({
  214. url: baseUrl + '/api/user/v1/promote',
  215. type: 'get',
  216. headers: {
  217. 'Authorization': id //id
  218. },
  219. contentType: "application/json",
  220. dataType: 'json',
  221. cache: false,
  222. success: function (res) {
  223. var jsonStr = JSON.stringify(res.data)
  224. var jsonObj = JSON.parse(jsonStr)
  225. // WKWebView使用
  226. // 使用下方方法,会报错,为使界面执行逻辑通畅,因此使用try-catch
  227. try {
  228. getMessage(jsonObj);
  229. } catch (error) {
  230. console.log(error)
  231. }
  232. try {
  233. window.webkit.messageHandlers.getMessage.postMessage(jsonObj)
  234. } catch (error) {
  235. copyUrl();
  236. }
  237. }
  238. })
  239. } else if (isAndroid) {
  240. if (window.native) {
  241. window.native.onClikWebView()
  242. } else {
  243. copyUrl();
  244. }
  245. } else {
  246. copyUrl();
  247. }
  248. }
  249. //复制
  250. function copyUrl() {
  251. stopManyClick(() => {
  252. var oInput = document.createElement('input'); //创建一个input
  253. oInput.setAttribute("readonly", "readonly");//设置只读,否则移动端使用复制功能时可能会造成软件盘弹出
  254. oInput.value = window.location.href || 'https://client.androidscloud.com/h5/microserviceUserH5/vcloud/invite.html';
  255. $('.ipt')[0].appendChild(oInput);//将input插入到body
  256. // oInput.select(); // 选择对象 ios不支持
  257. selectText(oInput, 0, oInput.value.length);
  258. document.execCommand("Copy"); // 执行浏览器复制命令
  259. toastr.error('复制当前网址成功!');
  260. oInput.style.display = 'none'; // 将input隐藏
  261. oInput.blur();
  262. oInput.remove(); // 将input销毁
  263. })
  264. }
  265. // input自带的select()方法在苹果端无法进行选择,所以需要自己去写一个类似的方法
  266. // 选择文本。createTextRange(setSelectionRange)是input方法
  267. function selectText(textbox, startIndex, stopIndex) {
  268. if (textbox.createTextRange) {//ie
  269. const range = textbox.createTextRange();
  270. range.collapse(true);
  271. range.moveStart('character', startIndex);//起始光标
  272. range.moveEnd('character', stopIndex - startIndex);//结束光标
  273. range.select();//不兼容苹果
  274. } else {//firefox/chrome
  275. textbox.setSelectionRange(startIndex, stopIndex);
  276. textbox.focus();
  277. }
  278. }
  279. // 默认选中红手指
  280. function handleClick() {
  281. $('.options')[0].className = 'options';
  282. $('#select').val('红手指');
  283. fromType = 2;
  284. };
  285. handleClick();
  286. //点击选择框
  287. $('.login-row-select')[0].addEventListener('click', () => {
  288. $('.options')[0].className = 'options show';
  289. }, false);
  290. //点击多多云
  291. $('.icon-down-first')[0].addEventListener('click', () => {
  292. $('.options')[0].className = 'options';
  293. $('#select').val('多多云');
  294. fromType = 1;
  295. }, false);
  296. //点击红手指
  297. $('.icon-down-second')[0].addEventListener('click', handleClick, false);
  298. //点击爱云兔
  299. $('.icon-down-third')[0].addEventListener('click', () => {
  300. $('.options')[0].className = 'options';
  301. $('#select').val('爱云兔');
  302. fromType = 3;
  303. }, false);
  304. //点击弹窗关闭按钮
  305. function handleClose(str) {
  306. $('.' + str).animate({ top: '-6.96rem' }, "fast");
  307. $('.mask1').hide();
  308. document.documentElement.style.overflow = 'auto';
  309. }
  310. //点击关闭
  311. function registerHandle() {
  312. $('.dialog1').animate({ top: '-6.96rem' }, "fast");
  313. $('.mask1').hide();
  314. document.documentElement.style.overflow = 'auto';
  315. }
  316. var html = document.documentElement;
  317. var imgWidth = html.getBoundingClientRect().width / 750 * 400 + 'px';
  318. var imgHeight = html.getBoundingClientRect().width / 750 * 200 + 'px';
  319. var barHeight = html.getBoundingClientRect().width / 750 * 70 + 'px';
  320. validate(); // 生成验证码
  321. function validate() {
  322. $('#mpanel2').slideVerify({
  323. baseUrl: baseUrl + '/api/user', //服务器请求地址, 默认地址为安吉服务器;
  324. mode: 'pop', //展示模式
  325. containerId: 'form-btn', //pop模式 必填 被点击之后出现行为验证码的元素id
  326. imgSize: { //图片的大小对象,有默认值{ width: '310px',height: '155px'},可省略
  327. width: imgWidth,
  328. height: imgHeight
  329. },
  330. barSize: {//下方滑块的大小对象,有默认值{ width: '310px',height: '50px'},可省略
  331. width: imgWidth,
  332. height: barHeight
  333. },
  334. beforeCheck: function () {
  335. account = $('#account').val();
  336. account = account.replace(/\s+/g, "");
  337. password = $('#password').val();
  338. password = password.replace(/\s+/g, "");
  339. if (!account) {
  340. $('.tip-text1').text('账号格式不正确,请重新输入!');
  341. $('#account').addClass('br');
  342. return false
  343. } else {
  344. $('.tip-text1').text('');
  345. $('#account').removeClass('br')
  346. }
  347. if (!/^1[3|4|5|6|7|8|9][0-9]\d{8}$/.test(account)) {
  348. $('.tip-text1').text('账号格式不正确,请重新输入!');
  349. $('#account').addClass('br');
  350. return false
  351. } else {
  352. $('.tip-text1').text('');
  353. $('#account').removeClass('br')
  354. }
  355. if (!password) {
  356. $('.tip-text2').text('密码为空,请重新输入!');
  357. $('#password').addClass('br');
  358. return false
  359. } else {
  360. $('.tip-text2').text('');
  361. $('#password').removeClass('br');
  362. return true
  363. }
  364. },
  365. ready: function () { }, //加载完毕的回调
  366. success: function (params) { //成功的回调
  367. operate('dt_yhs_点击免费换机按钮', 'click', params.captchaVerification);
  368. },
  369. error: function () {}
  370. });
  371. }
  372. //调用免费换机接口
  373. function changePhone(captchaVerification) {
  374. let data = {
  375. inviteTime: entryPageTime,
  376. type: fromType,
  377. account: account,
  378. password: password,
  379. captchaVerification: captchaVerification
  380. }
  381. if (!id) {
  382. delete data.inviteTime
  383. }
  384. let ajaxObj = {
  385. url: baseUrl + '/api/public/v1/activity/change/phone',
  386. type: 'post',
  387. headers: {
  388. 'Authorization': id //id
  389. },
  390. data: JSON.stringify(data),
  391. contentType: "application/json",
  392. dataType: 'json',
  393. cache: false,
  394. success: function (res) {
  395. if (res.status === 0) {
  396. $('.tip').animate({ top: '46vh' }, "fast");
  397. $('.mask1').show();
  398. $('.dialog1').animate({ top: '-6.96rem' }, "fast");
  399. $('.tip1').animate({ top: '-6.96rem' }, "fast");
  400. document.documentElement.style.overflow = 'hidden';
  401. } else if (res.status === 2002) {
  402. $('.tip1').animate({ top: '48vh' }, "fast");
  403. $('.mask1').show();
  404. $('.dialog1').animate({ top: '-6.96rem' }, "fast");
  405. $('.tip').animate({ top: '-6.96rem' }, "fast");
  406. document.documentElement.style.overflow = 'hidden';
  407. } else if (res.status === 2001) {
  408. $('.dialog1').animate({ top: '48vh' }, "fast");
  409. $('.mask1').show();
  410. $('.tip').animate({ top: '-6.96rem' }, "fast");
  411. $('.tip1').animate({ top: '-6.96rem' }, "fast");
  412. document.documentElement.style.overflow = 'hidden';
  413. }
  414. }
  415. }
  416. if (!id) {
  417. delete ajaxObj.headers
  418. }
  419. $.ajax(ajaxObj)
  420. }
  421. //防止提示一秒内重复显示
  422. function stopManyClick(fn) {
  423. if (flag) {
  424. fn();
  425. }
  426. flag = false;
  427. if (timer) { clearTimeout(timer); }
  428. timer = setTimeout(() => { flag = true }, 1500);
  429. }
  430. </script>
  431. </body>
  432. <style>
  433. #toast-container>.toast-error {
  434. background-image: none !important;
  435. }
  436. .toast-error {
  437. background-color: rgba(0, 0, 0, 0.8);
  438. }
  439. #toast-container>div {
  440. font-size: 14px;
  441. min-width: 80px !important;
  442. padding: 12px !important;
  443. box-shadow: none;
  444. }
  445. @media (max-width: 480px) and (min-width: 241px) {
  446. #toast-container>div {
  447. min-width: 80px !important;
  448. width: auto;
  449. }
  450. }
  451. @media only screen and (min-width: 640px) {
  452. .toast-center-center {
  453. top: 50%;
  454. left: 50%;
  455. transform: translate(-50%, -50%);
  456. }
  457. }
  458. @media only screen and (max-width: 640px) {
  459. .toast-center-center {
  460. top: 50%;
  461. left: 50%;
  462. transform: translate(-50%, -50%);
  463. }
  464. }
  465. input::-webkit-input-placeholder {
  466. color: #BBBBBB;
  467. }
  468. input::-moz-placeholder {
  469. /* Mozilla Firefox 19+ */
  470. color: #BBBBBB;
  471. }
  472. input:-moz-placeholder {
  473. /* Mozilla Firefox 4 to 18 */
  474. color: #BBBBBB;
  475. }
  476. input:-ms-input-placeholder {
  477. /* Internet Explorer 10-11 */
  478. color: #BBBBBB;
  479. }
  480. </style>
  481. </html>