register.jsp 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  3. <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
  4. <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
  5. <%
  6. String path = request.getContextPath();
  7. String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort() + path+"/";
  8. request.setAttribute("contextPath", basePath);
  9. String redirectUrl= request.getParameter("redirectUrl");
  10. request.setAttribute("redirectUrl", redirectUrl);
  11. String invitecode=request.getParameter("code");
  12. %>
  13. <!DOCTYPE html>
  14. <html lang="en">
  15. <head>
  16. <base href="<%=basePath%>">
  17. <meta charset="UTF-8">
  18. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  19. <meta name="apple-mobile-web-app-capable" content="yes">
  20. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  21. <meta name="format-detection" content="telephone=no">
  22. <title>注册</title>
  23. <c:set var="path" value="${pageContext.request.contextPath}" />
  24. <script src="${contextPath }app/lib/flexible.js"></script>
  25. <script type="text/javascript" src="${contextPath }res/js/jquery.min.js"></script>
  26. <script type="text/javascript" src="${contextPath }res/js/layer/layer.min.js"></script>
  27. <link rel="stylesheet" href="${contextPath }app/lib/flexible.css">
  28. <link rel="stylesheet" href="${contextPath }app/css/basem.css">
  29. <link rel="stylesheet" href="${contextPath }app/css/logome.css">
  30. <style type="text/css">
  31. .dxprotocol {
  32. font-size: 0.3rem;
  33. }
  34. .dxprotocol a {
  35. display: inline;
  36. }
  37. </style>
  38. <script type="text/javascript">
  39. var timeid, remainTime;
  40. function calcTime() {
  41. remainTime--;
  42. if (remainTime > 0) {
  43. $('#loginForm p[data-action="getcode"]').text("(" + remainTime + "秒)");
  44. } else {
  45. window.clearInterval(timeid);
  46. $('#loginForm p[data-action="getcode"]').text("获取验证码");
  47. $('#loginForm p[data-action="getcode"]').removeAttr("disabled");
  48. }
  49. }
  50. $(function(){
  51. var $loginForm = $('#loginForm');
  52. $('#loginForm p[data-action="getcode"]').click(function() {
  53. var phone=$loginForm.find("input[name='phone']").val();
  54. if(phone=='' || phone=='请输入11位手机号码')
  55. {
  56. layer.msg("请输入正确的手机号!");
  57. return false;
  58. }
  59. if(!checkMobile(phone)){
  60. return;
  61. }
  62. if($('#loginForm p[data-action="getcode"]').attr("disabled")){
  63. return;
  64. }
  65. $('#loginForm p[data-action="getcode"]').attr("disabled","true");
  66. //$('input[name="phone"]').val()
  67. var parm='{"phone":"'+phone+'" ,"type":"1"}'
  68. $.post('${contextPath}rest/mgmUser/getCode.cs',{
  69. "data":parm
  70. }, function(data) {
  71. if (data.ret == 1) {
  72. remainTime = 60;
  73. timeid = window.setInterval("calcTime()", 1000);
  74. } else {
  75. layer.msg(data.msg);
  76. $('#loginForm p[data-action="getcode"]').removeAttr("disabled");
  77. }
  78. }, "json");
  79. });
  80. $('#button').click(function(){
  81. var phone=$("input[name='phone']").val();
  82. var code=$("input[name='code']").val();
  83. var password=$("input[name='password']").val();
  84. var password2=$("input[name='password2']").val();
  85. var invitecode=$("input[name='invitecode']").val();
  86. if(phone=='' || phone=="null" ){
  87. layer.msg("请输入手机号!");
  88. return ;
  89. }
  90. if(code=="" || code=="null"){
  91. layer.msg("请输入验证码!");
  92. return ;
  93. }
  94. if(password=="null" || password==""){
  95. layer.msg("请输入新密码!");
  96. return ;
  97. }
  98. if(password2==""){
  99. layer.msg("请再次输入新密码!");
  100. return ;
  101. }else{
  102. if(password!=password2){
  103. layer.msg("两次输入密码不一致!");
  104. return ;
  105. }
  106. }
  107. var parm;
  108. if(invitecode=="null" || invitecode==""){
  109. parm='{"phone":"'+phone+'" ,"code":"'+code+'","pwd":"'+password+'"}'
  110. }else{
  111. parm='{"phone":"'+phone+'" ,"code":"'+code+'","pwd":"'+password+'","invitecode":"'+invitecode+'"}'
  112. }
  113. //注册
  114. $.post('${contextPath}web/mgmUserCtl/register.cs', {
  115. "data" : parm
  116. }, function(data) {
  117. var datas=eval(data.data);
  118. if (data.ret == 1) {
  119. window.location.href = '${contextPath }web/mgmUserCtl/info_personal.cs?userId='+datas.id+'&phone='+datas.phone;
  120. } else {
  121. layer.msg(data.msg);
  122. }
  123. }, "json");
  124. });
  125. function checkMobile(sMobile){
  126. //手机号正则
  127. var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/;
  128. //电话
  129. var phone = $.trim(sMobile);
  130. if (!phoneReg.test(phone)) {
  131. layer.msg('请输入有效的手机号码!');
  132. return false;
  133. }
  134. return true;
  135. }
  136. });
  137. </script>
  138. </head>
  139. <body>
  140. <div class="logbox">
  141. <div class="safe">
  142. <div class="logobg">
  143. <img class="logo" src="${contextPath }app/img/logo@2x.png" alt="">
  144. <form action="#" name="loginForm" id="loginForm" method="post">
  145. <input type="text" name="invitecode" style="visibility: hidden;" value="<%=invitecode%>">
  146. <ul class="logul">
  147. <li>
  148. <div><img class="logicon" src="${contextPath }app/img/iphone@2x.png" alt=""><span>手机</span></div>
  149. <input type="text" name="phone" placeholder="请输入手机号">
  150. </li>
  151. <li>
  152. <div><img class="logicon" src="${contextPath }app/img/yanz@2x.png" alt=""><span>验证码</span></div>
  153. <div class="logclean">
  154. <input class="left" name="code" type="text" placeholder="请输入验证码">
  155. <p data-action="getcode" class="right">获取验证码</p>
  156. </div>
  157. </li>
  158. <li>
  159. <div><img class="logicon" src="${contextPath }app/img/pw@2x.png" alt=""><span>密码</span></div>
  160. <input type="password" name="password" placeholder="请输入密码">
  161. </li>
  162. <li>
  163. <div><img class="logicon" src="${contextPath }app/img/pw@2x.png" alt=""><span>确认密码</span></div>
  164. <input type="password" name="password2" placeholder="请再次输入密码">
  165. </li>
  166. </ul>
  167. <p class="dxprotocol">注册绑定即表示您已阅读,并同意<a href="${contextPath }agreement.html" class="blutxt">《东旭通用户协议》</a></p>
  168. <a class="redbtn" href="javascript:void(0);" id="button">注册</a>
  169. <a class="logreturn" href="${contextPath }app/login/login.jsp"><img class="logicon" src="${contextPath }app/img/fh@2x.png" alt=""><span>返回登录</span></a>
  170. </form>
  171. </div>
  172. </div>
  173. </div>
  174. </body>
  175. </html>