|
|
|
|
@ -1,11 +1,13 @@
|
|
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
|
|
import { ResizeBox } from '@arco-design/web-react';
|
|
|
|
|
import { getUrlParams } from '@/utils/common';
|
|
|
|
|
import styles from './style/index.module.less';
|
|
|
|
|
import SideBar from './sideBar';
|
|
|
|
|
import LogBar from './logBar';
|
|
|
|
|
import RightSideBar from './rightSideBar';
|
|
|
|
|
import { getUrlParams } from '@/utils/common';
|
|
|
|
|
import NavBar from './navBar';
|
|
|
|
|
import ProjectContainer from '@/pages/orchestration/project';
|
|
|
|
|
import { ResizeBox } from '@arco-design/web-react';
|
|
|
|
|
import { menuData, menuData2 } from './config/menuData';
|
|
|
|
|
|
|
|
|
|
interface Selected {
|
|
|
|
|
currentPath?: string;
|
|
|
|
|
@ -40,7 +42,8 @@ function IDEContainer() {
|
|
|
|
|
|
|
|
|
|
// 根据选中的菜单项渲染对应组件
|
|
|
|
|
const renderContent = () => {
|
|
|
|
|
switch (selected.currentPath) {
|
|
|
|
|
const path = selected.currentPath;
|
|
|
|
|
switch (path) {
|
|
|
|
|
case 'appFlow':
|
|
|
|
|
return <ProjectContainer />;
|
|
|
|
|
case 'compList':
|
|
|
|
|
@ -73,6 +76,59 @@ function IDEContainer() {
|
|
|
|
|
setSubMenuWidth(width);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 根据identity获取对应的菜单数据
|
|
|
|
|
const getCurrentMenuData = () => {
|
|
|
|
|
switch (urlParams.identity) {
|
|
|
|
|
case 'scene':
|
|
|
|
|
return menuData;
|
|
|
|
|
case 'componentDevelopment':
|
|
|
|
|
return menuData2;
|
|
|
|
|
default:
|
|
|
|
|
return menuData;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 处理tab切换
|
|
|
|
|
const handleTabChange = (path: string) => {
|
|
|
|
|
if (path) {
|
|
|
|
|
// 根据path查找对应的菜单项
|
|
|
|
|
const findMenuItem = (menuItems: any[], path: string): any => {
|
|
|
|
|
for (const item of menuItems) {
|
|
|
|
|
if (item.path === path) {
|
|
|
|
|
return item;
|
|
|
|
|
}
|
|
|
|
|
if (item.children) {
|
|
|
|
|
const found = findMenuItem(item.children, path);
|
|
|
|
|
if (found) return found;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const menuItems = getCurrentMenuData();
|
|
|
|
|
const menuItem = findMenuItem(menuItems, path);
|
|
|
|
|
|
|
|
|
|
if (menuItem) {
|
|
|
|
|
setSelected({
|
|
|
|
|
currentPath: menuItem.path,
|
|
|
|
|
currentKey: '' // 这里可以优化为实际的key值
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// 没有激活的tab,重置selected状态
|
|
|
|
|
setSelected({});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 处理tab关闭
|
|
|
|
|
const handleTabClose = (path: string) => {
|
|
|
|
|
// 如果关闭的是当前激活的tab,则重置selected状态
|
|
|
|
|
if (path === selected.currentPath) {
|
|
|
|
|
setSelected({});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div className={styles.IDEContainer}>
|
|
|
|
|
@ -102,7 +158,16 @@ function IDEContainer() {
|
|
|
|
|
</ResizeBox>
|
|
|
|
|
|
|
|
|
|
<div className={styles.mainContent}>
|
|
|
|
|
{/*顶部导航栏*/}
|
|
|
|
|
<NavBar
|
|
|
|
|
selected={selected}
|
|
|
|
|
menuData={getCurrentMenuData()}
|
|
|
|
|
onTabChange={handleTabChange}
|
|
|
|
|
onTabClose={handleTabClose}
|
|
|
|
|
></NavBar>
|
|
|
|
|
{/*页面渲染*/}
|
|
|
|
|
{renderContent()}
|
|
|
|
|
{/*底部日志栏*/}
|
|
|
|
|
{urlParams.identity !== 'componentDevelopment' && <LogBar></LogBar>}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|