From c67a9c7784e4cc3c623c1125171247dbb9c131ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=91=E7=BF=94?= <971366405@qq.com> Date: Wed, 18 Sep 2024 10:57:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20:sparkles:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E9=AA=8C=E8=AF=81=E7=A0=81=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加关闭验证码的功能 --- src/api/auth.ts | 10 ++++++++++ src/views/login/index.vue | 15 +++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/api/auth.ts b/src/api/auth.ts index eb904d87..1ac19be0 100644 --- a/src/api/auth.ts +++ b/src/api/auth.ts @@ -35,6 +35,16 @@ class AuthAPI { method: "get", }); } + + /** + * 获取验证码规则 + */ + static getCaptchaRule() { + return request({ + url: `${AUTH_BASE_URL}/captcha/unable`, + method: "get", + }); + } } export default AuthAPI; diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 7222319e..1c58a41b 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -107,7 +107,7 @@ - +
(); +// 是否关闭验证码 +const closeCaptcha = ref(false); const logo = ref(new URL(`../../assets/logo.png`, import.meta.url).href); @@ -341,8 +343,17 @@ const setLoginCredentials = (username: string, password: string) => { loginData.value.password = password; }; +function getCaptchaRule() { + AuthAPI.getCaptchaRule().then((data) => { + closeCaptcha.value = data; + if (!closeCaptcha.value) { + getCaptcha(); + } + }); +} + onMounted(() => { - getCaptcha(); + getCaptchaRule(); });