增加环境变量VITE_OUT_URL
This commit is contained in:
+2
-1
@@ -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:-}"
|
||||
};
|
||||
|
||||
// 冻结对象(可选,模拟生产行为)
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -17,6 +17,7 @@ export const useGlobSetting = (): Readonly<GlobConfig> => {
|
||||
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<GlobConfig> => {
|
||||
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<GlobConfig>;
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user