Commit b134492fa9f3f939927515f50aaf9cd4efff32f7
1 parent
1a48301c
vue3 验证码,增加开关
Showing
3 changed files
with
14 additions
and
2 deletions
yudao-ui-admin-vue3/.env
yudao-ui-admin-vue3/src/views/Login/components/LoginForm.vue
| @@ -51,8 +51,8 @@ const LoginRules = { | @@ -51,8 +51,8 @@ const LoginRules = { | ||
| 51 | const loginLoading = ref(false) | 51 | const loginLoading = ref(false) |
| 52 | const loginData = reactive({ | 52 | const loginData = reactive({ |
| 53 | isShowPassword: false, | 53 | isShowPassword: false, |
| 54 | - captchaEnable: true, | ||
| 55 | - tenantEnable: true, | 54 | + captchaEnable: import.meta.env.VITE_APP_CAPTCHA_ENABLE, |
| 55 | + tenantEnable: import.meta.env.VITE_APP_TENANT_ENABLE, | ||
| 56 | token: '', | 56 | token: '', |
| 57 | loading: { | 57 | loading: { |
| 58 | signIn: false | 58 | signIn: false |
| @@ -71,6 +71,14 @@ const captchaType = ref('blockPuzzle') | @@ -71,6 +71,14 @@ const captchaType = ref('blockPuzzle') | ||
| 71 | 71 | ||
| 72 | // 获取验证码 | 72 | // 获取验证码 |
| 73 | const getCode = async () => { | 73 | const getCode = async () => { |
| 74 | + // 情况一,未开启:则直接登录 | ||
| 75 | + if (!loginData.captchaEnable) { | ||
| 76 | + await handleLogin({}) | ||
| 77 | + return | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + // 情况二,已开启:则展示验证码;只有完成验证码的情况,才进行登录 | ||
| 81 | + // 弹出验证码 | ||
| 74 | verify.value.show() | 82 | verify.value.show() |
| 75 | } | 83 | } |
| 76 | //获取租户ID | 84 | //获取租户ID |
yudao-ui-admin-vue3/types/env.d.ts
| @@ -11,6 +11,7 @@ interface ImportMetaEnv { | @@ -11,6 +11,7 @@ interface ImportMetaEnv { | ||
| 11 | readonly VITE_APP_TITLE: string | 11 | readonly VITE_APP_TITLE: string |
| 12 | readonly VITE_PORT: number | 12 | readonly VITE_PORT: number |
| 13 | readonly VITE_OPEN: boolean | 13 | readonly VITE_OPEN: boolean |
| 14 | + readonly VITE_APP_CAPTCHA_ENABLE: boolean | ||
| 14 | readonly VITE_APP_TENANT_ENABLE: boolean | 15 | readonly VITE_APP_TENANT_ENABLE: boolean |
| 15 | readonly VITE_BASE_URL: string | 16 | readonly VITE_BASE_URL: string |
| 16 | readonly VITE_UPLOAD_URL: string | 17 | readonly VITE_UPLOAD_URL: string |