From 3dbf1ccac601794588988575a8cc20f0972101cc Mon Sep 17 00:00:00 2001 From: ZLY Date: Fri, 10 Oct 2025 16:03:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(ideContainer):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=B5=8B=E8=AF=95=E9=A1=B5=E9=9D=A2=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=84=E4=BB=B6=E6=B8=B2=E6=9F=93=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 引入 ComponentTest 组件并移除原有占位实现 - 新增获取项目组件数据逻辑并更新至 Redux - 调整组件渲染条件以匹配选中状态 - 优化容器样式以确保正确布局显示 - 同步加载应用列表与项目组件数据 --- src/pages/ideContainer/index.tsx | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/pages/ideContainer/index.tsx b/src/pages/ideContainer/index.tsx index ba1f91c..603e889 100644 --- a/src/pages/ideContainer/index.tsx +++ b/src/pages/ideContainer/index.tsx @@ -6,9 +6,10 @@ import LogBar from './logBar'; import RightSideBar from './rightSideBar'; import NavBar, { NavBarRef } from './navBar'; import { Selected } from '@/pages/ideContainer/types'; -import { updateInfo } from '@/store/ideContainer'; +import { updateInfo, updateProjectComponentData } from '@/store/ideContainer'; import { useDispatch, useSelector } from 'react-redux'; import { getAppListBySceneId } from '@/api/apps'; +import { getProjectComp } from '@/api/scene'; import ProjectContainer from '@/pages/orchestration/project'; import ApplicationContainer from '@/pages/orchestration/application'; @@ -18,6 +19,8 @@ import AppCompComponent from '@/pages/orchestration/appCompComponent'; import ComponentList from '@/pages/componentDevelopment/componentList'; import ComponentCoding from '@/pages/componentDevelopment/componentCoding'; import ComponentDeployment from '@/pages/componentDevelopment/componentDeployment'; +import ComponentTest from '@/pages/componentDevelopment/componentTest'; + type UrlParamsOptions = { identity?: string; @@ -29,7 +32,6 @@ const AppInstanceComponent = () =>
我的组件
; const MatchingComponents = () =>
协同组件
; const ComponentReview = () =>
组件审核
; -const ComponentTest = () =>
组件测试
; const EnvConfig = () =>
环境配置
; // 所有可显示的组件路径列表 @@ -59,6 +61,11 @@ function IDEContainer() { if (res.code === 200) setSubMenuData({ 'appList': res.data.list.reverse() }); }; + const getProjectCompData = async () => { + const res: any = await getProjectComp(urlParams.id); + if (res.code === 200) dispatch(updateProjectComponentData({ [urlParams.id]: res.data })); + }; + useEffect(() => { setUrlParams(getUrlParams(window.location.href) as UrlParamsOptions); dispatch(updateInfo(getUrlParams(window.location.href) as UrlParamsOptions)); @@ -66,7 +73,10 @@ function IDEContainer() { }, []); useEffect(() => { - if (urlParams.id) getAppList(); + if (urlParams.id) { + getProjectCompData(); + getAppList(); + } }, [urlParams.id]); // 当selected.path变化时,添加到已打开的tab集合中 @@ -79,15 +89,15 @@ function IDEContainer() { // 根据选中的菜单项渲染对应组件 const renderContent = () => { return ( -
+
{ALL_PATHS.map((path, i) => { // 检查该路径的组件是否已打开 - const isOpened = openedTabs.has(path); + const isOpened = openedTabs.has(selected.key); // 检查是否是当前选中的路径 const isSelected = selected.path === path; - // 只有已打开的组件才渲染,通过CSS控制显示/隐藏 - return isOpened ? ( + // 只有已打开且已经选中的组件才渲染,通过CSS控制显示/隐藏 + return isOpened && isSelected ? (