import { useContext, useState } from "react"; 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"; import { portUtilsList } from "~/pages/Container/Map/components/BottomUtils/portUtilsList"; import BranchOfficeIndexLeft from "~/pages/Container/Map/components/Content/branchOffice/IndexLeft"; import BranchOfficeIndexRight from "~/pages/Container/Map/components/Content/branchOffice/IndexRight"; import BranchMenJin from "~/pages/Container/Map/components/Content/branchOffice/MenJin"; import BranchQiXiang from "~/pages/Container/Map/components/Content/branchOffice/QiXiang"; import BranchRenYuan from "~/pages/Container/Map/components/Content/branchOffice/RenYuan"; import BranchWeiXian from "~/pages/Container/Map/components/Content/branchOffice/WeiXian"; import BranchXiaoFang from "~/pages/Container/Map/components/Content/branchOffice/XiaoFang"; import IndexInfo from "~/pages/Container/Map/components/Content/IndexInfo"; import PortFengBi from "~/pages/Container/Map/components/Content/port/FengBi"; import PortIndex from "~/pages/Container/Map/components/Content/port/Index"; 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"; import { Context } from "~/pages/Container/Map/js/context"; import "./index.less"; function Content() { const { currentPort, currentBranchOffice, pureMap, bottomUtilsCurrentIndex } = useContext(Context); const [collapseLeft, setCollapseLeft] = useState(false); const [collapseRight, setCollapseRight] = useState(false); const renderPortContent = () => { const bottomUtilsCurrentType = bottomUtilsCurrentIndex !== -1 ? portUtilsList[bottomUtilsCurrentIndex].type : ""; if (bottomUtilsCurrentType === "" || bottomUtilsCurrentType === "camera") return ; if (bottomUtilsCurrentType === "door") return ; if (bottomUtilsCurrentType === "fire") return ; if (bottomUtilsCurrentType === "danger") return ; if (bottomUtilsCurrentType === "weather") return ; if (bottomUtilsCurrentType === "people") return ; if (bottomUtilsCurrentType === "project") return ; if (bottomUtilsCurrentType === "closedArea") return ; }; const renderBranchOfficeContentLeft = () => { const bottomUtilsCurrentType = bottomUtilsCurrentIndex !== -1 ? branchOfficeUtilsList[bottomUtilsCurrentIndex].type : ""; if (bottomUtilsCurrentType === "") return ; if (bottomUtilsCurrentType === "danger") return ; if (bottomUtilsCurrentType === "door") return ; if (bottomUtilsCurrentType === "fire") return ; if (bottomUtilsCurrentType === "people") return ; if (bottomUtilsCurrentType === "weather") return ; }; const renderBranchOfficeContentRight = () => { const bottomUtilsCurrentType = bottomUtilsCurrentIndex !== -1 ? branchOfficeUtilsList[bottomUtilsCurrentIndex].type : ""; if (bottomUtilsCurrentType === "") return ; }; const renderContent = () => { if (pureMap) return null; return ( <> {!collapseLeft && (
{!currentPort && } {(currentPort === "00003" && !currentBranchOffice) && renderPortContent()} {currentBranchOffice && renderBranchOfficeContentLeft()}
)} {!collapseRight && (
{currentBranchOffice && renderBranchOfficeContentRight()}
)} ); }; const renderCollapseMenu = () => { if (pureMap) return null; if (currentPort === "00003" && !currentBranchOffice) { return (
{ setCollapseLeft(!collapseLeft); }} >
); } if (currentBranchOffice) { return ( <>
{ setCollapseLeft(!collapseLeft); }} >
{bottomUtilsCurrentIndex === -1 && (
{ setCollapseRight(!collapseRight); }} >
)} ); } }; return (
{renderContent()} {renderCollapseMenu()}
); } export default Content;