invite.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>双子星</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  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/normalize.css">
  10. <link rel="stylesheet" href="../static/css/experience.css">
  11. <link rel="stylesheet" href="../static/js/vender/toastr/toastr.min.css">
  12. <link rel="stylesheet" href="../static/css/verify.css">
  13. <script src="../static/js/vender/jquery-3.4.1.min.js"></script>
  14. <script src="../static/js/vender/bootstrap/js/bootstrap.min.js"></script>
  15. <script src="../static/js/vender/toastr/toastr.min.js"></script>
  16. <script src="../static/js/vender/config.js"></script>
  17. <script src="../static/js/vender/crypto-js.js"></script>
  18. <script src="../static/js/vender/base64.js"></script>
  19. <script src="../static/js/vender/verify.js"></script>
  20. <script src="../static/js/vender/ase.js"></script>
  21. <script>
  22. toastr.options.positionClass = 'toast-center-center';
  23. </script>
  24. </head>
  25. <body>
  26. <div id="mpanel2"></div>
  27. <div id="form-btn"></div>
  28. <div class="top free-code-con" style="position:relative;">
  29. <div>
  30. <img src="../static/img/register/bg.png" alt="" class="bottom-img">
  31. <div class="user-info">
  32. <div class="head"><img src="" alt="" /></div>
  33. <div class="username"></div>
  34. <div class="txt">
  35. <div style="width: 2.97rem;"><img src="../static/img/register/tuoguan_icon.png" class="icon" alt="">7*24h智能托管</div>
  36. <div style="width: 1.76rem;"><img src="../static/img/register/haodian_icon.png" class="icon" alt="">0耗电</div>
  37. <div><img src="../static/img/register/liuliang_icon.png" class="icon" alt="">0流量</div>
  38. <div style="width: 2.97rem;"><img src="../static/img/register/wang_icon.png" class="icon" alt="">应用 24h 不断网</div>
  39. <div><img src="../static/img/register/shou_icon.png" class="icon" alt="">解放双手</div>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="center-pic">
  44. <div class="recv-cont" id="recv_cont">
  45. <div style="position: relative;">
  46. <input type="tel" class="recv-ipt" id="recv_ipt" placeholder="请输入手机号码">
  47. <div class="tip">该手机号仅用于验证并绑定账号</div>
  48. </div>
  49. <div onclick="handleClick()" style="position: relative">
  50. <div class="recv-btn" id="recv_btn">立即加入</div>
  51. </div>
  52. <div class="bottom">
  53. <div class="mb8">双子星</div>
  54. <div class="wl">云智能 · 享未来</div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. <script type="text/javascript" th:inline="javascript">
  60. var parameters = GetRequest();
  61. var phone = parameters["phone"];
  62. var timer, flag = true;
  63. var html = document.documentElement;
  64. var imgWidth = html.getBoundingClientRect().width / 750 * 400 + 'px';
  65. var imgHeight = html.getBoundingClientRect().width / 750 * 200 + 'px';
  66. var barHeight = html.getBoundingClientRect().width / 750 * 70 + 'px';
  67. // var baseUrl = 'http://14.18.190.141:24380'
  68. $("#recv_ipt").val(phone ? phone : '');
  69. $("#recv_ipt").bind('input propertychange', function (e) {
  70. var ipt_phones = $('#recv_ipt').val();
  71. var c = $(this);
  72. if (/[^\d]/.test(c.val())) {//替换非数字字符
  73. var temp_amount = c.val().replace(/[^\d]/g, '');
  74. $(this).val(temp_amount);
  75. stopManyClick(() =>{
  76. toastr.error('请填写正确的手机号')
  77. })
  78. }
  79. if (ipt_phones.length >= 12) {
  80. var recvstr = ipt_phones.substring(0, 11)
  81. $("#recv_ipt").val(recvstr);
  82. stopManyClick(() =>{
  83. toastr.error('请填写正确的手机号')
  84. })
  85. }
  86. });
  87. function validate() {
  88. $('#mpanel2').slideVerify({
  89. baseUrl: baseUrl + '/api/activity', //服务器请求地址, 默认地址为安吉服务器;
  90. mode: 'pop', //展示模式
  91. containerId: 'form-btn', //pop模式 必填 被点击之后出现行为验证码的元素id
  92. imgSize: { //图片的大小对象,有默认值{ width: '310px',height: '155px'},可省略
  93. width: imgWidth,
  94. height: imgHeight
  95. },
  96. barSize: {//下方滑块的大小对象,有默认值{ width: '310px',height: '50px'},可省略
  97. width: imgWidth,
  98. height: barHeight
  99. },
  100. beforeCheck: () => {
  101. return true
  102. },
  103. ready: () => {
  104. }, //加载完毕的回调
  105. success: (params) => { //成功的回调
  106. setTimeout(() => {
  107. submit(params.captchaVerification);
  108. },1000)
  109. },
  110. error: function () {}
  111. });
  112. }
  113. function submit(captchaVerification){
  114. var data = {}
  115. data.userName = parameters['username'] ? parameters['username'] : null
  116. data.type = parameters['type'] ? parameters['type'] : null
  117. data.extensionType = parameters['extensionType'] ? parameters['extensionType'] : '2'
  118. data.newPhone = $('#recv_ipt').val();
  119. data.captchaVerification = captchaVerification;
  120. $.ajax({
  121. url: baseUrl + '/api/activity/v1/promote',
  122. data: JSON.stringify(data),
  123. type: 'post',
  124. contentType: "application/json",
  125. dataType: 'json',
  126. cache: false,
  127. success: function (res) {
  128. if (res.status === 0) {
  129. toastr.error('领取成功')
  130. $(window).attr('location', res.data);
  131. } else if (res.status === 1) {
  132. toastr.error(res.msg)
  133. setTimeout(function() {
  134. $(window).attr('location', 'http://www.androidscloud.com/');
  135. }, 1000)
  136. } else if(res.status === 11){
  137. $('#mpanel2').eq(0).text('');
  138. validate(); // 生成验证码
  139. setTimeout(() => {
  140. document.getElementById('form-btn').click();
  141. },500)
  142. } else {
  143. toastr.error(res.msg)
  144. }
  145. }
  146. })
  147. }
  148. function getUserInfo() {
  149. var userName = parameters['username'] ? parameters['username'] : null
  150. userName = Base64.decode(userName)
  151. $.ajax({
  152. url: baseUrl + '/api/activity/v3/invitation/getNickname?username=' + userName,
  153. type: 'get',
  154. cache: false,
  155. dataType: 'text',
  156. success: function (res) {
  157. var result = JSON.parse(res)
  158. if (result.status === 0) {
  159. $(".username").text(result.data.nickName)
  160. getHead(result.data.fileId)
  161. }
  162. }
  163. })
  164. }
  165. function getHead(fileId) {
  166. $('.head img').attr('src', '../static/img/invite/header-img.png');
  167. var timestamp = new Date().getTime()
  168. var encrypts = encrypt(
  169. 'RuiChiSecurityGo' + timestamp,
  170. 'RuiChiSecurityGo'
  171. )
  172. var data = {
  173. keyType: 2,
  174. security: encrypts
  175. }
  176. let urls = baseUrl == 'http://14.18.190.141:24380'?'http://110.53.221.195:8210':'https://wjzx.androidscloud.com:9091';
  177. $.ajax({
  178. url: `${urls}/document/newFile/download/0/3dn9b4585511476691c6?fileKey=`+fileId,
  179. type: 'get',
  180. headers: data,
  181. xhrFields: { responseType: "blob" },
  182. cache: false,
  183. success: function (res) {
  184. var xhr = new XMLHttpRequest();
  185. var imageType = xhr.getResponseHeader("Content-Type");
  186. var blob = new Blob([res], { type: imageType });
  187. var imageUrl = (window.URL || window.webkitURL).createObjectURL(blob);
  188. $('.head img').attr('src', imageUrl);
  189. }
  190. })
  191. }
  192. function encrypt(word, keyStr) {
  193. keyStr = keyStr || 'RuiChiSecurityGo' // 判断是否存在ksy,不存在就用定义好的key
  194. var key = CryptoJS.enc.Utf8.parse(keyStr)
  195. var srcs = CryptoJS.enc.Utf8.parse(word)
  196. var encrypted = CryptoJS.AES.encrypt(srcs, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 })
  197. return encrypted.toString()
  198. }
  199. getUserInfo();
  200. function handleClick() {
  201. stopManyClick(result);
  202. }
  203. function result() {
  204. var time = new Date().getTime()
  205. var data = {}
  206. data.userName = parameters['username'] ? parameters['username'] : null
  207. data.type = parameters['type'] ? parameters['type'] : null
  208. data.extensionType = parameters['extensionType'] ? parameters['extensionType'] : '2'
  209. toastr.options = {
  210. positionClass: "toast-center-center",
  211. timeOut: 1500
  212. };
  213. var ipt_phone = $('#recv_ipt').val();
  214. var validator = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/
  215. var res = validator.test(ipt_phone)
  216. var downLoaderCount = Number(localStorage.getItem('downLoaderCount'))
  217. downLoaderCount ? localStorage.setItem('downLoaderCount', downLoaderCount + 1) : localStorage.setItem('downLoaderCount', 1)
  218. if (!ipt_phone) {
  219. stopManyClick(() =>{
  220. toastr.error('请填写正确的手机号')
  221. })
  222. } else if (!res) {
  223. stopManyClick(() =>{
  224. toastr.error('请填写正确的手机号')
  225. })
  226. } else {
  227. data.newPhone = ipt_phone
  228. $.ajax({
  229. url: baseUrl + '/api/activity/v1/promote',
  230. data: JSON.stringify(data),
  231. type: 'post',
  232. contentType: "application/json",
  233. dataType: 'json',
  234. cache: false,
  235. success: function (res) {
  236. if (res.status === 0) {
  237. toastr.error('领取成功')
  238. $(window).attr('location', res.data);
  239. } else if (res.status === 1) {
  240. toastr.error(res.msg)
  241. setTimeout(function() {
  242. $(window).attr('location', 'http://www.androidscloud.com/');
  243. }, 1000)
  244. } else if(res.status === '0011'){
  245. $('#mpanel2').eq(0).text('');
  246. validate(); // 生成验证码
  247. setTimeout(() => {
  248. document.getElementById('form-btn').click();
  249. },500)
  250. } else {
  251. toastr.error(res.msg)
  252. }
  253. }
  254. })
  255. }
  256. }
  257. function visit() {
  258. $.ajax({
  259. url: baseUrl + '/api/user/v3/invitation/client/addInviteData',
  260. type: 'get',
  261. cache: false,
  262. dataType: 'text',
  263. success: function () {
  264. }
  265. })
  266. }
  267. // visit()
  268. //防止提示一秒内重复显示
  269. function stopManyClick(fn) {
  270. if (flag) {
  271. fn();
  272. }
  273. flag = false;
  274. if(timer){clearTimeout(timer);}
  275. timer = setTimeout(() => {flag = true}, 1500);
  276. }
  277. </script>
  278. </body>
  279. <style>
  280. #toast-container>.toast-error {
  281. background-image: none !important;
  282. }
  283. .toast-error {
  284. background-color: rgba(0, 0, 0, 0.8);
  285. }
  286. #toast-container>div {
  287. font-size: 14px;
  288. min-width: 80px !important;
  289. padding: 12px !important;
  290. box-shadow: none;
  291. }
  292. .toast-center-center {
  293. position: fixed;
  294. min-width: 220px;
  295. top: 50%;
  296. left: 50%;
  297. text-align: center;
  298. transform: translateX(-50%);
  299. color: #FFFFFF;
  300. border-radius: 0.2rem;
  301. }
  302. @media (max-width: 480px) and (min-width: 241px) {
  303. #toast-container>div {
  304. min-width: 80px !important;
  305. width: auto;
  306. }
  307. }
  308. @media only screen and (min-width: 640px) {
  309. .toast-center-center {
  310. top: 50%;
  311. left: 50%;
  312. transform: translate(-50%, -50%);
  313. }
  314. }
  315. @media only screen and (max-width: 640px) {
  316. .toast-center-center {
  317. top: 50%;
  318. left: 50%;
  319. transform: translate(-50%, -50%);
  320. }
  321. }
  322. input::-webkit-input-placeholder {
  323. color: #BBBBBB;
  324. }
  325. input::-moz-placeholder {
  326. /* Mozilla Firefox 19+ */
  327. color: #BBBBBB;
  328. }
  329. input:-moz-placeholder {
  330. /* Mozilla Firefox 4 to 18 */
  331. color: #BBBBBB;
  332. }
  333. input:-ms-input-placeholder {
  334. /* Internet Explorer 10-11 */
  335. color: #BBBBBB;
  336. }
  337. </style>
  338. </html>