2026-01-15 18:01:40 +08:00
|
|
|
import { motion } from "motion/react";
|
2026-01-08 14:57:25 +08:00
|
|
|
import { useContext, useState } from "react";
|
2026-01-07 16:38:01 +08:00
|
|
|
import collapseMenuImg1 from "~/assets/images/map_bi/content/collapse_menu1.png";
|
|
|
|
|
import collapseMenuImg2 from "~/assets/images/map_bi/content/collapse_menu2.png";
|
|
|
|
|
import collapseMenuBg1 from "~/assets/images/map_bi/content/collapse_menu_bg1.png";
|
|
|
|
|
import collapseMenuBg2 from "~/assets/images/map_bi/content/collapse_menu_bg2.png";
|
|
|
|
|
import { branchOfficeUtilsList } from "~/pages/Container/Map/components/BottomUtils/branchOfficeUtilsList";
|
2026-01-06 13:33:01 +08:00
|
|
|
import { portUtilsList } from "~/pages/Container/Map/components/BottomUtils/portUtilsList";
|
2026-01-14 14:56:00 +08:00
|
|
|
import BranchCamera from "~/pages/Container/Map/components/Content/branchOffice/Camera";
|
2026-01-09 16:40:53 +08:00
|
|
|
import BranchFengBi from "~/pages/Container/Map/components/Content/branchOffice/FengBi";
|
2026-01-08 14:57:25 +08:00
|
|
|
import BranchOfficeIndexLeft from "~/pages/Container/Map/components/Content/branchOffice/IndexLeft";
|
|
|
|
|
import BranchOfficeIndexRight from "~/pages/Container/Map/components/Content/branchOffice/IndexRight";
|
2026-01-09 09:10:49 +08:00
|
|
|
import BranchMenJin from "~/pages/Container/Map/components/Content/branchOffice/MenJin";
|
2026-01-09 14:48:39 +08:00
|
|
|
import BranchQiXiang from "~/pages/Container/Map/components/Content/branchOffice/QiXiang";
|
2026-01-09 11:41:52 +08:00
|
|
|
import BranchRenYuan from "~/pages/Container/Map/components/Content/branchOffice/RenYuan";
|
2026-01-08 16:12:58 +08:00
|
|
|
import BranchWeiXian from "~/pages/Container/Map/components/Content/branchOffice/WeiXian";
|
2026-01-09 10:30:14 +08:00
|
|
|
import BranchXiaoFang from "~/pages/Container/Map/components/Content/branchOffice/XiaoFang";
|
2026-01-09 16:16:01 +08:00
|
|
|
import BranchZhongDian from "~/pages/Container/Map/components/Content/branchOffice/ZhongDian";
|
2026-01-07 16:38:01 +08:00
|
|
|
import IndexInfo from "~/pages/Container/Map/components/Content/IndexInfo";
|
2026-01-07 14:03:14 +08:00
|
|
|
import PortFengBi from "~/pages/Container/Map/components/Content/port/FengBi";
|
2026-01-07 16:38:01 +08:00
|
|
|
import PortIndex from "~/pages/Container/Map/components/Content/port/Index";
|
2026-01-07 14:03:14 +08:00
|
|
|
import PortMenJin from "~/pages/Container/Map/components/Content/port/MenJin";
|
|
|
|
|
import PortQiXiang from "~/pages/Container/Map/components/Content/port/QiXiang";
|
|
|
|
|
import PortRenYuan from "~/pages/Container/Map/components/Content/port/RenYuan";
|
|
|
|
|
import PortWeiXian from "~/pages/Container/Map/components/Content/port/WeiXian";
|
|
|
|
|
import PortXiaoFang from "~/pages/Container/Map/components/Content/port/XiaoFang";
|
|
|
|
|
import PortZhongDian from "~/pages/Container/Map/components/Content/port/ZhongDian";
|
2026-01-05 14:53:49 +08:00
|
|
|
import { Context } from "~/pages/Container/Map/js/context";
|
2026-01-15 18:01:40 +08:00
|
|
|
import { useContentAnimation } from "./useContentAnimation";
|
2026-01-05 14:53:49 +08:00
|
|
|
import "./index.less";
|
|
|
|
|
|
|
|
|
|
function Content() {
|
|
|
|
|
const { currentPort, currentBranchOffice, pureMap, bottomUtilsCurrentIndex } = useContext(Context);
|
2026-01-08 14:57:25 +08:00
|
|
|
const [collapseLeft, setCollapseLeft] = useState(false);
|
|
|
|
|
const [collapseRight, setCollapseRight] = useState(false);
|
2026-01-05 14:53:49 +08:00
|
|
|
|
2026-01-15 18:01:40 +08:00
|
|
|
const {
|
|
|
|
|
controls: leftControls,
|
|
|
|
|
displayedContent: leftDisplayedContent,
|
|
|
|
|
isVisible: isLeftVisible,
|
|
|
|
|
handleCollapse: handleLeftCollapse,
|
|
|
|
|
} = useContentAnimation(
|
|
|
|
|
{ currentPort, currentBranchOffice, bottomUtilsCurrentIndex },
|
|
|
|
|
collapseLeft,
|
|
|
|
|
"left",
|
|
|
|
|
pureMap,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
controls: rightControls,
|
|
|
|
|
displayedContent: rightDisplayedContent,
|
|
|
|
|
isVisible: isRightVisible,
|
|
|
|
|
handleCollapse: handleRightCollapse,
|
|
|
|
|
} = useContentAnimation(
|
|
|
|
|
{ currentBranchOffice, bottomUtilsCurrentIndex },
|
|
|
|
|
collapseRight,
|
|
|
|
|
"right",
|
|
|
|
|
pureMap,
|
|
|
|
|
);
|
|
|
|
|
|
2026-01-05 14:53:49 +08:00
|
|
|
const renderPortContent = () => {
|
2026-01-15 18:01:40 +08:00
|
|
|
const bottomUtilsCurrentType = (leftDisplayedContent.bottomUtilsCurrentIndex !== -1 && portUtilsList[leftDisplayedContent.bottomUtilsCurrentIndex])
|
|
|
|
|
? portUtilsList[leftDisplayedContent.bottomUtilsCurrentIndex].type
|
|
|
|
|
: "";
|
2026-01-07 16:38:01 +08:00
|
|
|
if (bottomUtilsCurrentType === "" || bottomUtilsCurrentType === "camera")
|
|
|
|
|
return <PortIndex />;
|
|
|
|
|
if (bottomUtilsCurrentType === "door")
|
|
|
|
|
return <PortMenJin />;
|
|
|
|
|
if (bottomUtilsCurrentType === "fire")
|
|
|
|
|
return <PortXiaoFang />;
|
|
|
|
|
if (bottomUtilsCurrentType === "danger")
|
|
|
|
|
return <PortWeiXian />;
|
|
|
|
|
if (bottomUtilsCurrentType === "weather")
|
|
|
|
|
return <PortQiXiang />;
|
|
|
|
|
if (bottomUtilsCurrentType === "people")
|
|
|
|
|
return <PortRenYuan />;
|
|
|
|
|
if (bottomUtilsCurrentType === "project")
|
|
|
|
|
return <PortZhongDian />;
|
|
|
|
|
if (bottomUtilsCurrentType === "closedArea")
|
|
|
|
|
return <PortFengBi />;
|
|
|
|
|
};
|
|
|
|
|
|
2026-01-08 14:57:25 +08:00
|
|
|
const renderBranchOfficeContentLeft = () => {
|
2026-01-15 18:01:40 +08:00
|
|
|
const bottomUtilsCurrentType = (leftDisplayedContent.bottomUtilsCurrentIndex !== -1 && branchOfficeUtilsList[leftDisplayedContent.bottomUtilsCurrentIndex])
|
|
|
|
|
? branchOfficeUtilsList[leftDisplayedContent.bottomUtilsCurrentIndex].type
|
|
|
|
|
: "";
|
2026-01-08 16:12:58 +08:00
|
|
|
if (bottomUtilsCurrentType === "")
|
2026-01-08 14:57:25 +08:00
|
|
|
return <BranchOfficeIndexLeft />;
|
2026-01-08 16:12:58 +08:00
|
|
|
if (bottomUtilsCurrentType === "danger")
|
|
|
|
|
return <BranchWeiXian />;
|
2026-01-09 09:10:49 +08:00
|
|
|
if (bottomUtilsCurrentType === "door")
|
|
|
|
|
return <BranchMenJin />;
|
2026-01-09 10:30:14 +08:00
|
|
|
if (bottomUtilsCurrentType === "fire")
|
|
|
|
|
return <BranchXiaoFang />;
|
2026-01-09 11:41:52 +08:00
|
|
|
if (bottomUtilsCurrentType === "people")
|
|
|
|
|
return <BranchRenYuan />;
|
2026-01-09 14:48:39 +08:00
|
|
|
if (bottomUtilsCurrentType === "weather")
|
|
|
|
|
return <BranchQiXiang />;
|
2026-01-09 16:16:01 +08:00
|
|
|
if (bottomUtilsCurrentType === "project")
|
|
|
|
|
return <BranchZhongDian />;
|
2026-01-09 16:40:53 +08:00
|
|
|
if (bottomUtilsCurrentType === "closedArea")
|
|
|
|
|
return <BranchFengBi />;
|
2026-01-14 14:56:00 +08:00
|
|
|
if (bottomUtilsCurrentType === "camera")
|
|
|
|
|
return <BranchCamera />;
|
2026-01-08 14:57:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const renderBranchOfficeContentRight = () => {
|
2026-01-15 18:01:40 +08:00
|
|
|
const bottomUtilsCurrentType = (rightDisplayedContent.bottomUtilsCurrentIndex !== -1 && branchOfficeUtilsList[rightDisplayedContent.bottomUtilsCurrentIndex])
|
|
|
|
|
? branchOfficeUtilsList[rightDisplayedContent.bottomUtilsCurrentIndex].type
|
|
|
|
|
: "";
|
2026-01-08 16:12:58 +08:00
|
|
|
if (bottomUtilsCurrentType === "")
|
2026-01-08 14:57:25 +08:00
|
|
|
return <BranchOfficeIndexRight />;
|
2026-01-05 14:53:49 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const renderContent = () => {
|
|
|
|
|
return (
|
2026-01-08 14:57:25 +08:00
|
|
|
<>
|
2026-01-16 14:53:53 +08:00
|
|
|
{!leftDisplayedContent.currentPort && (<IndexInfo />)}
|
2026-01-15 18:01:40 +08:00
|
|
|
{isLeftVisible && (
|
|
|
|
|
<motion.div
|
|
|
|
|
animate={leftControls}
|
|
|
|
|
className={`map_content_container__content ${(!leftDisplayedContent.currentPort || (leftDisplayedContent.currentPort === "00003" && !leftDisplayedContent.currentBranchOffice)) ? "port" : "branch_office"}`}
|
2026-01-08 14:57:25 +08:00
|
|
|
style={{ left: 35 }}
|
|
|
|
|
>
|
2026-01-15 18:01:40 +08:00
|
|
|
{(leftDisplayedContent.currentPort === "00003" && !leftDisplayedContent.currentBranchOffice) && renderPortContent()}
|
|
|
|
|
{leftDisplayedContent.currentBranchOffice && renderBranchOfficeContentLeft()}
|
|
|
|
|
</motion.div>
|
2026-01-08 14:57:25 +08:00
|
|
|
)}
|
2026-01-15 18:01:40 +08:00
|
|
|
{isRightVisible && (
|
|
|
|
|
<motion.div
|
|
|
|
|
animate={rightControls}
|
|
|
|
|
className={`map_content_container__content ${(!leftDisplayedContent.currentPort || (leftDisplayedContent.currentPort === "00003" && !leftDisplayedContent.currentBranchOffice)) ? "port" : "branch_office"}`}
|
2026-01-08 14:57:25 +08:00
|
|
|
style={{ right: 35 }}
|
|
|
|
|
>
|
2026-01-15 18:01:40 +08:00
|
|
|
{rightDisplayedContent.currentBranchOffice && renderBranchOfficeContentRight()}
|
|
|
|
|
</motion.div>
|
2026-01-08 14:57:25 +08:00
|
|
|
)}
|
|
|
|
|
</>
|
2026-01-05 14:53:49 +08:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2026-01-07 13:51:33 +08:00
|
|
|
const renderCollapseMenu = () => {
|
|
|
|
|
if (pureMap)
|
|
|
|
|
return null;
|
2026-01-08 14:57:25 +08:00
|
|
|
|
2026-01-07 16:38:01 +08:00
|
|
|
if (currentPort === "00003" && !currentBranchOffice) {
|
|
|
|
|
return (
|
|
|
|
|
<div
|
2026-01-08 14:57:25 +08:00
|
|
|
className={`collapse_menu port left ${collapseLeft ? "active" : ""}`}
|
2026-01-07 16:38:01 +08:00
|
|
|
style={{ backgroundImage: `url(${collapseMenuBg1})` }}
|
2026-01-15 18:01:40 +08:00
|
|
|
onClick={() => handleLeftCollapse(setCollapseLeft)}
|
2026-01-07 16:38:01 +08:00
|
|
|
>
|
|
|
|
|
<img src={collapseMenuImg1} alt="" />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2026-01-08 14:57:25 +08:00
|
|
|
|
2026-01-07 16:38:01 +08:00
|
|
|
if (currentBranchOffice) {
|
2026-01-14 14:56:00 +08:00
|
|
|
const bottomUtilsCurrentType = bottomUtilsCurrentIndex !== -1 ? branchOfficeUtilsList[bottomUtilsCurrentIndex].type : "";
|
|
|
|
|
|
2026-01-07 13:51:33 +08:00
|
|
|
return (
|
2026-01-08 14:57:25 +08:00
|
|
|
<>
|
2026-01-14 14:56:00 +08:00
|
|
|
{bottomUtilsCurrentType !== "camera" && (
|
|
|
|
|
<div
|
|
|
|
|
className={`collapse_menu branch_office left ${collapseLeft ? "active" : ""}`}
|
|
|
|
|
style={{ backgroundImage: `url(${collapseMenuBg2})` }}
|
2026-01-15 18:01:40 +08:00
|
|
|
onClick={() => handleLeftCollapse(setCollapseLeft)}
|
2026-01-14 14:56:00 +08:00
|
|
|
>
|
|
|
|
|
<img src={collapseMenuImg2} alt="" />
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-01-08 14:57:25 +08:00
|
|
|
{bottomUtilsCurrentIndex === -1 && (
|
|
|
|
|
<div
|
|
|
|
|
className={`collapse_menu branch_office right ${collapseRight ? "active" : ""}`}
|
|
|
|
|
style={{ backgroundImage: `url(${collapseMenuBg2})` }}
|
2026-01-15 18:01:40 +08:00
|
|
|
onClick={() => handleRightCollapse(setCollapseRight)}
|
2026-01-08 14:57:25 +08:00
|
|
|
>
|
|
|
|
|
<img src={collapseMenuImg2} alt="" />
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</>
|
2026-01-07 13:51:33 +08:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-01-05 14:53:49 +08:00
|
|
|
return (
|
|
|
|
|
<div className="map_content_container">
|
2026-01-08 14:57:25 +08:00
|
|
|
{renderContent()}
|
|
|
|
|
{renderCollapseMenu()}
|
2026-01-05 14:53:49 +08:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Content;
|