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 () => { - +
+ +
+