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 | 51 | const loginLoading = ref(false) |
| 52 | 52 | const loginData = reactive({ |
| 53 | 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 | 56 | token: '', |
| 57 | 57 | loading: { |
| 58 | 58 | signIn: false |
| ... | ... | @@ -71,6 +71,14 @@ const captchaType = ref('blockPuzzle') |
| 71 | 71 | |
| 72 | 72 | // 获取验证码 |
| 73 | 73 | const getCode = async () => { |
| 74 | + // 情况一,未开启:则直接登录 | |
| 75 | + if (!loginData.captchaEnable) { | |
| 76 | + await handleLogin({}) | |
| 77 | + return | |
| 78 | + } | |
| 79 | + | |
| 80 | + // 情况二,已开启:则展示验证码;只有完成验证码的情况,才进行登录 | |
| 81 | + // 弹出验证码 | |
| 74 | 82 | verify.value.show() |
| 75 | 83 | } |
| 76 | 84 | //获取租户ID | ... | ... |
yudao-ui-admin-vue3/types/env.d.ts
| ... | ... | @@ -11,6 +11,7 @@ interface ImportMetaEnv { |
| 11 | 11 | readonly VITE_APP_TITLE: string |
| 12 | 12 | readonly VITE_PORT: number |
| 13 | 13 | readonly VITE_OPEN: boolean |
| 14 | + readonly VITE_APP_CAPTCHA_ENABLE: boolean | |
| 14 | 15 | readonly VITE_APP_TENANT_ENABLE: boolean |
| 15 | 16 | readonly VITE_BASE_URL: string |
| 16 | 17 | readonly VITE_UPLOAD_URL: string | ... | ... |