password-change.htm 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <#include "/head-file.htm" />
  5. </head>
  6. <body>
  7. <#include "/head.htm" />
  8. <div class="ms-content" id="pa-change-vue">
  9. <div class="ms-content-main">
  10. <div class="ms-content-left">
  11. <div class="ms-content-left-info">
  12. <img :src="'{ms:global.host/}/'+peopleInfo.puIcon" onerror='this.src="http://cdn.mingsoft.net/global/images/msheader.png"'>
  13. <div style="display: none;" v-show="peopleInfo.puNickname!='' && peopleInfo.puNickname != undefined" v-if="peopleInfo.puNickname!='' && peopleInfo.puNickname != undefined" v-text="peopleInfo.puNickname"></div>
  14. <div v-else v-text="'暂无昵称'"></div>
  15. </div>
  16. <div class="ms-content-left-list">
  17. <div class="ms-content-left-list-info">
  18. <a href="{ms:global.host/}/people/center.do">基本资料</a>
  19. </div>
  20. <div class="ms-content-left-list-pass">
  21. <a class='active' href="{ms:global.host/}/people/password-change.do">修改密码</a>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="ms-content-right">
  26. <div class="ms-content-right-title">修改密码</div>
  27. <div class="ms-content-right-form">
  28. <form>
  29. <div class="ms-content-old-password">
  30. <span class="ms-content-old-password span">当前密码</span>
  31. <input @keyup="chanageBackgroundColor" type="password" v-model="peopleOldPassword" name="peopleOldPassword" placeholder="必填,请填写旧密码">
  32. <img class="ms-error-hide" src="{ms:global.host/}/{ms:global.style/}/images/error.png" :class="{'ms-error-show':errorText[0] != ''}" />
  33. <span class="ms-error-hide" v-text="errorText[0]" :class="{'ms-error-show':errorText[0] != ''}"></span>
  34. </div>
  35. <div class="ms-content-old-password">
  36. <span class="ms-content-new-password span">新密码</span>
  37. <input @keyup="chanageBackgroundColor" type="password" v-model="peoplePassword" name="peoplePassword" placeholder="必填,6-20位,不能与旧密码相同">
  38. <img class="ms-error-hide" src="{ms:global.host/}/{ms:global.style/}/images/error.png" :class="{'ms-error-show':errorText[1] != ''}" />
  39. <span class="ms-error-hide" v-text="errorText[1]" :class="{'ms-error-show':errorText[1] != ''}"></span>
  40. </div>
  41. <div class="ms-content-old-password">
  42. <span class="ms-content-old-password span">确认密码</span>
  43. <input @keyup="chanageBackgroundColor" type="password" v-model="rePeoplePassword" name="rePeoplePassword" placeholder="必填,6-20位,与新密码一致">
  44. <img class="ms-error-hide" src="{ms:global.host/}/{ms:global.style/}/images/error.png" :class="{'ms-error-show':errorText[2] != ''}" />
  45. <span class="ms-error-hide" v-text="errorText[2]" :class="{'ms-error-show':errorText[2] != ''}"></span>
  46. </div>
  47. </form>
  48. <div class="ms-content-click ms-content-click-password" :disabled="butText != '确认'" :class="{'ms-but-disabled':butText != '确认'}" @click="changePassword">确认</div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <#include "/footer.htm" />
  54. </body>
  55. </html>
  56. <script type="text/javascript">
  57. // $(function() {
  58. // $(".head-menu-list-li").hover(function() {
  59. // $(this).find(".head-menu-son-list").fadeToggle();
  60. // });
  61. // });
  62. ms.load(["ms", "ms.people", "ms.upload"], function(ms, mpeople, upload) {
  63. var paChangeVue = new Vue({
  64. el: "#pa-change-vue",
  65. data: {
  66. peopleInfo: {}, //用户信息
  67. peopleOldPassword: "", //用户旧密码
  68. peoplePassword: "", //用户密码
  69. rePeoplePassword: "", //确认密码
  70. butText: "确认", //按钮文字
  71. errorText: ['', '',''], //错误信息
  72. },
  73. methods: {
  74. //修改密码
  75. changePassword: function() {
  76. var target = this;
  77. if(!validator.isLength(this.peopleOldPassword, {
  78. min: 6,
  79. max: 20
  80. })) {
  81. this.showPrompt("旧密码必须6-20位字符", 1000, 0);
  82. return;
  83. }
  84. if(this.peopleOldPassword.indexOf(" ") >= 0) {
  85. this.showPrompt("旧密码不能包含空格", 1000, 0);
  86. return;
  87. }
  88. if(!validator.isLength(this.peoplePassword, {
  89. min: 6,
  90. max: 20
  91. })) {
  92. this.showPrompt("新密码必须6-20位字符", 1000, 1);
  93. return;
  94. }
  95. if(this.peoplePassword.indexOf(" ") >= 0) {
  96. this.showPrompt("新密码不能包含空格", 1000, 1);
  97. return;
  98. }
  99. if(!validator.isLength(this.rePeoplePassword, {
  100. min: 6,
  101. max: 20
  102. })) {
  103. this.showPrompt("确认密码必须6-20位字符", 1000, 2);
  104. return;
  105. }
  106. if(this.rePeoplePassword.indexOf(" ") >= 0) {
  107. this.showPrompt("确认密码不能包含空格", 1000, 2);
  108. return;
  109. }
  110. if(this.peoplePassword != this.rePeoplePassword) {
  111. this.showPrompt("确认密码与密码不一致", 1000, 2);
  112. return;
  113. }
  114. if(this.peopleOldPassword == this.peoplePassword) {
  115. this.showPrompt("新密码与旧密码输入一致", 1000, 1);
  116. } else {
  117. target.butText = "提交中..."
  118. ms.people.changePassword($("form").serialize(), function(returnJson) {
  119. if(returnJson.result) {
  120. alert("密码修改成功,请重新登录")
  121. $.ajax({
  122. type: "POST",
  123. url: "{ms:global.host/}/people/quit.do",
  124. success: function(msg) {
  125. }
  126. })
  127. location.href = "{ms:global.host/}/login.do";
  128. } else {
  129. target.showPrompt("旧密码错误", 1000, 0);
  130. target.butText = "确认"
  131. };
  132. target.butText = "确认"
  133. })
  134. }
  135. },
  136. //显示提示
  137. showPrompt: function(text, date, type) {
  138. var target = this;
  139. this.errorText[type] = text;
  140. this.errorText = [this.errorText[0], this.errorText[1], this.errorText[2]];
  141. setTimeout(
  142. function() {
  143. target.errorText[type] = '';
  144. target.errorText = [target.errorText[0], target.errorText[1], this.errorText[2]];
  145. }, date
  146. )
  147. },
  148. chanageBackgroundColor: function(){
  149. if($('input[name="peopleOldPassword"]').val().length >= 6 && $('input[name="peoplePassword"]').val().length >= 6 && $('input[name="rePeoplePassword"]').val().length >= 6){
  150. $('.ms-content-click-password').css("background-color", "#009aff");
  151. $('.ms-content-click-password').css("pointer-events", 'visible');
  152. $('.ms-content-click-password').css("color", "#fff");
  153. }else{
  154. $('.ms-content-click-password').css("background-color", "#fafafa");
  155. $('.ms-content-click-password').css('pointer-events', "none");
  156. $('.ms-content-click-password').css("color", "#ddd");
  157. }
  158. },
  159. },
  160. mounted: function() {
  161. //获取个人信息
  162. var target = this;
  163. ms.people.user.info(function(returnJson) {
  164. target.peopleInfo = returnJson;
  165. })
  166. }
  167. })
  168. })
  169. </script>