invite.html 14 KB

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