forget.jsp 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. %>
  12. <!DOCTYPE html>
  13. <html lang="en">
  14. <head>
  15. <base href="<%=basePath%>">
  16. <meta charset="UTF-8">
  17. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  18. <meta name="apple-mobile-web-app-capable" content="yes">
  19. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  20. <meta name="format-detection" content="telephone=no">
  21. <title>忘记密码</title>
  22. <c:set var="path" value="${pageContext.request.contextPath}" />
  23. <script src="${contextPath }app/lib/flexible.js"></script>
  24. <script type="text/javascript" src="${contextPath }res/js/jquery.min.js"></script>
  25. <script type="text/javascript" src="${contextPath }res/js/layer/layer.min.js"></script>
  26. <link rel="stylesheet" href="${contextPath }app/lib/flexible.css">
  27. <link rel="stylesheet" href="${contextPath }app/css/basem.css">
  28. <link rel="stylesheet" href="${contextPath }app/css/logome.css">
  29. <script type="text/javascript">
  30. var timeid, remainTime;
  31. function calcTime() {
  32. remainTime--;
  33. if (remainTime > 0) {
  34. $('#loginForm p[data-action="getcode"]').text("(" + remainTime + "秒)");
  35. } else {
  36. window.clearInterval(timeid);
  37. $('#loginForm p[data-action="getcode"]').text("获取验证码");
  38. $('#loginForm p[data-action="getcode"]').removeAttr("disabled");
  39. }
  40. }
  41. $(function(){
  42. var $loginForm = $('#loginForm');
  43. $('#loginForm p[data-action="getcode"]').click(function() {
  44. var phone=$loginForm.find("input[name='phone']").val();
  45. if(phone=='' || phone=='请输入11位手机号码')
  46. {
  47. layer.msg("请输入正确的手机号!");
  48. return false;
  49. }
  50. if(!checkMobile(phone)){
  51. return;
  52. }
  53. if($('#loginForm p[data-action="getcode"]').attr("disabled")){
  54. return;
  55. }
  56. $('#loginForm p[data-action="getcode"]').attr("disabled","true");
  57. var parm='{"phone":"'+phone+'" ,"type":"2"}'
  58. $.post('${contextPath}rest/mgmUser/getCode.cs',{
  59. "data":parm
  60. }, function(data) {1
  61. if (data.ret == 1) {
  62. remainTime = 60;
  63. timeid = window.setInterval("calcTime()", 1000);
  64. } else {
  65. layer.msg(data.msg);
  66. $('#loginForm p[data-action="getcode"]').removeAttr("disabled");
  67. }
  68. }, "json");
  69. });
  70. $('#button').click(function(){
  71. var phone=$("input[name='phone']").val();
  72. var code=$("input[name='code']").val();
  73. var password=$("input[name='password']").val();
  74. var password2=$("input[name='password2']").val();
  75. if(phone==''){
  76. layer.msg("请输入手机号!");
  77. return ;
  78. }
  79. if(code=="" || code==null){
  80. layer.msg("请输入验证码!");
  81. return ;
  82. }
  83. if(password=="" || password2==""){
  84. layer.msg("请输入新密码!");
  85. return ;
  86. }
  87. if(password!=password2){
  88. layer.msg("两次密码不一致!");
  89. return ;
  90. }
  91. var parm='{"phone":"'+phone+'" ,"code":"'+code+'","pwd":"'+password+'","oldPwd":"'+password2+'"}'
  92. //忘记密码
  93. $.post('${contextPath}web/mgmUserCtl/forgetPWD.cs', {
  94. "data" : parm
  95. }, function(data) {
  96. var datas=eval(data.data);
  97. if (data.ret == 1) {
  98. layer.msg(data.msg+',跳转到登录!', {
  99. time: 1000
  100. }, function(){
  101. window.location.href = '${contextPath }app/login/login.jsp';
  102. });
  103. } else {
  104. layer.msg(data.msg);
  105. }
  106. }, "json");
  107. });
  108. function checkMobile(sMobile){
  109. //手机号正则
  110. var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/;
  111. //电话
  112. var phone = $.trim(sMobile);
  113. if (!phoneReg.test(phone)) {
  114. alert('请输入有效的手机号码!');
  115. return false;
  116. }
  117. return true;
  118. }
  119. });
  120. </script>
  121. </head>
  122. <body>
  123. <div class="titbox">
  124. <a class="titreturn left" href="${contextPath }app/login/login.jsp"><img src="${contextPath }app/img/return1@2x.png" alt=""></a>
  125. <h1>忘记密码</h1>
  126. </div>
  127. <div class="forgetbox top50">
  128. <div class="safe">
  129. <form action="#" name="loginForm" id="loginForm" method="post">
  130. <ul class="logul">
  131. <li>
  132. <div><img class="logicon" src="${contextPath }app/img/iphone@2x.png" alt=""><span>手机</span></div>
  133. <input type="text" name="phone" placeholder="请输入您的手机号">
  134. </li>
  135. <li>
  136. <div><img class="logicon" src="${contextPath }app/img/yanz@2x.png" alt=""><span>验证码</span></div>
  137. <div class="logclean">
  138. <input class="left" name="code" type="text" placeholder="请输入验证码">
  139. <p data-action="getcode" class="right">获取验证码</p>
  140. </div>
  141. </li>
  142. <li>
  143. <div><img class="logicon" src="${contextPath }app/img/pw@2x.png" alt=""><span>密码</span></div>
  144. <input type="password" name="password" placeholder="请重新设置您的登录密码">
  145. </li>
  146. <li>
  147. <div><img class="logicon" src="${contextPath }app/img/pw@2x.png" alt=""><span>密码</span></div>
  148. <input type="password" name="password2" placeholder="请再次输入您的新密码">
  149. </li>
  150. </ul>
  151. <a class="redbtn" href="javascript:void(0);" id="button">完成</a>
  152. </form>
  153. </div>
  154. </div>
  155. </body>
  156. </html>