修改密码页面跳转首页bug修复

This commit is contained in:
2026-09-24 16:02:52 +08:00
parent df04d0f4ba
commit 94024faba9
+17 -5
View File
@@ -45,26 +45,38 @@ export default {
}
},
data() {
return { next: '', confirm: '', error: '', off: null, left: false, showNext: false, showConfirm: false }
return { next: '', confirm: '', error: '', off: null, left: false, waiting: false, showNext: false, showConfirm: false }
},
onShow() {
if (this.off) this.off()
this.off = store.on(() => {
this.error = store.error
if (this.left || store.phase !== 'app') return
this.left = true
uni.switchTab({ url: '/pages/tabs/messages' })
if (this.left || !this.waiting || store.phase !== 'app') return
this.leave()
})
},
onHide() {
this.drop()
},
onUnload() {
this.drop()
},
methods: {
drop() {
if (this.off) this.off()
this.off = null
},
methods: {
leave() {
this.left = true
this.waiting = false
uni.switchTab({ url: '/pages/tabs/messages' })
},
async ok() {
if (!this.next || this.next.length < 6) return toast('密码至少 6 位')
if (this.next !== this.confirm) return toast('两次密码不一致')
this.waiting = true
await store.changePassword(this.next, this.confirm)
if (store.error) this.waiting = false
}
}
}