diff --git a/react-ui/config/config.ts b/react-ui/config/config.ts index 653f2a54..8d0e45d1 100644 --- a/react-ui/config/config.ts +++ b/react-ui/config/config.ts @@ -159,4 +159,19 @@ export default defineConfig({ javascriptEnabled: true, }, valtio: {}, + qiankun: { + master: { + sandbox: true, + apps: [ + { + name: 'app1', + entry: '//localhost:7001', + }, + { + name: 'app2', + entry: '//localhost:3000', + }, + ], + }, + }, }); diff --git a/react-ui/config/proxy.ts b/react-ui/config/proxy.ts index 35e82c68..1ecbb4b4 100644 --- a/react-ui/config/proxy.ts +++ b/react-ui/config/proxy.ts @@ -20,9 +20,9 @@ export default { // localhost:8000/api/** -> https://preview.pro.ant.design/api/** '/api/': { // 要代理的地址 - // target: 'http://172.20.32.197:31213', // 开发环境 - target: 'http://172.20.32.235:31213', // 测试环境 - // target: 'http://36.103.199.74:31213/', // 公网环境 + target: 'http://172.20.32.197:31213', // 开发环境 + // target: 'http://172.20.32.235:31213', // 测试环境 + // target: 'http://172.20.32.127:8082', // target: 'http://172.20.32.164:8082', // 配置了这个可以从 http 代理到 https // 依赖 origin 的功能可能需要这个,比如 cookie diff --git a/react-ui/config/routes.ts b/react-ui/config/routes.ts index 6a44437f..d1f7c046 100644 --- a/react-ui/config/routes.ts +++ b/react-ui/config/routes.ts @@ -607,6 +607,18 @@ export default [ }, ], }, + { + name: 'mixed', + path: '/mixed', + routes: [ + { + name: '父子页面混合', + path: '', + key: 'mixed', + component: './Mixed/index', + }, + ], + }, { name: '算力积分', path: '/points', @@ -619,6 +631,18 @@ export default [ }, ], }, + { + path: '/app1/*', + name: '子应用1', + microApp: 'app1', + layout: true, + }, + { + path: '/app2/*', + name: '子应用2', + microApp: 'app2', + layout: true, + }, { path: '*', layout: false, diff --git a/react-ui/package.json b/react-ui/package.json index 0ec8cbc9..5f317010 100644 --- a/react-ui/package.json +++ b/react-ui/package.json @@ -1,5 +1,5 @@ { - "name": "cl-model", + "name": "ci4s", "version": "1.0.0", "private": true, "description": "", diff --git a/react-ui/src/app.tsx b/react-ui/src/app.tsx index 2efbec58..1030c81a 100644 --- a/react-ui/src/app.tsx +++ b/react-ui/src/app.tsx @@ -4,6 +4,7 @@ import { type GlobalInitialState } from '@/types'; import { menuItemRender } from '@/utils/menuRender'; import type { Settings as LayoutSettings } from '@ant-design/pro-components'; import { RuntimeConfig, history } from '@umijs/max'; +import { useState } from 'react'; import { RuntimeAntdConfig } from 'umi'; import defaultSettings from '../config/defaultSettings'; import '../public/fonts/font.css'; @@ -173,6 +174,17 @@ export function render(oldRender: () => void) { }); } +export const useQiankunStateForSlave = () => { + const [globalState, setGlobalState] = useState({ + slogan: 'Hello MicroFrontend', + }); + + return { + globalState, + setGlobalState, + }; +}; + // 主题修改 export const antd: RuntimeAntdConfig = (memo) => { memo.theme ??= {}; diff --git a/react-ui/src/pages/Mixed/index.less b/react-ui/src/pages/Mixed/index.less new file mode 100644 index 00000000..911ec33c --- /dev/null +++ b/react-ui/src/pages/Mixed/index.less @@ -0,0 +1,3 @@ +.mixed { + height: 100%; +} diff --git a/react-ui/src/pages/Mixed/index.tsx b/react-ui/src/pages/Mixed/index.tsx new file mode 100644 index 00000000..c9d657d9 --- /dev/null +++ b/react-ui/src/pages/Mixed/index.tsx @@ -0,0 +1,25 @@ +import { MicroAppWithMemoHistory } from '@umijs/max'; +import { Tabs } from 'antd'; +import styles from './index.less'; + +const Docs = () => { + const mirrorTabItems = [ + { + key: '1', + label: '父页面', + children:
Parent
, + }, + { + key: '2', + label: '子页面', + children: , + }, + ]; + + return ( +
+ +
+ ); +}; +export default Docs; diff --git a/react-ui/src/pages/System/User/edit.tsx b/react-ui/src/pages/System/User/edit.tsx index fc5809f4..dc90e47c 100644 --- a/react-ui/src/pages/System/User/edit.tsx +++ b/react-ui/src/pages/System/User/edit.tsx @@ -63,6 +63,7 @@ const UserForm: React.FC = (props) => { loginIp: props.values.loginIp, loginDate: props.values.loginDate, remark: props.values.remark, + // gitLinkUsername: props.values.gitLinkUsername, // gitLinkPassword: props.values.gitLinkPassword, credit: props.values.credit, @@ -81,6 +82,7 @@ const UserForm: React.FC = (props) => { ...values, userId: props.values.userId, originPassword: props.values.originPassword, + uapId: props.values.uapId, }; props.onSubmit(params as UserFormData); }; diff --git a/react-ui/src/types/system/user.d.ts b/react-ui/src/types/system/user.d.ts index c129130c..79235374 100644 --- a/react-ui/src/types/system/user.d.ts +++ b/react-ui/src/types/system/user.d.ts @@ -23,6 +23,7 @@ declare namespace API.System { gitLinkPassword?: string; credit?: number; originPassword?: string; + uapId: string?; } export interface UserListParams {