From 2d4ed85e949d183be9e87eb5da61aaf2edf3a1f3 Mon Sep 17 00:00:00 2001 From: AhJindeg Date: Thu, 7 Mar 2024 14:38:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(LoginForm):=20=F0=9F=90=9E=20update=20doSoc?= =?UTF-8?q?ialLogin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复手动填写租户名称时,点击取消按钮,登录按钮 loading 状态未取消,并且会继续执行 LoginApi.socialAuthRedirect 方法 --- src/views/Login/components/LoginForm.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/views/Login/components/LoginForm.vue b/src/views/Login/components/LoginForm.vue index ef212505..3ffb1305 100644 --- a/src/views/Login/components/LoginForm.vue +++ b/src/views/Login/components/LoginForm.vue @@ -291,10 +291,16 @@ const doSocialLogin = async (type: number) => { await getTenantId() // 如果获取不到,则需要弹出提示,进行处理 if (!authUtil.getTenantId()) { - await message.prompt('请输入租户名称', t('common.reminder')).then(async ({ value }) => { - const res = await LoginApi.getTenantIdByName(value) + try { + const data = await message.prompt('请输入租户名称', t('common.reminder')) + if (data?.action !== 'confirm') throw 'cancel' + const res = await LoginApi.getTenantIdByName(data.value) authUtil.setTenantId(res) - }) + } catch (error) { + if(error === 'cancel') return + } finally { + loginLoading.value = false + } } } // 计算 redirectUri