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.

newpassword.vue 2.5 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <view class="page">
  3. <l-title>设置密码</l-title>
  4. <l-input v-model="oldPwd" title="旧密码" placeholder="请输入身份证后八位" password></l-input>
  5. <l-input v-model="newPwd" title="新密码" placeholder="请输入新密码" password></l-input>
  6. <l-input v-model="confirmPwd" title="确认输入" placeholder="请再次输入新密码" password></l-input>
  7. <view class="passwordDes">
  8. <text>新密码必须8-20位同时包含1.[大小写字母]、2.[数字]、3.[特殊符号!@#$%^&*]</text>
  9. </view>
  10. <view class="padding">
  11. <l-button @click="submit" size="lg" color="blue" class="block" block>确认修改</l-button>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import moment from 'moment';
  17. import get from 'lodash/get';
  18. import set from 'lodash/set';
  19. export default {
  20. data() {
  21. return {
  22. userInfo: {},
  23. oldPwd: '',
  24. newPwd: '',
  25. confirmPwd: ''
  26. }
  27. },
  28. mounted(){
  29. var a = document.getElementsByClassName('uni-page-head-hd')[0]
  30. a.style.display = 'none';
  31. },
  32. methods: {
  33. init() {
  34. this.SET_GLOBAL('token', this.GET_STORAGE('token'));
  35. },
  36. // 提交修改
  37. submit() {
  38. // const {
  39. // auth,
  40. // oldPwd,
  41. // newPwd,
  42. // confirmPwd
  43. // } = this
  44. if (this.oldPwd.length < 6) {
  45. this.CONFIRM('操作失败', '旧密码输入不正确,请重新确认')
  46. return
  47. }
  48. // if (newPwd.length < 6 || newPwd.length > 16) {
  49. // this.CONFIRM('操作失败', '新密码不符合要求,请修改后重试')
  50. // return
  51. // }
  52. var reg = /^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*,\.])[0-9a-zA-Z!@#$%^&*,\.]{8,20}$/;
  53. if (!reg.test(this.newPwd)) {
  54. this.CONFIRM('操作失败', '新密码不符合要求,请修改后重试')
  55. return
  56. }
  57. if (this.newPwd !== this.confirmPwd) {
  58. this.CONFIRM('操作失败', '新密码和确认密码输入不一致,请修改')
  59. return
  60. }
  61. let obj={
  62. newpassword: this.MD5(this.newPwd),
  63. oldpassword: this.oldPwd
  64. }
  65. this.HTTP_POST('learun/adms/user/modifypwiden', obj, '未能成功修改密码').then(res => {
  66. this.HIDE_LOADING();
  67. if (res) {
  68. this.TOAST('密码修改成功')
  69. setTimeout(() => {
  70. this.CLEAR_GLOBAL()
  71. this.RELAUNCH_TO('/pages/login')
  72. }, 100)
  73. }
  74. });
  75. }
  76. },
  77. created() {
  78. this.userInfo = this.GET_GLOBAL('loginUser'); //获取登录信息
  79. this.init();
  80. }
  81. }
  82. </script>
  83. <style lang="scss">
  84. .passwordDes {
  85. color: #606266;
  86. font-size: 14px;
  87. padding: 8px;
  88. text-indent: 2em;
  89. }
  90. </style>