updata-psw.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <view class="updata-psw">
  3. <custom-nav noback="noback" transparent="transparent" ref="ltm" title=" " />
  4. <view class="content">
  5. <view style="width: 100%; padding-left: 24px;">设置密码:</view>
  6. <view style="height: 12px;"></view>
  7. <input type="text" maxlength="16" v-model="psw1" placeholder="请输入密码" />
  8. <view style="height: 24px;"></view>
  9. <view style="width: 100%; padding-left: 24px;">确认密码:</view>
  10. <view style="height: 12px;"></view>
  11. <input type="text" maxlength="16" v-model="psw2" placeholder="请再次输入密码" />
  12. <view class="big-btn bg" @tap="updata">修改密码</view>
  13. <view style="height: 12x;"></view>
  14. <view class="basecolor">* 密码为6至16位任意数字字母组合</view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import { _API_UpdataPsw } from '@/apis/verify.js'
  20. export default {
  21. data() {
  22. return {
  23. psw1: '',
  24. psw2: '',
  25. };
  26. },
  27. methods: {
  28. updata() {
  29. if (this.psw1.trim().length != this.psw2.trim().length) { uni.toast('两次输入的密码不一致,请确认'); return }
  30. console.log(this.psw1.trim() === this.$store.state.userinfo.mobile.toString())
  31. if (this.psw1.trim() === this.$store.state.userinfo.mobile.toString()) { uni.toast('新密码不能与原密码一致'); return }
  32. if (this.psw1.length >= 6 && this.psw1.length <= 16) {
  33. uni.showLoading({ mask: true })
  34. _API_UpdataPsw({ password: this.psw1 }).then(res => {
  35. this.$store.commit('app/LOGOUT')
  36. uni.reLaunch({ url: '../login-psw/login-psw' })
  37. })
  38. } else {
  39. uni.toast('密码格式错误')
  40. }
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="scss" scoped>
  46. .updata-psw {
  47. @include page();
  48. .content {
  49. @include flex(column);
  50. justify-content: flex-start;
  51. padding-top: 98rpx;
  52. input {
  53. width: 666rpx;
  54. height: 98rpx;
  55. font-size: 45rpx;
  56. text-align: center;
  57. background: #FFFFFF;
  58. border-radius: 24rpx;
  59. }
  60. }
  61. }
  62. </style>