promote.html 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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/promote.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/bootstrap/js/bootstrap.min.js"></script>
  21. <script src="../static/js/vender/crypto-js.js"></script>
  22. <script src="../static/js/vender/ase.js"></script>
  23. <script src="../static/js/vender/verify.js"></script>
  24. <script src="../static/js/vender/toastr/toastr.min.js"></script>
  25. <script src="../static/js/vender/config.js"></script>
  26. <script>
  27. toastr.options.positionClass = 'toast-center-center';
  28. </script>
  29. </head>
  30. <body>
  31. <div class="top free-code-con" style="position:relative;">
  32. <div>
  33. <img src="../static/img/experienceBg2.png" alt="" class="bottom-img">
  34. </div>
  35. <div class="center-pic">
  36. <div class="recv-cont" id="recv_cont">
  37. <div style="position: relative;">
  38. <input type="tel" class="recv-ipt" id="recv_ipt" placeholder="请输入手机号码">
  39. </div>
  40. <div>
  41. <div class="recv-btn" id="recv_btn">
  42. <span style="position: relative;">
  43. 领取体验时长并下载
  44. <img src="../static/img/xing_icon.png" alt="">
  45. </span>
  46. </div>
  47. </div>
  48. <div id="mpanel2"></div>
  49. </div>
  50. </div>
  51. </div>
  52. <script type="text/javascript" th:inline="javascript">
  53. toastr.options = {
  54. positionClass: "toast-center-center",
  55. timeOut: 1500
  56. };
  57. var parameters = GetRequest();
  58. var toast = toastr;
  59. var html = document.documentElement;
  60. var imgWidth = html.getBoundingClientRect().width / 750 * 400 + 'px';
  61. var imgHeight = html.getBoundingClientRect().width / 750 * 200 + 'px';
  62. var barHeight = html.getBoundingClientRect().width / 750 * 70 + 'px';
  63. $('#mpanel2').eq(0).text('');
  64. $('#mpanel2').slideVerify({
  65. baseUrl: baseUrl + '/api/user', //服务器请求地址, 默认地址为安吉服务器;
  66. mode: 'pop', //展示模式
  67. containerId: 'recv_btn', //pop模式 必填 被点击之后出现行为验证码的元素id
  68. imgSize: { //图片的大小对象,有默认值{ width: '310px',height: '155px'},可省略
  69. width: imgWidth,
  70. height: imgHeight
  71. },
  72. barSize: {//下方滑块的大小对象,有默认值{ width: '310px',height: '50px'},可省略
  73. width: imgWidth,
  74. height: barHeight
  75. },
  76. beforeCheck: function () {
  77. var tel = $("#recv_ipt").val()
  78. if (!/^1[3|4|5|6|7|8|9][0-9]\d{8}$/.test(tel)) {
  79. stopManyClick(() => {
  80. toastr.error('请填写正确的手机号')
  81. })
  82. return false
  83. } else {
  84. return true
  85. }
  86. },
  87. ready: function () { }, //加载完毕的回调
  88. success: function (params) { //成功的回调
  89. // params为返回的二次验证参数 需要在接下来的实现逻辑回传服务器
  90. // 例如: login($.extend({}, params))
  91. handleClick(params.captchaVerification)
  92. },
  93. error: function () {
  94. console.log('error');
  95. } //失败的回调
  96. });
  97. $("#recv_ipt").bind('input propertychange', function (e) {
  98. var ipt_phones = $('#recv_ipt').val();
  99. var c = $(this);
  100. if (/[^\d]/.test(c.val())) {//替换非数字字符
  101. var temp_amount = c.val().replace(/[^\d]/g, '');
  102. $(this).val(temp_amount);
  103. toastr.error('请填写正确的手机号')
  104. }
  105. if (ipt_phones.length >= 12) {
  106. toastr.error('请填写正确的手机号')
  107. var recvstr = ipt_phones.substring(0, 11)
  108. $("#recv_ipt").val(recvstr);
  109. }
  110. });
  111. function handleClick(captchaVerification) {
  112. var time = new Date().getTime()
  113. var data = {}
  114. toastr.options = {
  115. positionClass: "toast-center-center"
  116. };
  117. var ipt_phone = $('#recv_ipt').val();
  118. var validator = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/
  119. var res = validator.test(ipt_phone)
  120. if (!ipt_phone) {
  121. toastr.error('请填写正确的手机号')
  122. } else if (!res) {
  123. toastr.error('请填写正确的手机号')
  124. } else {
  125. data.newPhone = ipt_phone
  126. data.type =parameters['type']
  127. data.code = parameters['code']
  128. data.username = parameters['userName']
  129. data.captchaVerification = captchaVerification
  130. $.ajax({
  131. url: baseUrl + '/promote/commitPhone',
  132. data: JSON.stringify(data),
  133. type: 'post',
  134. contentType: "application/json",
  135. dataType: 'json',
  136. cache: false,
  137. success: function (res) {
  138. if (res.status === 0) {
  139. toastr.error('领取成功')
  140. $(window).attr('location', res.data);
  141. } else if (res.status === 1) {
  142. toastr.error(res.msg)
  143. setTimeout(function () {
  144. $(window).attr('location', 'http://www.androidscloud.com/');
  145. }, 1000)
  146. } else {
  147. toastr.error(res.msg)
  148. }
  149. }
  150. })
  151. var Sys = {};
  152. var ua = navigator.userAgent.toLowerCase();
  153. var s, browserType;
  154. (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
  155. (s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
  156. (s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
  157. (s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
  158. (s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
  159. if (Sys.ie) {
  160. browserType = 'IE: ' + Sys.ie
  161. }
  162. if (Sys.firefox) {
  163. browserType = 'Firefox: ' + Sys.firefox
  164. }
  165. if (Sys.chrome) {
  166. browserType = 'Chrome: ' + Sys.chrome
  167. }
  168. if (Sys.opera) {
  169. browserType = 'Opera: ' + Sys.opera
  170. }
  171. if (Sys.safari) {
  172. browserType = 'Safari: ' + Sys.safari
  173. }
  174. var form = {
  175. platform: 4,
  176. visitType: 4,
  177. time: time,
  178. phoneNum: ipt_phone,
  179. downLoaderCount: Number(localStorage.getItem('downLoaderCount')),
  180. browserType: browserType
  181. }
  182. var list = []
  183. list.push(form)
  184. // 推广页面下载埋点接口
  185. $.ajax({
  186. url: baseUrl + '/promote/burialSiteLog',
  187. data: JSON.stringify(list),
  188. type: 'post',
  189. contentType: "application/json",
  190. dataType: 'json',
  191. cache: false,
  192. success: function (res) {
  193. }
  194. })
  195. }
  196. }
  197. function visit() {
  198. $.ajax({
  199. url: baseUrl + '/promote/addInviteData',
  200. type: 'get',
  201. cache: false,
  202. dataType: 'text',
  203. success: function () {
  204. }
  205. })
  206. }
  207. var timer, flag = true;
  208. //防止提示一秒内重复显示
  209. function stopManyClick(fn) {
  210. if (flag) {
  211. fn();
  212. }
  213. flag = false;
  214. if (timer) { clearTimeout(timer); }
  215. timer = setTimeout(() => { flag = true }, 1500);
  216. }
  217. visit()
  218. </script>
  219. </body>
  220. <style>
  221. #toast-container>.toast-error {
  222. background-image: none !important;
  223. }
  224. .toast-error {
  225. background-color: rgba(0, 0, 0, 0.8);
  226. }
  227. #toast-container>div {
  228. font-size: 14px;
  229. min-width: 80px !important;
  230. padding: 12px !important;
  231. box-shadow: none;
  232. }
  233. @media (max-width: 480px) and (min-width: 241px) {
  234. #toast-container>div {
  235. min-width: 80px !important;
  236. width: auto;
  237. }
  238. }
  239. @media only screen and (min-width: 640px) {
  240. .toast-center-center {
  241. top: 50%;
  242. left: 50%;
  243. transform: translate(-50%, -50%);
  244. }
  245. }
  246. @media only screen and (max-width: 640px) {
  247. .toast-center-center {
  248. top: 50%;
  249. left: 50%;
  250. transform: translate(-50%, -50%);
  251. }
  252. }
  253. input::-webkit-input-placeholder {
  254. color: #BBBBBB;
  255. }
  256. input::-moz-placeholder {
  257. /* Mozilla Firefox 19+ */
  258. color: #BBBBBB;
  259. }
  260. input:-moz-placeholder {
  261. /* Mozilla Firefox 4 to 18 */
  262. color: #BBBBBB;
  263. }
  264. input:-ms-input-placeholder {
  265. /* Internet Explorer 10-11 */
  266. color: #BBBBBB;
  267. }
  268. </style>
  269. </html>