fix: 修改主应用配置

This commit is contained in:
NICE CODE BY DEV 2024-03-21 16:13:51 +08:00
parent 13bac87293
commit 9e1ee5c519
4 changed files with 19 additions and 75 deletions

View File

@ -16,29 +16,24 @@ export default defineConfig({
mfsu: false,
routes: [
{
name: '登录',
path: '/login',
component: '@/pages/login',
name: 'cabinet',
path: '/cabinet/*',
microApp: 'cabinet',
},
{
name: 'intelligent-file-cabinet',
path: '/intelligent-file-cabinet/*',
microApp: 'intelligent-file-cabinet',
name: 'algorithm',
path: '/algorithm/*',
microApp: 'algorithm',
},
{
name: 'algorithm-warehouse',
path: '/algorithm-warehouse/*',
microApp: 'algorithm-warehouse',
},
{
name: 'smart-video-analysis',
path: '/smart-video-analysis/*',
microApp: 'smart-video-analysis',
name: 'video',
path: '/video/*',
microApp: 'video',
},
{
name: '物料库',
path: '/communal-facilities-pages/*',
microApp: 'communal-facilities-pages',
path: '/material/*',
microApp: 'material',
},
],
npmClient: 'pnpm',

View File

@ -17,7 +17,6 @@
"@ant-design/icons": "^5.3.0",
"@ant-design/pro-components": "^2.6.49",
"@umijs/max": "^4.1.1",
"@zhst/communal-cabinet": "^0.3.0",
"@zhst/func": "^0.8.1",
"antd": "^5.14.1",
"cross-env": "^7.0.3"

View File

@ -30,38 +30,38 @@ const hostname = location.hostname;
export const qiankun = {
apps: [
{
name: 'intelligent-file-cabinet', // 盒子管理
name: 'cabinet', // 盒子管理
entry:
APP_ENV === 'production'
? `//${hostname}:30068/intelligent-file-cabinet/`
? `//${hostname}:30068/cabinet/`
: '//localhost:30068/',
props: {},
singular: false,
credentials: true,
},
{
name: 'smart-video-analysis', // AI 智能分析仓
name: 'video', // AI 智能分析仓
entry:
APP_ENV === 'production'
? `//${hostname}:30088/smart-video-analysis/`
? `//${hostname}:30088/video/`
: '//localhost:30088/',
singular: false,
credentials: true,
},
{
name: 'algorithm-warehouse', // AI 算法分析
name: 'algorithm', // AI 算法分析
entry:
APP_ENV === 'production'
? `//${hostname}:30078/algorithm-warehouse/`
? `//${hostname}:30078/algorithm/`
: '//localhost:30078/',
singular: false,
credentials: true,
},
{
name: 'communal-facilities-pages', // 物料库
name: 'material', // 物料库
entry:
APP_ENV === 'production'
? `//${hostname}:30098/communal-facilities-pages/`
? `//${hostname}:30098/material/`
: '//localhost:30098/',
singular: false,
credentials: true,

View File

@ -1,50 +0,0 @@
/**
* Created by dev on 2024/03/18
*/
import bg from '@/assets/ai-video.png';
import loginController from '@/services/login';
import { history, useModel, useRequest } from '@umijs/max';
import { Login } from '@zhst/communal-cabinet';
import { getValueByUrl } from '@zhst/func';
import { Spin } from 'antd';
import React from 'react';
const LoginPage = () => {
const { setGlobalState } = useModel('@@qiankunStateForSlave');
const { run, loading } = useRequest((params) => {
return loginController.login(params);
});
const handleFinish = (values: { account: string; password: string }) => {
run({ username: values.account, password: values.password }).then(
(res: any) => {
if (res.token) {
const baseUrl =
getValueByUrl('to', history.location.search) ||
getValueByUrl('from', history.location.search);
// @ts-ignore
let jumpUrlObj = new URL(baseUrl);
if (jumpUrlObj.origin === location.origin) {
history.push(`${baseUrl || '/'}?token=${res.token}`, res);
} else {
location.href = `${baseUrl}?token=${res.token}`;
}
setGlobalState(res);
}
},
);
};
return (
<Spin spinning={loading}>
<Login title="" imageUrl={bg} onFinish={handleFinish} />
</Spin>
);
};
export default LoginPage;