diff --git a/pages/login/login.vue b/pages/login/login.vue index f357aad..7711cd7 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -111,34 +111,28 @@ type: 'error', duration: '1500', }) - setTimeout(() => { + if (that.timer) { + clearTimeout(that.timer) + } + that.timer = setTimeout(() => { uni.redirectTo({ url: '/pages/register/register', }) - }) + }, 1500) } else if (resp.data.code == '1') { getCurrentUser(resp.data.openid, resp.data.cityCode).then(res => { if (res.code == 200) { + uni.setStorageSync('patientId', res.data.id); + uni.setStorageSync('userinfo', res.data); that.$refs.uToast.show({ title: '登录成功', type: 'success', - duration: '1500' + back: 1 }) - uni.setStorageSync('patientId', res.data.id); - uni.setStorageSync('userinfo', res.data); - if (that.timer) { - clearTimeout(that.timer) - } - that.timer = setTimeout(e => { - uni.navigateBack({ - delta: 1 - }) - }, 500) } else { that.$refs.uToast.show({ title: '登录失败', type: 'error', - duration: '1500' }) } })