diff --git a/yudao-ui-admin-vue3/.env b/yudao-ui-admin-vue3/.env index 1bcb92da6..a7bbb6b7f 100644 --- a/yudao-ui-admin-vue3/.env +++ b/yudao-ui-admin-vue3/.env @@ -9,3 +9,6 @@ VITE_OPEN=true # 租户开关 VITE_APP_TENANT_ENABLE=true + +# 验证码的开关 +VITE_APP_CAPTCHA_ENABLE=false diff --git a/yudao-ui-admin-vue3/src/views/Login/components/LoginForm.vue b/yudao-ui-admin-vue3/src/views/Login/components/LoginForm.vue index ce882b733..bb4e73cf5 100644 --- a/yudao-ui-admin-vue3/src/views/Login/components/LoginForm.vue +++ b/yudao-ui-admin-vue3/src/views/Login/components/LoginForm.vue @@ -51,8 +51,8 @@ const LoginRules = { const loginLoading = ref(false) const loginData = reactive({ isShowPassword: false, - captchaEnable: true, - tenantEnable: true, + captchaEnable: import.meta.env.VITE_APP_CAPTCHA_ENABLE, + tenantEnable: import.meta.env.VITE_APP_TENANT_ENABLE, token: '', loading: { signIn: false @@ -71,6 +71,14 @@ const captchaType = ref('blockPuzzle') // 获取验证码 const getCode = async () => { + // 情况一,未开启:则直接登录 + if (!loginData.captchaEnable) { + await handleLogin({}) + return + } + + // 情况二,已开启:则展示验证码;只有完成验证码的情况,才进行登录 + // 弹出验证码 verify.value.show() } //获取租户ID diff --git a/yudao-ui-admin-vue3/types/env.d.ts b/yudao-ui-admin-vue3/types/env.d.ts index c5399a1b9..b42713656 100644 --- a/yudao-ui-admin-vue3/types/env.d.ts +++ b/yudao-ui-admin-vue3/types/env.d.ts @@ -11,6 +11,7 @@ interface ImportMetaEnv { readonly VITE_APP_TITLE: string readonly VITE_PORT: number readonly VITE_OPEN: boolean + readonly VITE_APP_CAPTCHA_ENABLE: boolean readonly VITE_APP_TENANT_ENABLE: boolean readonly VITE_BASE_URL: string readonly VITE_UPLOAD_URL: string