From 94024faba951329d0061debe1cccd81d49a4379e Mon Sep 17 00:00:00 2001 From: zhaichao Date: Thu, 24 Sep 2026 16:02:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=B7=B3=E8=BD=AC=E9=A6=96=E9=A1=B5bug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/password/password.vue | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pages/password/password.vue b/pages/password/password.vue index d3ae8ee..38ee135 100644 --- a/pages/password/password.vue +++ b/pages/password/password.vue @@ -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() { - if (this.off) this.off() - this.off = null + this.drop() + }, + onUnload() { + this.drop() }, methods: { + drop() { + if (this.off) this.off() + this.off = null + }, + 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 } } }