user-editPwd.js 936 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. $("#form-edit").validate({
  2. rules:{
  3. password:{
  4. required:true,
  5. minlength: 5,
  6. maxlength: 20
  7. },
  8. confirm:{
  9. required:true,
  10. minlength: 5,
  11. maxlength: 20,
  12. equalTo:"#password"
  13. }
  14. },
  15. messages: {
  16. password: {
  17. required: "请输入新密码",
  18. minlength: "密码不能小于6个字符",
  19. maxlength: "密码不能大于20个字符"
  20. },
  21. confirm: {
  22. required: "请再次输入新密码",
  23. equalTo: "两次密码输入不一致"
  24. }
  25. },
  26. submitHandler:function(form){
  27. edit();
  28. }
  29. });
  30. function edit() {
  31. var dataFormJson=$("#form-edit").serialize();
  32. $.ajax({
  33. cache : true,
  34. type : "POST",
  35. url : rootPath + "/UserVueController/editPwd",
  36. data : dataFormJson,
  37. async : false,
  38. error : function(request) {
  39. $.modal.alertError("系统错误");
  40. },
  41. success : function(data) {
  42. $.operate.saveSuccess(data);
  43. }
  44. });
  45. }