Merge branch 'jzx/upgrade-onePort-20240423' into 'develop'
feat(app.ts): 兼容80端口 See merge request web-project/aircraft-carrier-fleet!14
This commit is contained in:
commit
a6da074b84
11
config/config.prod.ts
Normal file
11
config/config.prod.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { defineConfig } from '@umijs/max';
|
||||
|
||||
export default defineConfig({
|
||||
define: {
|
||||
APP_ENV: 'production',
|
||||
CABINET_HOST: '/cabinet/',
|
||||
VIDEO_HOST: '/video/',
|
||||
ALGORITHM_HOST: '/algorithm/',
|
||||
MATERIAL_HOST: '/material/',
|
||||
},
|
||||
});
|
@ -18,6 +18,7 @@ export default defineConfig({
|
||||
routes,
|
||||
npmClient: 'pnpm',
|
||||
define: {
|
||||
APP_ENV: process.env.NODE_ENV || 'production',
|
||||
APP_ENV: process.env.NODE_ENV || 'development',
|
||||
COMMON_URL: 'http://10.0.0.204:30058', // 基建服务
|
||||
},
|
||||
});
|
||||
|
4
global.d.ts
vendored
4
global.d.ts
vendored
@ -1 +1,5 @@
|
||||
declare const APP_ENV: string;
|
||||
declare const COMMON_URL: string;
|
||||
declare const VIDEO_HOST: string;
|
||||
declare const ALGORITHM_HOST: string;
|
||||
declare const MATERIAL_HOST: string;
|
||||
|
@ -18,6 +18,8 @@
|
||||
"@ant-design/pro-components": "^2.6.49",
|
||||
"@umijs/max": "^4.1.1",
|
||||
"@zhst/func": "^0.8.1",
|
||||
"@zhst/request": "^0.12.1",
|
||||
"@zhst/slave": "^0.7.1",
|
||||
"antd": "^5.14.1",
|
||||
"cross-env": "^7.0.3"
|
||||
},
|
||||
|
25
src/app.ts
25
src/app.ts
@ -1,4 +1,4 @@
|
||||
import doRequest from '@/utils/request';
|
||||
import { reqConfig } from '@zhst/request';
|
||||
import useFatherAction from './actions';
|
||||
|
||||
// 运行时配置
|
||||
@ -15,7 +15,10 @@ export async function getInitialState(): Promise<{
|
||||
// 给子应用暴露的方法
|
||||
export const useQiankunStateForSlave = useFatherAction;
|
||||
|
||||
const hostname = location.hostname;
|
||||
/**
|
||||
* 单端口模式 - 兼容 80 端口
|
||||
*/
|
||||
const hostname = location.port ? `${location.hostname}:${location.port}` : location.hostname
|
||||
|
||||
export const qiankun = {
|
||||
apps: [
|
||||
@ -23,8 +26,8 @@ export const qiankun = {
|
||||
name: 'cabinet', // 盒子管理
|
||||
entry:
|
||||
APP_ENV === 'production'
|
||||
? `//${hostname}:30068/cabinet/`
|
||||
: '//localhost:30068/',
|
||||
? `//${hostname}/cabinet/`
|
||||
: '//localhost:30088/',
|
||||
props: {},
|
||||
singular: false,
|
||||
credentials: true,
|
||||
@ -33,8 +36,8 @@ export const qiankun = {
|
||||
name: 'video', // AI 智能分析仓
|
||||
entry:
|
||||
APP_ENV === 'production'
|
||||
? `//${hostname}:30088/video/`
|
||||
: '//localhost:30088/',
|
||||
? `//${hostname}/video/`
|
||||
: '//localhost:30068/',
|
||||
singular: false,
|
||||
credentials: true,
|
||||
},
|
||||
@ -42,7 +45,7 @@ export const qiankun = {
|
||||
name: 'algorithm', // AI 算法分析
|
||||
entry:
|
||||
APP_ENV === 'production'
|
||||
? `//${hostname}:30078/algorithm/`
|
||||
? `//${hostname}/algorithm/`
|
||||
: '//localhost:30078/',
|
||||
singular: false,
|
||||
credentials: true,
|
||||
@ -51,7 +54,7 @@ export const qiankun = {
|
||||
name: 'material', // 物料库
|
||||
entry:
|
||||
APP_ENV === 'production'
|
||||
? `//${hostname}:30098/material/`
|
||||
? `//${hostname}/material/`
|
||||
: '//localhost:30098/',
|
||||
singular: false,
|
||||
credentials: true,
|
||||
@ -65,4 +68,8 @@ export const qiankun = {
|
||||
},
|
||||
};
|
||||
|
||||
export const request = doRequest;
|
||||
// @ts-ignore
|
||||
export const request = reqConfig({
|
||||
baseURL: COMMON_URL,
|
||||
showMsg: true,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user