personal.jsp 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. //增加手机号验证规则
  18. $.validator.addMethod("isMobile", function(value, element) {
  19. var length = value.length;
  20. var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
  21. return this.optional(element) || (length == 11 && mobile.test(value));
  22. }, "请正确填写您的手机号码");
  23. $("#userForm").validate({
  24. debug: false,
  25. focusInvalid: true, //当为false时,验证无效时,没有焦点响应
  26. onkeyup: false,
  27. rules: {
  28. name: {
  29. required: true,
  30. minlength: 2
  31. },
  32. email: {
  33. required: false,
  34. email:true
  35. },
  36. mobile: {
  37. required: true,
  38. isMobile: true
  39. }
  40. },
  41. messages: {
  42. name: {
  43. required: "请输入真实姓名",
  44. minlength: "真实姓名长度不能小于2位"
  45. },
  46. email: {
  47. email: "请输入正确的Email"
  48. },
  49. mobile: {
  50. required: "请输入手机号",
  51. isMobile: "请输入正确的手机号"
  52. }
  53. },
  54. submitHandler:function(form){//这是关键的语句,配置这个参数后表单不会自动提交,验证通过之后会去调用的方法
  55. layer.confirm('确认要进行修改吗?', {icon: 3, title:'提示'}, function(index){
  56. $.ajax({
  57. url:"${ctx}/updateUser",
  58. type:"POST",
  59. cache: false,
  60. data:$(form).serialize(),
  61. dataType:"json",
  62. beforeSend: function(XMLHttpRequest){
  63. //do something before submit...
  64. },
  65. success: function(data){
  66. if(data.success){
  67. layer.msg(data.msg, {icon:1});
  68. setTimeout(function () {
  69. window.location.href = "${ctxF}/info";
  70. }, 1000);
  71. }else{
  72. layer.msg(data.msg, {icon:2,time: 2000});
  73. }
  74. },
  75. complete: function(XMLHttpRequest, textStatus){
  76. //do something in the end...
  77. }
  78. });
  79. });
  80. }
  81. })
  82. });
  83. function personInfo() {
  84. $("#hrefperson").addClass("do");
  85. }
  86. </script>
  87. <style>
  88. .information ul li input{width:248px;line-height:40px;padding:0px 10px;color:#999;border:1px solid #999;}
  89. #userForm label.error{
  90. color:#cc5965;
  91. font-size:14px;
  92. padding: 10px;
  93. }
  94. </style>
  95. </head>
  96. <body>
  97. <%@ include file="/webpage/modules/web/top.jsp"%>
  98. <div class="new w clearfix">
  99. <div class="personal">
  100. <div class="personal_l fl">
  101. <h2>个人中心</h2>
  102. <ul>
  103. <li><a href="${ctxF}/info" class="do" id="hrefperson">个人资料</a></li>
  104. <li><a href="${ctxF}/personalpwd" id="hrefpwd">修改密码</a></li>
  105. <li><a href="${ctxF}/count" id="hrefCount">学习统计</a></li>
  106. <li><a href="${ctxF}/history" id="hrefhistory">答题测试</a></li>
  107. <li><a href="${ctxF}/exam/wait" id="hrefexam">在线考试</a></li>
  108. <li><a href="${ctxF}/plan" id="hrefplan">培训计划</a></li>
  109. <li><a href="#" onclick="exit()">退出登录</a></li>
  110. </ul>
  111. </div>
  112. <div class="personal_r fr">
  113. <div class="position">当前位置:<a href="${ctx}/">网站首页</a>&nbsp;&#62;&nbsp;个人中心&nbsp;&#62;&nbsp;个人资料</div>
  114. <form id = "userForm" method="post">
  115. <div class="information" id="grxx" >
  116. <ul>
  117. <li><span>登录名:</span>${applicationScope.talentPerson.loginName}</li>
  118. <li><span>最后登录IP:</span>${applicationScope.talentPerson.loginIp}</li>
  119. <li><span>最后登录时间:</span><fmt:formatDate value="${applicationScope.talentPerson.loginDate}" type="both" dateStyle="full"/></li>
  120. <li><span>真实姓名:</span><input type="text" value="${applicationScope.talentPerson.name}" name="name"/></li>
  121. <li><span>邮&nbsp;&nbsp;箱:</span><input type="text" value="${applicationScope.talentPerson.email}" name="email"/></li>
  122. <li><span>手&nbsp;&nbsp;机:</span><input type="text" value="${applicationScope.talentPerson.mobile}" name="mobile"/></li>
  123. </ul>
  124. <div style="width:530px; margin: 0 auto;">
  125. <input type="submit" value="保 存" style="cursor: pointer;height:44px;border-radius: 4px;font-size:16px;color:#fff; background-color: #C7301E; width: 150px;border:none">
  126. </div>
  127. </div>
  128. </form>
  129. </div>
  130. </div>
  131. </div>
  132. <div class="footer">
  133. <%@ include file="/webpage/modules/web/footer.jsp"%>
  134. </div>
  135. </body>
  136. </html>