index.html 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
  9. <style>
  10. @font-face {
  11. font-family: 'iconfont';
  12. src: url('//at.alicdn.com/t/font_2527830_vzcw86nywl8.woff2?t=1620264294559') format('woff2'),
  13. url('//at.alicdn.com/t/font_2527830_vzcw86nywl8.woff?t=1620264294559') format('woff'),
  14. url('//at.alicdn.com/t/font_2527830_vzcw86nywl8.ttf?t=1620264294559') format('truetype');
  15. }
  16. .iconfont {
  17. font-family: "iconfont" !important;
  18. font-size: 16px;
  19. font-style: normal;
  20. -webkit-font-smoothing: antialiased;
  21. -webkit-text-stroke-width: 0.2px;
  22. -moz-osx-font-smoothing: grayscale;
  23. }
  24. html {
  25. background-color: black;
  26. padding: 0;
  27. margin: 0;
  28. }
  29. * {
  30. padding: 0;
  31. margin: 0;
  32. }
  33. body {
  34. margin: 0;
  35. padding: 0;
  36. background-color: black;
  37. color: #fff;
  38. /* width: 50px; */
  39. overflow: hidden;
  40. }
  41. .hearder {
  42. margin-bottom: 2vw;
  43. }
  44. .h-back {
  45. font-size: 4vw;
  46. height: 12vw;
  47. line-height: 12vw;
  48. padding-left: 4vw;
  49. }
  50. .h-logo {
  51. height: 37.2vw;
  52. text-align: center;
  53. }
  54. .logo {
  55. margin: 5.5vw auto 4.7vw;
  56. width: 19vw;
  57. height: 19vw;
  58. border-radius: 50%;
  59. overflow: hidden;
  60. }
  61. .h-logo img {
  62. width: 19vw;
  63. height: 19vw;
  64. border-radius: 50%;
  65. }
  66. .logo-title {
  67. margin: 0 auto;
  68. height: 8.4vw;
  69. line-height: 8.4vw;
  70. font-size: 5vw;
  71. /* font-weight: bold; */
  72. }
  73. .downLoad{
  74. text-align: right;
  75. margin-top: 1.2vw;
  76. margin-right: 9.4vw;
  77. }
  78. .form-item {
  79. width: 81.2vw;
  80. height: 14vw;
  81. line-height: 14vw;
  82. border-bottom: 1px #fff solid;
  83. margin-left: 9.4vw;
  84. margin-right: 9.4vw;
  85. position: relative;
  86. }
  87. .form-item i {
  88. font-size: 6.3vw;
  89. }
  90. .form-item input {
  91. /* width: 95vw; */
  92. background-color: #000;
  93. color: #fff;
  94. font-weight: 300;
  95. outline: none;
  96. border: none;
  97. font-size: 4.3vw;
  98. }
  99. .form-item span {
  100. position: absolute;
  101. right: 0;
  102. top: 0;
  103. bottom: 0;
  104. margin: auto;
  105. display: inline-block;
  106. height: 9.5vw;
  107. width: 17vw;
  108. background-color: #eeda9e;
  109. font-size: 4.3vw;
  110. color: black;
  111. text-align: center;
  112. line-height: 9.5vw;
  113. border-radius: 1vw 1vw 1vw 1vw;
  114. }
  115. .sub {
  116. width: 60vw;
  117. height: 10.7vw;
  118. text-align: center;
  119. line-height: 10.7vw;
  120. background-color: #eeda9e;
  121. color: black;
  122. font-size: 4vw;
  123. font-weight: bold;
  124. border-radius: 6vw 6vw;
  125. margin: 9vw auto 0;
  126. }
  127. .foot {
  128. height: 23vw;
  129. margin-left: 9.4vw;
  130. margin-top: 6vw;
  131. }
  132. .foot div {
  133. height: 7vw;
  134. font-size: 4.5vw;
  135. }
  136. #tip {
  137. display: none;
  138. position: absolute;
  139. top: 0;
  140. bottom: 0;
  141. right: 0;
  142. left: 0;
  143. margin: auto;
  144. width: 30vw;
  145. height: 20vw;
  146. background-color: rgba(0, 0, 0, 0.7);
  147. z-index: 998;
  148. }
  149. #tip-span {
  150. display: inline-block;
  151. text-align: center;
  152. }
  153. </style>
  154. </head>
  155. <body>
  156. <div class="hearder">
  157. <div class="h-back">
  158. <i class="iconfont">&#xe606;</i>
  159. </div>
  160. <div class="h-logo">
  161. <div class="logo"><img src="/static/img/logo.png" alt="logo"></div>
  162. <div class="logo-title">优交所</div>
  163. </div>
  164. </div>
  165. <div class="content">
  166. <div class="form-item">
  167. <i class="iconfont">&#xe603;</i>
  168. <input type="text" id="uphone" name="phone" placeholder="请输入手机号" onblur="checkData(0)"
  169. oninput="value=value.replace(/[^\d]/g,'')">
  170. </div>
  171. <div class="form-item">
  172. <i class="iconfont">&#xe60d;</i>
  173. <input type="password" id="upassword" name="password" placeholder="登陆密码《8-12位数字+字母》" onblur="checkData(1)"
  174. oninput="value=value.replace(/[\W]/g,'')" maxlength="12">
  175. </div>
  176. <div class="form-item">
  177. <i class="iconfont">&#xe60d;</i>
  178. <input type="password" id="upassword_t" name="password_t" placeholder="请确认登录密码" onblur="checkData(2)"
  179. oninput="value=value.replace(/[\W]/g,'')" maxlength="12">
  180. </div>
  181. <div class="form-item">
  182. <i class="iconfont">&#xe60d;</i>
  183. <input type="password" id="utrade_password" name="trade_password" placeholder="交易密码《6位纯数字》"
  184. onblur="checkData(3)" oninput="value=value.replace(/\D/g,'')" maxlength="6">
  185. </div>
  186. <div class="form-item">
  187. <i class="iconfont">&#xe60d;</i>
  188. <input type="password" id="utrade_password_t" name="trade_password_t" placeholder="请确认交易密码"
  189. onblur="checkData(4)" oninput="value=value.replace(/\D/g,'')" maxlength="6">
  190. </div>
  191. <div class="form-item">
  192. <i class="iconfont">&#xe60e;</i>
  193. <input type="text" id="invite_code" name="captcha" placeholder="请输入邀请码" disabled onblur="checkData(6)">
  194. </div>
  195. <div class="form-item">
  196. <i class="iconfont">&#xe60e;</i>
  197. <input type="text" id="ucaptcha" name="invite_code" placeholder="请输入验证码" disabled onblur="checkData(5)">
  198. <span onclick="getCaptcha()" id="captcha_btn">验证码</span>
  199. </div>
  200. <div class="downLoad" onclick="downLoad()">
  201. 立即下载
  202. </div>
  203. <div class="sub" onclick="register()">
  204. 注册
  205. </div>
  206. </div>
  207. <div id="tip"><span id="tip-span"></span></div>
  208. <script>
  209. var url = location.search;
  210. if (url.indexOf("?") != -1) {
  211. var str = url.substr(1);
  212. strs = str.split("=");
  213. var invitation = strs[1];
  214. document.getElementById('invite_code').value=invitation;
  215. }
  216. let $tip = $('#tip')
  217. let $tipStr = $('#tip-span')
  218. // 验证码
  219. let captchaValue = ''
  220. let baseUrl = 'http://www.aujs.vip/api/'
  221. //倒计时
  222. let countDown = 0
  223. //表单校验
  224. let isPass = [false, false, false, false, false, false]
  225. function checkData(num) {
  226. isPass = [false, false, false, false, false, false]
  227. if (num === 0) {
  228. let value = $("#uphone").val()
  229. let rexp = /^1[3456789]\d{9}/
  230. let isOk = rexp.test(value)
  231. if (!isOk) {
  232. tip(true, '请输入正确的手机号码')
  233. return
  234. }
  235. isPass[0] = true
  236. } else if (num === 1) {
  237. let value = $('#upassword').val()
  238. let rexp = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,12}$/
  239. let isOk = rexp.test(value)
  240. if (!isOk) {
  241. tip(true, '请输入8-12位由数字和字母构成的密码')
  242. return
  243. }
  244. isPass[1] = true
  245. } else if (num === 2) {
  246. let value = $('#upassword').val()
  247. let value_t = $('#upassword_t').val()
  248. if (value != value_t) {
  249. tip(true, '前后密码不一致')
  250. return
  251. }
  252. isPass[2] = true
  253. } else if (num === 3) {
  254. let value = $('#utrade_password').val()
  255. console.log(value)
  256. let rexp = /^\d{6}$/
  257. let isOk = rexp.test(value)
  258. if (!isOk) {
  259. tip(true, '请输入由6位数字构成的交易密码')
  260. return
  261. }
  262. isPass[3] = true
  263. } else if (num === 4) {
  264. let value = $('#utrade_password').val()
  265. let value_t = $('#utrade_password_t').val()
  266. if (value != value_t) {
  267. tip(true, '前后交易密码不一致')
  268. return
  269. }
  270. isPass[4] = true
  271. } else {
  272. isPass[5] = true
  273. }
  274. }
  275. //控制tip显示
  276. function tip(isShow, str) {
  277. if (isShow === true) {
  278. $tip.css('display', 'inline')
  279. console.log(12222)
  280. $tipStr.text(str)
  281. setTimeout(function () {
  282. $tip.css('display', 'none')
  283. }, 1000)
  284. }
  285. }
  286. //获取验证码
  287. function getCaptcha() {
  288. //判断是否在倒计时
  289. if (countDown === 0) {
  290. //判断手机号码是否填充完整
  291. checkData(0)
  292. if (isPass[0]) {
  293. countDown = 60
  294. console.log('dianji')
  295. let phone = $('#uphone').val()
  296. let $ucaptcha = $('#ucaptcha')
  297. let $captcha_btn = $('#captcha_btn')
  298. $ucaptcha.attr("disabled", false)
  299. let timer = setInterval(() => {
  300. countDown--
  301. $captcha_btn.text(countDown)
  302. if (countDown < 1) {
  303. clearInterval(timer)
  304. $captcha_btn.text('验证码')
  305. }
  306. }, 1000);
  307. // 发起请求获取验证码
  308. $.ajax({
  309. url: baseUrl + 'register/verify ',
  310. type: 'POST',
  311. data: {
  312. phone: phone,
  313. type: 'register'
  314. },
  315. success: function (res) {
  316. console.log(res.msg)
  317. tip(true, res.msg)
  318. }
  319. })
  320. }
  321. }
  322. }
  323. // 立即下载
  324. function downLoad() {
  325. window.open("{:url('down')}")
  326. }
  327. //注册
  328. function register() {
  329. for (let i = 0; i < 6; i++) {
  330. checkData(i)
  331. if (!isPass[i]) {
  332. return
  333. }
  334. }
  335. // 获取 表单数据
  336. let phone = $('#uphone').val()
  337. let captcha = $('#ucaptcha').val()
  338. let password = $('#upassword').val()
  339. let trade_password = $('#utrade_password').val()
  340. let check_psw = $('#upassword_t').val()
  341. let check_trade_psw = $('#utrade_password_t').val()
  342. let invite_code = $('#invite_code').val()
  343. let info = {
  344. phone,
  345. captcha,
  346. password,
  347. trade_password,
  348. check_psw,
  349. check_trade_psw,
  350. invite_code
  351. }
  352. console.log(info, 777)
  353. //提交表单
  354. $.ajax({
  355. url: baseUrl + 'register',
  356. type: 'POST',
  357. data: info,
  358. success: function (res) {
  359. console.log(res)
  360. tip(true, res.msg)
  361. // tip(true, "{:url('down')}")
  362. // window.open("{:url('down')}")
  363. if (res.status == 200){
  364. setTimeout(() => {
  365. window.open("{:url('down')}")
  366. }, 1000);
  367. }
  368. },
  369. error: function (err) {
  370. console.log(err)
  371. }
  372. })
  373. }
  374. </script>
  375. </body>
  376. </html>