index.html 6.2 KB

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