From caeaa309c6cd9afb804cc79abd27c5928943ae41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89?= <814457906@qq.com> Date: Thu, 9 Nov 2023 15:58:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/login/login.vue | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) 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' }) } })