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.
 
 
 
 
 
 

75 lines
2.1 KiB

  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. export default {
  17. data() {
  18. return {
  19. oldPwd: '',
  20. newPwd: '',
  21. confirmPwd: ''
  22. }
  23. },
  24. methods: {
  25. // 提交修改
  26. async submit() {
  27. const { auth, oldPwd, newPwd, confirmPwd } = this
  28. if (oldPwd.length < 6) {
  29. this.CONFIRM('操作失败', '旧密码输入不正确,请重新确认')
  30. return
  31. }
  32. // if (newPwd.length < 6 || newPwd.length > 16) {
  33. // this.CONFIRM('操作失败', '新密码不符合要求,请修改后重试')
  34. // return
  35. // }
  36. var reg = /^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*,\.])[0-9a-zA-Z!@#$%^&*,\.]{8,20}$/;
  37. if( !reg.test(newPwd) ){
  38. this.CONFIRM('操作失败', '新密码不符合要求,请修改后重试')
  39. return
  40. }
  41. if (newPwd !== confirmPwd) {
  42. this.CONFIRM('操作失败', '新密码和确认密码输入不一致,请修改')
  43. return
  44. }
  45. const success = await this.HTTP_POST(
  46. 'learun/adms/user/modifypw',
  47. {
  48. newpassword: this.MD5(newPwd),
  49. oldpassword: this.MD5(oldPwd)
  50. },
  51. '未能成功修改密码'
  52. )
  53. console.log(success)
  54. if (!success) {
  55. return
  56. }
  57. this.NAV_BACK()
  58. this.TOAST('密码修改成功')
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss">
  64. .passwordDes{
  65. color: #606266;
  66. font-size: 14px;
  67. padding: 8px;
  68. text-indent:2em;
  69. }
  70. </style>