updata-psw.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. uni.reLaunch({
  41. url: '../login-reg/login-reg'
  42. })
  43. })
  44. })
  45. } else {
  46. uni.toast('密码格式错误')
  47. }
  48. },
  49. toWxchatLogin(url, state) {
  50. url = url || "/pages/index/index"
  51. state = state || "cli"
  52. const redirect_uri = encodeURIComponent(`${this.$config.redirect_uri}/api/gzh#${url}`)
  53. 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`
  54. auth()
  55. },
  56. }
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. .updata-psw {
  61. @include page();
  62. .content {
  63. @include flex(column);
  64. justify-content: flex-start;
  65. padding-top: 98rpx;
  66. input {
  67. width: 666rpx;
  68. height: 98rpx;
  69. font-size: 45rpx;
  70. text-align: center;
  71. background: #FFFFFF;
  72. border-radius: 24rpx;
  73. }
  74. }
  75. }
  76. </style>