personalpwd.jsp 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <%@ include file="/webpage/include/taglibf.jsp"%>
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <meta charset="utf-8">
  7. <title>${fns:getConfig("productName")}</title>
  8. <link rel="stylesheet" href="${ctxStaticWeb}/css/base.css" />
  9. <link rel="stylesheet" href="${ctxStaticWeb}/css/second.css" />
  10. <script src="${ctx}/static/web/js/jquery-2.1.4.js"></script>
  11. <script src="${ctx}/static/plugin/jquery-validation/1.14.0/jquery.validate.js" type="text/javascript"></script>
  12. <script src="${ctx}/static/plugin/jquery-validation/1.14.0/localization/messages_zh.min.js" type="text/javascript"></script>
  13. <script src="${ctxStatic}/plugin/layui/layer/layer.js"></script>
  14. <script src="${ctxStatic}/plugin/layui/laytpl/laytpl.js"></script>
  15. <script>
  16. $().ready(function() {
  17. $("#inputForm").validate({
  18. debug: false,
  19. focusInvalid: true, //当为false时,验证无效时,没有焦点响应
  20. onkeyup: false,
  21. rules: {
  22. password: {
  23. required: true,
  24. minlength: 6,
  25. remote: "${ctx}/validatePassword"
  26. },
  27. passwordAgain: {
  28. required: true,
  29. minlength: 6
  30. },
  31. passwordAgain1: {
  32. required: true,
  33. minlength: 6,
  34. equalTo: "#passwordAgain"
  35. }
  36. },
  37. messages: {
  38. password: {
  39. required: "请输入原密码",
  40. minlength: "原密码长度不能小于6位",
  41. remote:"原密码错误"
  42. },
  43. passwordAgain: {
  44. required: "请输入确认密码",
  45. minlength: "密码长度不能小于6位"
  46. },
  47. passwordAgain1: {
  48. required: "请输入确认密码",
  49. minlength: "密码长度不能小于6位",
  50. equalTo: "两次密码输入不一致"
  51. }
  52. },
  53. submitHandler:function(form){//这是关键的语句,配置这个参数后表单不会自动提交,验证通过之后会去调用的方法
  54. $.ajax({
  55. url:"${ctx}/updatePassword",
  56. type:"POST",
  57. cache: false,
  58. data:$(form).serialize(),
  59. dataType:"json",
  60. beforeSend: function(XMLHttpRequest){
  61. //do something before submit...
  62. },
  63. success: function(data){
  64. if(data.success){
  65. layer.msg(data.msg, {icon:1});
  66. document.getElementById("inputForm").reset();
  67. }else{
  68. layer.msg(data.msg, {icon:2,time: 2000});
  69. }
  70. },
  71. complete: function(XMLHttpRequest, textStatus){
  72. //do something in the end...
  73. }
  74. });
  75. }
  76. });
  77. //增加手机号验证规则
  78. $.validator.addMethod("isMobile", function(value, element) {
  79. var length = value.length;
  80. var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
  81. return this.optional(element) || (length == 11 && mobile.test(value));
  82. }, "请正确填写您的手机号码");
  83. });
  84. </script>
  85. <style>
  86. .information ul li input{width:248px;line-height:40px;padding:0px 10px;color:#999;border:1px solid #999;}
  87. #inputForm label.error{
  88. color:#cc5965;
  89. font-size:14px;
  90. padding: 10px;
  91. }
  92. </style>
  93. </head>
  94. <body>
  95. <%@ include file="/webpage/modules/web/top.jsp"%>
  96. <div class="new w clearfix">
  97. <div class="personal">
  98. <div class="personal_l fl">
  99. <h2>个人中心</h2>
  100. <ul>
  101. <li><a href="${ctxF}/info" id="hrefperson">个人资料</a></li>
  102. <li><a href="${ctxF}/personalpwd" id="hrefpwd" class="do">修改密码</a></li>
  103. <li><a href="${ctxF}/count" id="hrefCount">学习统计</a></li>
  104. <li><a href="${ctxF}/history" id="hrefhistory">答题测试</a></li>
  105. <li><a href="${ctxF}/exam/wait" id="hrefexam">在线考试</a></li>
  106. <li><a href="${ctxF}/plan" id="hrefplan">培训计划</a></li>
  107. <li><a href="#" onclick="exit()">退出登录</a></li>
  108. </ul>
  109. </div>
  110. <div class="personal_r fr">
  111. <div class="position">当前位置:<a href="${ctx}/">网站首页</a>&nbsp;&#62;&nbsp;个人中心&nbsp;&#62;&nbsp;修改密码</div>
  112. <div class="information" id="xgmm" >
  113. <form id = "inputForm" method="post">
  114. <ul>
  115. <li><span>登录名:</span>${applicationScope.talentPerson.loginName}</li>
  116. <li><span>旧密码:</span><input type="password" name="password" id="password" style="border:1px solid #999;" placeholder="请输入旧密码"></li>
  117. <li><span>新密码:</span><input type="password" name="passwordAgain" id="passwordAgain" placeholder="输入新密码"></li>
  118. <li><span>确认密码:</span><input type="password" name="passwordAgain1" id="passwordAgain1" placeholder="输入新密码"></li>
  119. </ul>
  120. <div style="width:530px; margin: 0 auto;">
  121. <input type="submit" value="保 存" style="cursor: pointer;height:44px;border-radius: 4px;font-size:16px;color:#fff; background-color: #C7301E; width: 150px;border:none">
  122. </div>
  123. </form>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. <div class="footer">
  129. <%@ include file="/webpage/modules/web/footer.jsp"%>
  130. </div>
  131. </body>
  132. </html>