From 61d800d3c7886b246ba3b4966709ef38a8fb074b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9A=93=E6=9C=88=E5=BD=92=E5=B0=98?= Date: Thu, 13 Feb 2025 00:04:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E9=AA=8C=E8=AF=81=EF=BC=8C=E7=94=A8=E6=88=B7=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/login.ts | 8 ++++++-- src/store/modules/user.ts | 2 ++ src/views/login/index.vue | 20 ++++++++++++++------ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/api/login.ts b/src/api/login.ts index 36e1def..f9620af 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -35,9 +35,13 @@ export const refreshTokenApi = (data: { refreshToken: string }) => { export type CaptchaResponse = { /**验证码ID */ - uuid: string; + uuid: string | null; /**验证码 */ - captcha: string; + captcha: string | null; + /**是否开启验证码 */ + captcha_enabled: boolean; + /**是否开启注册 */ + register_enabled: boolean; }; /** 获取验证码 */ diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 986f422..cf6f725 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -144,6 +144,8 @@ export const useUserStore = defineStore({ username: string; password: string; loginDay?: number; + uuid?: string; + code?: string; }) { return new Promise>((resolve, reject) => { getLogin(data) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 52b09dd..6a91c68 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -39,6 +39,8 @@ defineOptions({ name: "Login" }); +const captcha_enabled = ref(true); +const register_enabled = ref(true); const imgCode = ref(""); const imgId = ref(""); const loginDay = ref(7); @@ -116,6 +118,8 @@ const getImgCode = async () => { if (res.success) { imgCode.value = res.data.captcha; imgId.value = res.data.uuid; + captcha_enabled.value = res.data.captcha_enabled; + register_enabled.value = res.data.register_enabled; } }; @@ -238,7 +242,7 @@ onMounted(async () => { - + { class="w-full mt-4" size="default" type="primary" + round :loading="loading" :disabled="disabled" @click="onLogin(ruleFormRef)" @@ -312,13 +317,13 @@ onMounted(async () => {
- {{ t(item.title) }} + {{ t("login:Register") }}
@@ -330,7 +335,10 @@ onMounted(async () => { - +
+ +
+