修改密码页面跳转首页bug修复
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user