76 lines
1.7 KiB
TypeScript
76 lines
1.7 KiB
TypeScript
import { reqConfig } from '@zhst/request';
|
|
import useFatherAction from './actions';
|
|
|
|
// 运行时配置
|
|
export async function getInitialState(): Promise<{
|
|
name: string;
|
|
useLogin: boolean;
|
|
}> {
|
|
return {
|
|
name: '主应用',
|
|
useLogin: false,
|
|
};
|
|
}
|
|
|
|
// 给子应用暴露的方法
|
|
export const useQiankunStateForSlave = useFatherAction;
|
|
|
|
/**
|
|
* 单端口模式 - 兼容 80 端口
|
|
*/
|
|
const hostname = location.port ? `${location.hostname}:${location.port}` : location.hostname
|
|
|
|
export const qiankun = {
|
|
apps: [
|
|
{
|
|
name: 'cabinet', // 盒子管理
|
|
entry:
|
|
APP_ENV === 'production'
|
|
? `//${hostname}/cabinet/`
|
|
: '//localhost:30088/',
|
|
props: {},
|
|
singular: false,
|
|
credentials: true,
|
|
},
|
|
{
|
|
name: 'video', // AI 智能分析仓
|
|
entry:
|
|
APP_ENV === 'production'
|
|
? `//${hostname}/video/`
|
|
: '//localhost:30068/',
|
|
singular: false,
|
|
credentials: true,
|
|
},
|
|
{
|
|
name: 'algorithm', // AI 算法分析
|
|
entry:
|
|
APP_ENV === 'production'
|
|
? `//${hostname}/algorithm/`
|
|
: '//localhost:30078/',
|
|
singular: false,
|
|
credentials: true,
|
|
},
|
|
{
|
|
name: 'material', // 物料库
|
|
entry:
|
|
APP_ENV === 'production'
|
|
? `//${hostname}/material/`
|
|
: '//localhost:30098/',
|
|
singular: false,
|
|
credentials: true,
|
|
},
|
|
],
|
|
lifeCycles: {
|
|
// 所有子应用在挂载完成时,打印 props 信息
|
|
async afterMount() {
|
|
// console.log('子应用已全部加载:', props);
|
|
},
|
|
},
|
|
};
|
|
|
|
// @ts-ignore
|
|
export const request = reqConfig({
|
|
baseURL: COMMON_URL,
|
|
showMsg: true,
|
|
});
|