diff --git a/.env.development b/.env.development index 13dee5d41..bed5e9cb9 100644 --- a/.env.development +++ b/.env.development @@ -41,3 +41,6 @@ VITE_TENANT='["长春1379","成都1397","长春2379"]' # 查看质检报告环境 VITE_REPORT_URL = 'http://dev.ccwin-in.com:25400' + +# 是否需要验证码 +VITE_NEED_CODE = true diff --git a/.env.prod b/.env.prod index c269d3296..be6b9a31d 100644 --- a/.env.prod +++ b/.env.prod @@ -45,3 +45,6 @@ VITE_REPORT_URL = 'http://dev.ccwin-in.com:25400' # 登录系统升级的提示 VITE_SYSTERM_UPDATE_ALERT = true VITE_SYSTERM_UPDATE_URL = 'https://scptest.faway-hella.com/' + +# 是否需要验证码 +VITE_NEED_CODE = true diff --git a/.env.test b/.env.test index 314cbd94e..c58a58c21 100644 --- a/.env.test +++ b/.env.test @@ -41,3 +41,6 @@ VITE_TENANT='["长春","成都"]' # 查看质检报告环境 VITE_REPORT_URL = 'http://dev.ccwin-in.com:25400' + +# 是否需要验证码 +VITE_NEED_CODE = true diff --git a/.env.test-scp b/.env.test-scp index 9c02faed0..8bb0eb982 100644 --- a/.env.test-scp +++ b/.env.test-scp @@ -42,3 +42,6 @@ VITE_TENANT='["长春1379","成都1397","长春2379"]' # 查看质检报告环境 VITE_REPORT_URL = 'http://dev.ccwin-in.com:25400' + +# 是否需要验证码 +VITE_NEED_CODE = false diff --git a/src/api/login/index.ts b/src/api/login/index.ts index 444f0f27c..d6a7af2a5 100644 --- a/src/api/login/index.ts +++ b/src/api/login/index.ts @@ -16,7 +16,9 @@ export interface SmsLoginVO { export const login = (data: UserLoginVO) => { return request.post({ url: '/system/auth/login', data }) } - +export const loginNoCode = (data: UserLoginVO) => { + return request.post({ url: '/system/auth/loginNoCode', data }) +} // 刷新访问令牌 export const refreshToken = () => { return request.post({ url: '/system/auth/refresh-token?refreshToken=' + getRefreshToken() }) diff --git a/src/utils/systemParam.ts b/src/utils/systemParam.ts index d165d58fa..3341cd539 100644 --- a/src/utils/systemParam.ts +++ b/src/utils/systemParam.ts @@ -6,6 +6,7 @@ const reportUrl = ref(import.meta.env.VITE_REPORT_URL) const tenant = ref(import.meta.env.VITE_TENANT) const systermUpdateAlert = ref(import.meta.env.VITE_SYSTERM_UPDATE_ALERT) const systermUpdateUrl = ref(import.meta.env.VITE_SYSTERM_UPDATE_URL) +const needCode = ref(import.meta.env.VITE_NEED_CODE) const mode = ref(import.meta.env.MODE) // 获取baseUrl @@ -75,4 +76,13 @@ export const getSystermUpdateUrl = () => { return systermUpdateUrl.value } } +//是否需要验证码 +export const getNeedCode = () => { + if(mode.value === 'prod') { + return systemConfig.needCode + } else { + return needCode.value + } +} + diff --git a/src/views/login/components/LoginForm.vue b/src/views/login/components/LoginForm.vue index 3fecca561..7751297e1 100644 --- a/src/views/login/components/LoginForm.vue +++ b/src/views/login/components/LoginForm.vue @@ -33,7 +33,7 @@ :prefix-icon="iconLock" show-password type="password" @keyup.enter="getCode()" style="height: 42px;" /> - +
{ captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled; if (captchaEnabled.value) { @@ -229,7 +233,12 @@ if (!data) { return } - const res = await LoginApi.login(loginData.loginForm) + let res = null + if(needCode.value=='false'){ + res = await LoginApi.loginNoCode(loginData.loginForm) + }else{ + res = await LoginApi.login(loginData.loginForm) + } if (!res) { console.log('登录-195') getCode()