mobile-changePsw.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <div style="height: 100vh; width: 100vw">
  3. <van-nav-bar title="密码修改" @click-left="toMain">
  4. <template #left>
  5. <van-icon name="arrow-left" />
  6. </template>
  7. </van-nav-bar>
  8. <van-row style="margin-top: 10%; z-index: 99">
  9. <van-col :span="22" :offset="1" style="border-radius: 10px; overflow: hidden">
  10. <van-cell-group class="bx">
  11. <br />
  12. <van-field
  13. v-model="password.wxmm"
  14. label="当前密码:"
  15. placeholder="请输入当前密码"
  16. type="password"
  17. />
  18. <van-field
  19. v-model="password.newWxmm"
  20. label="修改密码:"
  21. placeholder="密码不少于6位,需要字母与数字构成"
  22. type="password"
  23. />
  24. <van-field
  25. v-model="password.repeatPsw"
  26. label="确认修改密码:"
  27. placeholder="密码不少于6位,需要字母与数字构成"
  28. type="password"
  29. />
  30. <br />
  31. <van-button
  32. round
  33. block
  34. @click="save"
  35. type="info"
  36. style="width: 50%; margin: 0 auto"
  37. >
  38. 修改
  39. </van-button>
  40. <br />
  41. </van-cell-group>
  42. </van-col>
  43. </van-row>
  44. </div>
  45. </template>
  46. <script>
  47. import { Toast } from 'vant'
  48. import apis from '@.mobile/api/apis'
  49. import common from '@.mobile/plugin/axios/common'
  50. export default {
  51. data() {
  52. return {
  53. password: {
  54. rowguid: '',
  55. wxmm: '',
  56. newWxmm: '',
  57. repeatPsw: ''
  58. }
  59. }
  60. },
  61. mounted() {
  62. const user = common.currUser()
  63. if (user && user.rowguid) {
  64. this.password.rowguid = user.rowguid
  65. } else {
  66. this.$router.push('/mobile-login')
  67. }
  68. },
  69. methods: {
  70. toMain() {
  71. this.$router.push('/mobile-main')
  72. },
  73. save() {
  74. if (this.password.newWxmm !== this.password.repeatPsw) {
  75. Toast('两次输入的密码不一致')
  76. return
  77. }
  78. apis.requestData('EcCompanyInfoController', 'editPwd', this.password).then(res => {
  79. if (res.data.code === 200) {
  80. Toast('密码修改成功,请重新登录')
  81. this.$store.dispatch('user/cleanCache').then(res => {
  82. this.$router.push('/mobile-login')
  83. })
  84. } else {
  85. Toast(res.data.msg)
  86. }
  87. })
  88. }
  89. }
  90. }
  91. </script>
  92. <style scoped>
  93. ::v-deep .van-cell {
  94. height: 60px;
  95. line-height: 60px;
  96. }
  97. ::v-deep .van-cell__title {
  98. height: 60px;
  99. line-height: 60px;
  100. }
  101. ::v-deep .van-cell__right-icon {
  102. height: 60px;
  103. line-height: 60px;
  104. }
  105. </style>