From 5121e05c496012f6c2881cbbf33e9effbb6b9c6c Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Fri, 15 Apr 2022 20:19:46 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=9F=E5=AE=9E=E7=8E=B0=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kicc-ui/src/views/sys/login/LoginForm.vue | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/kicc-ui/src/views/sys/login/LoginForm.vue b/kicc-ui/src/views/sys/login/LoginForm.vue index c9ecc162..ee2e6f87 100644 --- a/kicc-ui/src/views/sys/login/LoginForm.vue +++ b/kicc-ui/src/views/sys/login/LoginForm.vue @@ -132,13 +132,14 @@ const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN); - function getCode() { - getCaptcha().then(codeModel =>{ + async function getCode() { + try { + const codeModel = await getCaptcha(); codeUrl.value = codeModel.img ?? captchaDefImg; formData.realKey = codeModel.realKey; - }).catch(() => { + } catch(error) { codeUrl.value = captchaDefImg; - }); + } } async function handleLogin() { @@ -146,14 +147,12 @@ if (!data) return; try { loading.value = true; - const userInfo = await userStore.login( - toRaw({ + const userInfo = await userStore.login(toRaw({ password: data.password, username: data.account, realKey: data.realKey, code: data.code, - }) - ); + })); if (userInfo) { notification.success({ message: t('sys.login.loginSuccessTitle'),