修改密码页面跳转首页bug修复
This commit is contained in:
@@ -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() {
|
||||||
if (this.off) this.off()
|
this.drop()
|
||||||
this.off = null
|
},
|
||||||
|
onUnload() {
|
||||||
|
this.drop()
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user