replacementActivities.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  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="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. if (isAndroid) {
  152. window.location.href = 'https://jq.qq.com/?_wv=1027&k=dU5VFcNx'
  153. }
  154. if (isIOS) {
  155. window.location.href = 'https://jq.qq.com/?_wv=1027&k=dU5VFcNx'
  156. }
  157. }
  158. //点击分享
  159. $('.register-btn')[0].addEventListener('click', () => {
  160. if (!id) {
  161. copyUrl();
  162. } else if (isiOS) {
  163. $.ajax({
  164. url: baseUrl + '/api/user/v1/promote',
  165. type: 'get',
  166. headers: {
  167. 'Authorization': id //id
  168. },
  169. contentType: "application/json",
  170. dataType: 'json',
  171. cache: false,
  172. success: function (res) {
  173. var jsonStr = JSON.stringify(res.data)
  174. var jsonObj = JSON.parse(jsonStr)
  175. // WKWebView使用
  176. // 使用下方方法,会报错,为使界面执行逻辑通畅,因此使用try-catch
  177. try {
  178. getMessage(jsonObj);
  179. } catch (error) {
  180. console.log(error)
  181. }
  182. try {
  183. window.webkit.messageHandlers.getMessage.postMessage(jsonObj)
  184. } catch (error) {
  185. copyUrl();
  186. }
  187. }
  188. })
  189. } else if (isAndroid) {
  190. if (window.native) {
  191. window.native.onClikWebView()
  192. } else {
  193. copyUrl();
  194. }
  195. } else {
  196. copyUrl();
  197. }
  198. }, false);
  199. //复制
  200. function copyUrl() {
  201. stopManyClick(() => {
  202. var oInput = document.createElement('input'); //创建一个input
  203. oInput.setAttribute("readonly", "readonly");//设置只读,否则移动端使用复制功能时可能会造成软件盘弹出
  204. oInput.value = window.location.href || 'https://client.androidscloud.com/h5/microserviceUserH5/vcloud/invite.html';
  205. $('.ipt')[0].appendChild(oInput);//将input插入到body
  206. // oInput.select(); // 选择对象 ios不支持
  207. selectText(oInput, 0, oInput.value.length);
  208. document.execCommand("Copy"); // 执行浏览器复制命令
  209. toastr.error('复制当前网址成功!');
  210. oInput.style.display = 'none'; // 将input隐藏
  211. oInput.blur();
  212. oInput.remove(); // 将input销毁
  213. })
  214. }
  215. // input自带的select()方法在苹果端无法进行选择,所以需要自己去写一个类似的方法
  216. // 选择文本。createTextRange(setSelectionRange)是input方法
  217. function selectText(textbox, startIndex, stopIndex) {
  218. if (textbox.createTextRange) {//ie
  219. const range = textbox.createTextRange();
  220. range.collapse(true);
  221. range.moveStart('character', startIndex);//起始光标
  222. range.moveEnd('character', stopIndex - startIndex);//结束光标
  223. range.select();//不兼容苹果
  224. } else {//firefox/chrome
  225. textbox.setSelectionRange(startIndex, stopIndex);
  226. textbox.focus();
  227. }
  228. }
  229. // 默认选中红手指
  230. function handleClick() {
  231. $('.options')[0].className = 'options';
  232. $('#select').val('红手指');
  233. fromType = 2;
  234. };
  235. handleClick();
  236. //点击选择框
  237. $('.login-row-select')[0].addEventListener('click', () => {
  238. $('.options')[0].className = 'options show';
  239. }, false);
  240. //点击多多云
  241. $('.icon-down-first')[0].addEventListener('click', () => {
  242. $('.options')[0].className = 'options';
  243. $('#select').val('多多云');
  244. fromType = 1;
  245. }, false);
  246. //点击红手指
  247. $('.icon-down-second')[0].addEventListener('click', handleClick, false);
  248. //点击爱云兔
  249. $('.icon-down-third')[0].addEventListener('click', () => {
  250. $('.options')[0].className = 'options';
  251. $('#select').val('爱云兔');
  252. fromType = 3;
  253. }, false);
  254. //点击弹窗关闭按钮
  255. function handleClose(str) {
  256. $('.' + str).animate({ top: '-6.96rem' }, "fast");
  257. $('.mask1').hide();
  258. document.documentElement.style.overflow = 'auto';
  259. }
  260. //点击关闭
  261. function registerHandle() {
  262. $('.dialog1').animate({ top: '-6.96rem' }, "fast");
  263. $('.mask1').hide();
  264. document.documentElement.style.overflow = 'auto';
  265. }
  266. var html = document.documentElement;
  267. var imgWidth = html.getBoundingClientRect().width / 750 * 400 + 'px';
  268. var imgHeight = html.getBoundingClientRect().width / 750 * 200 + 'px';
  269. var barHeight = html.getBoundingClientRect().width / 750 * 70 + 'px';
  270. $('#mpanel2').slideVerify({
  271. baseUrl: baseUrl + '/api/user', //服务器请求地址, 默认地址为安吉服务器;
  272. mode: 'pop', //展示模式
  273. containerId: 'form-btn', //pop模式 必填 被点击之后出现行为验证码的元素id
  274. imgSize: { //图片的大小对象,有默认值{ width: '310px',height: '155px'},可省略
  275. width: imgWidth,
  276. height: imgHeight
  277. },
  278. barSize: {//下方滑块的大小对象,有默认值{ width: '310px',height: '50px'},可省略
  279. width: imgWidth,
  280. height: barHeight
  281. },
  282. beforeCheck: function () {
  283. account = $('#account').val();
  284. account = account.replace(/\s+/g, "");
  285. password = $('#password').val();
  286. password = password.replace(/\s+/g, "");
  287. if (!account) {
  288. $('.tip-text1').text('账号格式不正确,请重新输入!');
  289. $('#account').addClass('br');
  290. return false
  291. } else {
  292. $('.tip-text1').text('');
  293. $('#account').removeClass('br')
  294. }
  295. if (!/^1[3|4|5|6|7|8|9][0-9]\d{8}$/.test(account)) {
  296. $('.tip-text1').text('账号格式不正确,请重新输入!');
  297. $('#account').addClass('br');
  298. return false
  299. } else {
  300. $('.tip-text1').text('');
  301. $('#account').removeClass('br')
  302. }
  303. if (!password) {
  304. $('.tip-text2').text('密码为空,请重新输入!');
  305. $('#password').addClass('br');
  306. return false
  307. } else {
  308. $('.tip-text2').text('');
  309. $('#password').removeClass('br');
  310. return true
  311. }
  312. },
  313. ready: function () {}, //加载完毕的回调
  314. success: function (params) { //成功的回调
  315. operate('dt_yhs_点击免费换机按钮', 'click', params.captchaVerification);
  316. },
  317. error: function () {
  318. console.log('error');
  319. } //失败的回调
  320. });
  321. //调用免费换机接口
  322. function changePhone(captchaVerification) {
  323. let data = {
  324. inviteTime: entryPageTime,
  325. type: fromType,
  326. account: account,
  327. password: password,
  328. captchaVerification: captchaVerification
  329. }
  330. if (!id) {
  331. delete data.inviteTime
  332. }
  333. let ajaxObj = {
  334. url: baseUrl + '/api/public/v1/activity/change/phone',
  335. type: 'post',
  336. headers: {
  337. 'Authorization': id //id
  338. },
  339. data: JSON.stringify(data),
  340. contentType: "application/json",
  341. dataType: 'json',
  342. cache: false,
  343. success: function (res) {
  344. if (res.status === 0) {
  345. $('.tip1').animate({ top: '46vh' }, "fast");
  346. $('.mask1').show();
  347. $('.dialog1').animate({ top: '-6.96rem' }, "fast");
  348. $('.tip').animate({ top: '-6.96rem' }, "fast");
  349. document.documentElement.style.overflow = 'hidden';
  350. } else if (res.status === 1) {
  351. $('.tip').animate({ top: '48vh' }, "fast");
  352. $('.mask1').show();
  353. $('.dialog1').animate({ top: '-6.96rem' }, "fast");
  354. $('.tip1').animate({ top: '-6.96rem' }, "fast");
  355. document.documentElement.style.overflow = 'hidden';
  356. } else if (res.status === 2) {
  357. $('.dialog1').animate({ top: '48vh' }, "fast");
  358. $('.mask1').show();
  359. $('.tip').animate({ top: '-6.96rem' }, "fast");
  360. $('.tip1').animate({ top: '-6.96rem' }, "fast");
  361. document.documentElement.style.overflow = 'hidden';
  362. }
  363. }
  364. }
  365. if (!id) {
  366. delete ajaxObj.headers
  367. }
  368. $.ajax(ajaxObj)
  369. }
  370. //防止提示一秒内重复显示
  371. function stopManyClick(fn) {
  372. if (flag) {
  373. fn();
  374. }
  375. flag = false;
  376. if (timer) { clearTimeout(timer); }
  377. timer = setTimeout(() => { flag = true }, 1500);
  378. }
  379. </script>
  380. </body>
  381. <style>
  382. #toast-container>.toast-error {
  383. background-image: none !important;
  384. }
  385. .toast-error {
  386. background-color: rgba(0, 0, 0, 0.8);
  387. }
  388. #toast-container>div {
  389. font-size: 14px;
  390. min-width: 80px !important;
  391. padding: 12px !important;
  392. box-shadow: none;
  393. }
  394. @media (max-width: 480px) and (min-width: 241px) {
  395. #toast-container>div {
  396. min-width: 80px !important;
  397. width: auto;
  398. }
  399. }
  400. @media only screen and (min-width: 640px) {
  401. .toast-center-center {
  402. top: 50%;
  403. left: 50%;
  404. transform: translate(-50%, -50%);
  405. }
  406. }
  407. @media only screen and (max-width: 640px) {
  408. .toast-center-center {
  409. top: 50%;
  410. left: 50%;
  411. transform: translate(-50%, -50%);
  412. }
  413. }
  414. input::-webkit-input-placeholder {
  415. color: #BBBBBB;
  416. }
  417. input::-moz-placeholder {
  418. /* Mozilla Firefox 19+ */
  419. color: #BBBBBB;
  420. }
  421. input:-moz-placeholder {
  422. /* Mozilla Firefox 4 to 18 */
  423. color: #BBBBBB;
  424. }
  425. input:-ms-input-placeholder {
  426. /* Internet Explorer 10-11 */
  427. color: #BBBBBB;
  428. }
  429. </style>
  430. </html>