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'),