修改密码页面跳转首页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() { 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() { onShow() {
if (this.off) this.off() if (this.off) this.off()
this.off = store.on(() => { this.off = store.on(() => {
this.error = store.error this.error = store.error
if (this.left || store.phase !== 'app') return if (this.left || !this.waiting || store.phase !== 'app') return
this.left = true this.leave()
uni.switchTab({ url: '/pages/tabs/messages' })
}) })
}, },
onHide() { onHide() {
this.drop()
},
onUnload() {
this.drop()
},
methods: {
drop() {
if (this.off) this.off() if (this.off) this.off()
this.off = null this.off = null
}, },
methods: { leave() {
this.left = true
this.waiting = false
uni.switchTab({ url: '/pages/tabs/messages' })
},
async ok() { async ok() {
if (!this.next || this.next.length < 6) return toast('密码至少 6 位') if (!this.next || this.next.length < 6) return toast('密码至少 6 位')
if (this.next !== this.confirm) return toast('两次密码不一致') if (this.next !== this.confirm) return toast('两次密码不一致')
this.waiting = true
await store.changePassword(this.next, this.confirm) await store.changePassword(this.next, this.confirm)
if (store.error) this.waiting = false
} }
} }
} }