diff --git a/entrypoint.sh b/entrypoint.sh index d41c878..3956e8a 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -19,7 +19,8 @@ window['$CONFIG_VAR'] = { "VITE_GLOB_API_URL": "${VITE_GLOB_API_URL:-http://default-api.com}", "VITE_GLOB_DOMAIN_URL": "${VITE_GLOB_DOMAIN_URL:-http://default-domain.com}", "VITE_GLOB_ST_DOMAIN_URL": "${VITE_GLOB_ST_DOMAIN_URL:-http://default-domain.com}", - "VITE_GLOB_API_URL_PREFIX": "${VITE_GLOB_API_URL_PREFIX:-}" + "VITE_GLOB_API_URL_PREFIX": "${VITE_GLOB_API_URL_PREFIX:-}", + "VITE_OUT_URL": "${VITE_OUT_URL:-}" }; // 冻结对象(可选,模拟生产行为) diff --git a/src/components/Menu/src/BasicMenu.vue b/src/components/Menu/src/BasicMenu.vue index bf37b08..0d40e93 100644 --- a/src/components/Menu/src/BasicMenu.vue +++ b/src/components/Menu/src/BasicMenu.vue @@ -41,9 +41,11 @@ import { getAllParentPath } from '/@/router/helper/menuHelper'; import { usePermission } from '/@/hooks/web/usePermission'; import { defHttp } from '/@/utils/http/axios'; - import { getEnvInfo } from '/@/utils/getEnv'; + // import { getEnvInfo } from '/@/utils/getEnv'; import { getToken } from '/@/utils/auth'; import { useLoading } from '/@/components/Loading'; + import { useGlobSetting } from '/@/hooks/setting'; + const { viteOutUrl } = useGlobSetting(); export default defineComponent({ name: 'BasicMenu', @@ -128,7 +130,7 @@ async function handleMenuClick({ item, key }: { item: any; key: string; keyPath: string[] }) { if (item.title === '健康银行') { open(); - const url = getEnvInfo().VITE_GLOB_API_URL; + const url = viteOutUrl; await defHttp .get({ url: '/health-system/api/sys/encryptInfo', @@ -142,7 +144,7 @@ }) .then((res) => { console.log(res); - window.open(`${getEnvInfo().VITE_OUT_URL}${res.encryptData}`, '_blank'); + window.open(`${viteOutUrl}${res.encryptData}`, '_blank'); close(); }) .catch(() => { diff --git a/src/hooks/setting/index.ts b/src/hooks/setting/index.ts index d0d388b..2f6c925 100644 --- a/src/hooks/setting/index.ts +++ b/src/hooks/setting/index.ts @@ -17,6 +17,7 @@ export const useGlobSetting = (): Readonly => { VITE_GLOB_ONLINE_VIEW_URL, VITE_GLOB_ST_DOMAIN_URL, VITE_PLATFORM, + VITE_OUT_URL, } = getAppEnvConfig(); if (!/[a-zA-Z\_]*/.test(VITE_GLOB_APP_SHORT_NAME)) { @@ -40,6 +41,7 @@ export const useGlobSetting = (): Readonly => { viewUrl: VITE_GLOB_ONLINE_VIEW_URL, stDomainUrl: VITE_GLOB_ST_DOMAIN_URL, vitePlatform: VITE_PLATFORM, + viteOutUrl: VITE_OUT_URL, }; window._CONFIG['domianURL'] = VITE_GLOB_DOMAIN_URL; return glob as Readonly; diff --git a/src/utils/env.ts b/src/utils/env.ts index 417991c..a9515fb 100644 --- a/src/utils/env.ts +++ b/src/utils/env.ts @@ -34,6 +34,7 @@ export function getAppEnvConfig() { VITE_GLOB_ONLINE_VIEW_URL, VITE_GLOB_ST_DOMAIN_URL, VITE_PLATFORM, + VITE_OUT_URL, } = ENV; if (!/^[a-zA-Z\_]*$/.test(VITE_GLOB_APP_SHORT_NAME)) { // warn( @@ -55,6 +56,7 @@ export function getAppEnvConfig() { VITE_GLOB_ONLINE_VIEW_URL, VITE_GLOB_ST_DOMAIN_URL, VITE_PLATFORM, + VITE_OUT_URL, }; } diff --git a/types/config.d.ts b/types/config.d.ts index dffe80c..394b758 100644 --- a/types/config.d.ts +++ b/types/config.d.ts @@ -155,6 +155,7 @@ export interface GlobConfig { // Project abbreviation shortName: string; vitePlatform?: string; + viteOutUrl?: string; } export interface GlobEnvConfig { // Site title @@ -180,4 +181,5 @@ export interface GlobEnvConfig { VITE_GLOB_ONLINE_VIEW_URL?: string; VITE_GLOB_ST_DOMAIN_URL?: string; VITE_PLATFORM?: string; + VITE_OUT_URL?: string; }