From 0bca2d92db6af03c7af6137d81a00efe78ac2f21 Mon Sep 17 00:00:00 2001 From: wangyufei <2267742828@qq.com> Date: Mon, 29 Jul 2024 09:50:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=BF=81=E7=A7=BBalert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.prod | 4 ++++ public/systemConfig.js | 4 +++- src/utils/systemParam.ts | 23 +++++++++++++++++++++++ src/views/login/components/LoginForm.vue | 11 +++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/.env.prod b/.env.prod index cb7c3aa46..c269d3296 100644 --- a/.env.prod +++ b/.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/' diff --git a/public/systemConfig.js b/public/systemConfig.js index 1908c7089..c84fd37fb 100644 --- a/public/systemConfig.js +++ b/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/' } diff --git a/src/utils/systemParam.ts b/src/utils/systemParam.ts index 347b564dd..d165d58fa 100644 --- a/src/utils/systemParam.ts +++ b/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 + } +} + diff --git a/src/views/login/components/LoginForm.vue b/src/views/login/components/LoginForm.vue index 9409377c3..3fb492c08 100644 --- a/src/views/login/components/LoginForm.vue +++ b/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( + '系统迁移,请移步至' + + `${getSystermUpdateUrl()}`, + '重要提示', + { + dangerouslyUseHTMLString: true, + } + ) + } loginLoading.value = true try { await getTenantId()