From 38f559ee5bca48432cc6b5d1265c5c7a36a26d79 Mon Sep 17 00:00:00 2001 From: wangyufei <2267742828@qq.com> Date: Fri, 16 Aug 2024 14:46:08 +0800 Subject: [PATCH] =?UTF-8?q?HL-4766=20=E5=9C=A8WMS=E7=9A=84=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E9=9D=A2=E5=92=8CPDA=E7=9A=84=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E9=9D=A2=E5=8F=96=E6=B6=88=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 +++ .env.prod | 3 +++ .env.test | 3 +++ .env.test-scp | 3 +++ src/api/login/index.ts | 4 +++- src/utils/systemParam.ts | 10 ++++++++++ src/views/login/components/LoginForm.vue | 15 ++++++++++++--- 7 files changed, 37 insertions(+), 4 deletions(-) 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()