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