You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

97 lines
4.0 KiB

  1. /*
  2. * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  3. * Copyright (c) 2013-2018 北京泉江科技有限公司
  4. * 创建人:陈彬彬
  5. * 日 期:2017.04.11
  6. * 描 述:个人中心-修改密码
  7. */
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var page = {
  11. init: function () {
  12. page.bind();
  13. },
  14. bind: function () {
  15. // 点击切换验证码
  16. $("#Verifycode_img").click(function () {
  17. $("#Verifycode").val('');
  18. $("#Verifycode_img").attr("src", top.$.rootUrl + "/UserCenter/VerifyCode?time=" + Math.random());
  19. });
  20. // 旧密码验证
  21. $("#OldPassword").blur(function () {
  22. var $this = $(this);
  23. $this.parent().find('.tip').html('');
  24. if ($this.val() == "") {
  25. return false;
  26. }
  27. var password = $.md5($this.val());
  28. learun.httpAsyncPost(top.$.rootUrl + "/UserCenter/ValidationOldPassword", { OldPassword: password }, function (res) {
  29. if (res.code != 200) {
  30. $this.parent().find('.tip').html('<div class="tip-error"><i class="fa fa-exclamation-circle"></i>密码错误!</div>');
  31. }
  32. else {
  33. $this.parent().find('.tip').html('<div class="tip-success"><i class="fa fa-check-circle"></i></div>');
  34. }
  35. });
  36. });
  37. // 新密码
  38. $("#NewPassword").blur(function () {
  39. var $this = $(this);
  40. $this.parent().find('.tip').html('');
  41. if ($this.val() == "") {
  42. return false;
  43. }
  44. $this.parent().find('.tip').html('<div class="tip-success"><i class="fa fa-check-circle"></i></div>');
  45. });
  46. $("#RedoNewPassword").blur(function () {
  47. var $this = $(this);
  48. $this.parent().find('.tip').html('');
  49. if ($this.val() == "") {
  50. return false;
  51. }
  52. if ($this.val() == $('#NewPassword').val()) {
  53. $this.parent().find('.tip').html('<div class="tip-success"><i class="fa fa-check-circle"></i></div>');
  54. }
  55. else {
  56. $this.parent().find('.tip').html('<div class="tip-error"><i class="fa fa-exclamation-circle"></i>两次密码输入不一样!</div>');
  57. }
  58. });
  59. $('#lr_save_btn').on('click', function () {
  60. if (!$('#form').lrValidform()) {
  61. return false;
  62. }
  63. if ($('#OldPassword').parent().find('.tip-success').length > 0 && $('#NewPassword').parent().find('.tip-success').length > 0 && $('#RedoNewPassword').parent().find('.tip-success').length > 0)
  64. {
  65. var formData = $('#form').lrGetFormData();
  66. var postData = {
  67. password: $.md5(formData.NewPassword),
  68. oldPassword: $.md5(formData.OldPassword),
  69. verifyCode: formData.Verifycode
  70. };
  71. learun.layerConfirm('注:请牢记当前设置密码,您确认要修改密码?', function (res, index) {
  72. if (res) {
  73. $.lrSaveForm(top.$.rootUrl + '/UserCenter/SubmitResetPassword', postData, function (res) {
  74. if (res.code == 200) {
  75. top.location.href = top.$.rootUrl + "/Login/Index";
  76. }
  77. console.log(res);
  78. });
  79. top.layer.close(index); //再执行关闭
  80. }
  81. });
  82. }
  83. return false;
  84. });
  85. }
  86. };
  87. page.init();
  88. }