updata-psw.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. import { _API_Logout } from "@/apis/verify.js"
  21. export default {
  22. data() {
  23. return {
  24. psw1: '',
  25. psw2: '',
  26. };
  27. },
  28. methods: {
  29. updata() {
  30. if (this.psw1.trim().length != this.psw2.trim().length) { uni.toast('两次输入的密码不一致,请确认'); return }
  31. console.log(this.psw1.trim() === this.$store.state.userinfo.mobile.toString())
  32. if (this.psw1.trim() === this.$store.state.userinfo.mobile.toString()) { uni.toast('新密码不能与原密码一致'); return }
  33. if (this.psw1.length >= 6 && this.psw1.length <= 16) {
  34. uni.showLoading({ mask: true })
  35. let _this = this
  36. _API_UpdataPsw({ password: this.psw1 }).then(res => {
  37. _API_Logout().then(() => {
  38. _this.$store.commit('app/LOGOUT')
  39. _this.toWxchatLogin("/pages/login-reg/login-reg", null)
  40. })
  41. })
  42. } else {
  43. uni.toast('密码格式错误')
  44. }
  45. },
  46. toWxchatLogin(url, state) {
  47. url = url || "/pages/index/index"
  48. state = state || "cli"
  49. const redirect_uri = encodeURIComponent(`${this.$config.redirect_uri}/api/gzh#${url}`)
  50. const auth = () => window.location.href = `${this.$config.wxURL}?appid=${this.$config.appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`
  51. auth()
  52. },
  53. }
  54. }
  55. </script>
  56. <style lang="scss" scoped>
  57. .updata-psw {
  58. @include page();
  59. .content {
  60. @include flex(column);
  61. justify-content: flex-start;
  62. padding-top: 98rpx;
  63. input {
  64. width: 666rpx;
  65. height: 98rpx;
  66. font-size: 45rpx;
  67. text-align: center;
  68. background: #FFFFFF;
  69. border-radius: 24rpx;
  70. }
  71. }
  72. }
  73. </style>