Browse Source

系统迁移alert

hella_online_20240829
wangyufei 4 months ago
parent
commit
0bca2d92db
  1. 4
      .env.prod
  2. 4
      public/systemConfig.js
  3. 23
      src/utils/systemParam.ts
  4. 11
      src/views/login/components/LoginForm.vue

4
.env.prod

@ -41,3 +41,7 @@ VITE_TENANT='["长春1379","成都1397","长春2379"]'
# 查看质检报告环境
VITE_REPORT_URL = 'http://dev.ccwin-in.com:25400'
# 登录系统升级的提示
VITE_SYSTERM_UPDATE_ALERT = true
VITE_SYSTERM_UPDATE_URL = 'https://scptest.faway-hella.com/'

4
public/systemConfig.js

@ -10,5 +10,7 @@ let systemConfig = {
// 查看质检报告环境
reportUrl: 'https://scp.faway-hella.com',
// 租户配置
tenant: '["成都"]'
tenant: '["成都"]',
systermUpdateAlert: true,
systermUpdateUrl: 'https://scptest.faway-hella.com/'
}

23
src/utils/systemParam.ts

@ -4,6 +4,9 @@ const interfaceUrl = ref(import.meta.env.VITE_INTERFACE_URL)
const jmreportBaseUrl = ref(import.meta.env.VITE_JMREPORT_BASE_URL)
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 mode = ref(import.meta.env.MODE)
// 获取baseUrl
export const getBaseUrl = () => {
@ -53,3 +56,23 @@ export const getTenant = () => {
return tenant.value
}
}
// 获取系统升级是否弹出alert
export const getSystermUpdateAlert = () => {
if(mode.value === 'prod') {
return systemConfig.systermUpdateAlert
} else {
return systermUpdateAlert.value
}
}
// 获取系统升级是否弹出alert地址
export const getSystermUpdateUrl = () => {
if(mode.value === 'prod') {
return systemConfig.systermUpdateUrl
} else {
return systermUpdateUrl.value
}
}

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

@ -96,6 +96,7 @@
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'
defineOptions({ name: 'LoginForm' })
@ -211,6 +212,16 @@
//
const handleLogin = async (params) => {
console.log('登录-185')
if(getSystermUpdateAlert()){
await ElMessageBox.alert(
'<strong>系统迁移,请移步至</strong>' +
`<a href=${getSystermUpdateUrl()} target="_blank">${getSystermUpdateUrl()}</a>`,
'重要提示',
{
dangerouslyUseHTMLString: true,
}
)
}
loginLoading.value = true
try {
await getTenantId()

Loading…
Cancel
Save