index.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <!DOCTYPE html>
  2. <html lang="en">
  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=no"/>
  6. <meta name="misapplication-tap-highlight" content="no"/>
  7. <meta name="HandheldFriendly" content="true"/>
  8. <meta name="MobileOptimized" content="320"/>
  9. <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
  10. <script typet="text/javascript" src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
  11. </head>
  12. <body>
  13. <div class="container">
  14. <div class="loginTitle">欢迎注册喜嗨购</div>
  15. <div class="loginText">请认真填写个人信息</div>
  16. <div class="login-box">
  17. <div class="username">账号</div>
  18. <input class="input-box" type="email" id="phone" name="phone" placeholder="请输入手机号"/>
  19. </div>
  20. <div class="login-box">
  21. <div class="username">验证码</div>
  22. <div class="flex">
  23. <input class="input-box" style="width: 50%" id="code" type="number" name="code" placeholder="请输入验证码">
  24. <div class="code" id="daojishi" onclick="verification()">发送验证码</div>
  25. </div>
  26. </div>
  27. <div class="login-box">
  28. <div class="username">登录密码</div>
  29. <input class="input-box" id="loginPass" type="password" name="loginPass" placeholder="请输入登录密码">
  30. </div>
  31. <div class="login-box">
  32. <div class="username">邀请码</div>
  33. <input class="input-box" id="invitation" type="text" disabled="disabled" name="invitation" placeholder="请输入邀请码">
  34. </div>
  35. <div class="flex">
  36. <div class="login" onclick="fnLogin()">注册</div>
  37. <div class="login"><a href="{:url('down')}">下载APP</a></div>
  38. </div>
  39. </div>
  40. </body>
  41. <script type="text/javascript">
  42. var url = location.search;
  43. if (url.indexOf("?") != -1) {
  44. var str = url.substr(1);
  45. strs = str.split("=");
  46. var invitation = strs[1];
  47. document.getElementById('invitation').value = invitation;
  48. }
  49. function fnLogin() {
  50. var phone = document.getElementById("phone").value;
  51. var loginPass = document.getElementById("loginPass").value;
  52. var code = document.getElementById("code").value;
  53. var invitation = document.getElementById("invitation").value;
  54. if (phone == '') {
  55. window.alert("请输入账号");
  56. return false;
  57. }
  58. if (code == '') {
  59. window.alert("请输入验证码");
  60. return false;
  61. }
  62. if (loginPass == '') {
  63. window.alert("请输入登录密码");
  64. return false;
  65. }
  66. if (invitation == '') {
  67. window.alert("请输入邀请码");
  68. return false;
  69. }
  70. $.ajax({
  71. type: "post",
  72. url: "http://yg.hqgjsmc.com/api/register",
  73. data: {account: phone, captcha: code, password: loginPass, spread: invitation},
  74. dataType: "json",
  75. success: function (data) {
  76. window.alert(data.msg);
  77. if (data.msg === '注册成功')
  78. window.location.href = "{:url('down')}"
  79. }
  80. });
  81. }
  82. function verification() {
  83. var phone = document.getElementById("phone").value;
  84. if (phone == '') {
  85. window.alert("请输入手机号");
  86. return false;
  87. }
  88. if (!/^1[3|4|5|6|7|8|9]\d{9}$/.test(phone)) {
  89. window.alert('请输入正确的手机号');
  90. return;
  91. }
  92. var timer = null;
  93. var count = 60;
  94. var codeText = $('#daojishi').text();
  95. if (codeText == '发送验证码') {
  96. timer = setInterval(function () {
  97. count--;
  98. $('#daojishi').text(count);
  99. if (count <= 0) {
  100. clearInterval(timer);
  101. $('#daojishi').text('发送验证码');
  102. }
  103. }, 1000);
  104. }
  105. if (codeText != '发送验证码') {
  106. return
  107. }
  108. $.ajax({
  109. type: "post",
  110. url: "http://yg.hqgjsmc.com/api/register/verify",
  111. data: {phone: phone, type: 'register'},
  112. dataType: "json",
  113. success: function (data) {
  114. window.alert(data.msg);
  115. }
  116. });
  117. }
  118. </script>
  119. <style type="text/css">
  120. * {
  121. margin: 0;
  122. padding: 0;
  123. font-family: 微软雅黑;
  124. font-size: 12px;
  125. min-height: 100%;
  126. }
  127. .container {
  128. padding: 10% 30px 0px 30px;
  129. }
  130. .loginTitle {
  131. font-weight: bold;
  132. color: #32baff;
  133. font-size: 29px;
  134. padding-bottom: 25px;
  135. }
  136. .loginText {
  137. font-weight: 500;
  138. color: #333333;
  139. font-size: 17px;
  140. margin-bottom: 15px;
  141. }
  142. .login-box {
  143. width: 100%;
  144. font-size: 16px;
  145. padding-top: 15px;
  146. }
  147. .username {
  148. display: block;
  149. padding-bottom: 12px;
  150. font-weight: 500;
  151. color: #333333;
  152. font-size: 16px;
  153. }
  154. .input-box {
  155. border: none;
  156. padding: 10px 8px;
  157. outline: none;
  158. width: 100%;
  159. background-color: #F5F5F5;
  160. border-radius: 9px;
  161. color: #32baff;
  162. }
  163. .input-box::placeholder {
  164. color: #bbbbbb;
  165. }
  166. .code {
  167. background-color: #32baff;
  168. border-radius: 5px;
  169. font-weight: 500;
  170. color: #FFFFFF;
  171. font-size: 13px;
  172. padding: 6px 8px;
  173. }
  174. .login {
  175. background-color: #32baff;
  176. color: #FFFFFF;
  177. text-align: center;
  178. width: 130px;
  179. line-height: 40px;
  180. border-radius: 25px;
  181. margin-top: 30px;
  182. }
  183. .login > a {
  184. color: #FFFFFF;
  185. text-decoration: none;
  186. }
  187. .flex {
  188. display: flex;
  189. align-items: center;
  190. justify-content: space-between;
  191. }
  192. </style>
  193. </html>