| @@ -159,4 +159,19 @@ export default defineConfig({ | |||||
| javascriptEnabled: true, | javascriptEnabled: true, | ||||
| }, | }, | ||||
| valtio: {}, | valtio: {}, | ||||
| qiankun: { | |||||
| master: { | |||||
| sandbox: true, | |||||
| apps: [ | |||||
| { | |||||
| name: 'app1', | |||||
| entry: '//localhost:7001', | |||||
| }, | |||||
| { | |||||
| name: 'app2', | |||||
| entry: '//localhost:3000', | |||||
| }, | |||||
| ], | |||||
| }, | |||||
| }, | |||||
| }); | }); | ||||
| @@ -20,9 +20,9 @@ export default { | |||||
| // localhost:8000/api/** -> https://preview.pro.ant.design/api/** | // localhost:8000/api/** -> https://preview.pro.ant.design/api/** | ||||
| '/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', | // target: 'http://172.20.32.164:8082', | ||||
| // 配置了这个可以从 http 代理到 https | // 配置了这个可以从 http 代理到 https | ||||
| // 依赖 origin 的功能可能需要这个,比如 cookie | // 依赖 origin 的功能可能需要这个,比如 cookie | ||||
| @@ -607,6 +607,18 @@ export default [ | |||||
| }, | }, | ||||
| ], | ], | ||||
| }, | }, | ||||
| { | |||||
| name: 'mixed', | |||||
| path: '/mixed', | |||||
| routes: [ | |||||
| { | |||||
| name: '父子页面混合', | |||||
| path: '', | |||||
| key: 'mixed', | |||||
| component: './Mixed/index', | |||||
| }, | |||||
| ], | |||||
| }, | |||||
| { | { | ||||
| name: '算力积分', | name: '算力积分', | ||||
| path: '/points', | 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: '*', | path: '*', | ||||
| layout: false, | layout: false, | ||||
| @@ -1,5 +1,5 @@ | |||||
| { | { | ||||
| "name": "cl-model", | |||||
| "name": "ci4s", | |||||
| "version": "1.0.0", | "version": "1.0.0", | ||||
| "private": true, | "private": true, | ||||
| "description": "", | "description": "", | ||||
| @@ -4,6 +4,7 @@ import { type GlobalInitialState } from '@/types'; | |||||
| import { menuItemRender } from '@/utils/menuRender'; | import { menuItemRender } from '@/utils/menuRender'; | ||||
| import type { Settings as LayoutSettings } from '@ant-design/pro-components'; | import type { Settings as LayoutSettings } from '@ant-design/pro-components'; | ||||
| import { RuntimeConfig, history } from '@umijs/max'; | import { RuntimeConfig, history } from '@umijs/max'; | ||||
| import { useState } from 'react'; | |||||
| import { RuntimeAntdConfig } from 'umi'; | import { RuntimeAntdConfig } from 'umi'; | ||||
| import defaultSettings from '../config/defaultSettings'; | import defaultSettings from '../config/defaultSettings'; | ||||
| import '../public/fonts/font.css'; | import '../public/fonts/font.css'; | ||||
| @@ -173,6 +174,17 @@ export function render(oldRender: () => void) { | |||||
| }); | }); | ||||
| } | } | ||||
| export const useQiankunStateForSlave = () => { | |||||
| const [globalState, setGlobalState] = useState<any>({ | |||||
| slogan: 'Hello MicroFrontend', | |||||
| }); | |||||
| return { | |||||
| globalState, | |||||
| setGlobalState, | |||||
| }; | |||||
| }; | |||||
| // 主题修改 | // 主题修改 | ||||
| export const antd: RuntimeAntdConfig = (memo) => { | export const antd: RuntimeAntdConfig = (memo) => { | ||||
| memo.theme ??= {}; | memo.theme ??= {}; | ||||
| @@ -0,0 +1,3 @@ | |||||
| .mixed { | |||||
| height: 100%; | |||||
| } | |||||
| @@ -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: <div style={{ width: '100%', height: '100%', border: 0 }}>Parent</div>, | |||||
| }, | |||||
| { | |||||
| key: '2', | |||||
| label: '子页面', | |||||
| children: <MicroAppWithMemoHistory name="app1" url="/app1/home"></MicroAppWithMemoHistory>, | |||||
| }, | |||||
| ]; | |||||
| return ( | |||||
| <div className={styles.mixed}> | |||||
| <Tabs items={mirrorTabItems} /> | |||||
| </div> | |||||
| ); | |||||
| }; | |||||
| export default Docs; | |||||
| @@ -63,6 +63,7 @@ const UserForm: React.FC<UserFormProps> = (props) => { | |||||
| loginIp: props.values.loginIp, | loginIp: props.values.loginIp, | ||||
| loginDate: props.values.loginDate, | loginDate: props.values.loginDate, | ||||
| remark: props.values.remark, | remark: props.values.remark, | ||||
| // gitLinkUsername: props.values.gitLinkUsername, | // gitLinkUsername: props.values.gitLinkUsername, | ||||
| // gitLinkPassword: props.values.gitLinkPassword, | // gitLinkPassword: props.values.gitLinkPassword, | ||||
| credit: props.values.credit, | credit: props.values.credit, | ||||
| @@ -81,6 +82,7 @@ const UserForm: React.FC<UserFormProps> = (props) => { | |||||
| ...values, | ...values, | ||||
| userId: props.values.userId, | userId: props.values.userId, | ||||
| originPassword: props.values.originPassword, | originPassword: props.values.originPassword, | ||||
| uapId: props.values.uapId, | |||||
| }; | }; | ||||
| props.onSubmit(params as UserFormData); | props.onSubmit(params as UserFormData); | ||||
| }; | }; | ||||
| @@ -23,6 +23,7 @@ declare namespace API.System { | |||||
| gitLinkPassword?: string; | gitLinkPassword?: string; | ||||
| credit?: number; | credit?: number; | ||||
| originPassword?: string; | originPassword?: string; | ||||
| uapId: string?; | |||||
| } | } | ||||
| export interface UserListParams { | export interface UserListParams { | ||||