Browse Source

HL-4766 在WMS的登录页面和PDA的登录页面取消验证码功能

hella_online_20240819
wangyufei 3 months ago
parent
commit
38f559ee5b
  1. 3
      .env.development
  2. 3
      .env.prod
  3. 3
      .env.test
  4. 3
      .env.test-scp
  5. 4
      src/api/login/index.ts
  6. 10
      src/utils/systemParam.ts
  7. 15
      src/views/login/components/LoginForm.vue

3
.env.development

@ -41,3 +41,6 @@ VITE_TENANT='["长春1379","成都1397","长春2379"]'
# 查看质检报告环境
VITE_REPORT_URL = 'http://dev.ccwin-in.com:25400'
# 是否需要验证码
VITE_NEED_CODE = true

3
.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

3
.env.test

@ -41,3 +41,6 @@ VITE_TENANT='["长春","成都"]'
# 查看质检报告环境
VITE_REPORT_URL = 'http://dev.ccwin-in.com:25400'
# 是否需要验证码
VITE_NEED_CODE = true

3
.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

4
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() })

10
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
}
}

15
src/views/login/components/LoginForm.vue

@ -33,7 +33,7 @@
:prefix-icon="iconLock" show-password type="password" @keyup.enter="getCode()" style="height: 42px;" />
</el-form-item>
</el-col>
<el-col :span="24" style="padding-right: 10px; padding-left: 10px">
<el-col :span="24" style="padding-right: 10px; padding-left: 10px" v-if="needCode!='false'">
<el-form-item prop="code">
<div class="flex w-[100%]">
<el-input v-model="loginData.loginForm.code" :placeholder="t('login.codePlaceholder')"
@ -96,7 +96,8 @@
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import * as DeptApi from '@/api/system/dept'
import { getTenant } from '@/utils/systemParam'
import { getSystermUpdateAlert,getSystermUpdateUrl } from '@/utils/systemParam'
import { getSystermUpdateAlert,getSystermUpdateUrl,getNeedCode } from '@/utils/systemParam'
const needCode = ref(getNeedCode())
defineOptions({ name: 'LoginForm' })
@ -173,6 +174,9 @@
// }
// }
function getCode() {
if(needCode.value=='false'){
return
}
getCodeImg().then(res => {
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()

Loading…
Cancel
Save