2026-01-12 16:51:34 +08:00
|
|
|
import { useContext, useEffect, useRef, useState } from "react";
|
|
|
|
|
import { CSSTransition } from "react-transition-group";
|
2026-01-07 16:38:01 +08:00
|
|
|
import backImg1 from "~/assets/images/map_bi/back1.png";
|
|
|
|
|
import backImg2 from "~/assets/images/map_bi/back2.png";
|
2026-01-05 14:53:49 +08:00
|
|
|
import guangImg from "~/assets/images/map_bi/guang.png";
|
2026-01-07 16:38:01 +08:00
|
|
|
import topImg1 from "~/assets/images/map_bi/top1.png";
|
|
|
|
|
import topImg2 from "~/assets/images/map_bi/top2.png";
|
2026-01-05 14:53:49 +08:00
|
|
|
import { Context } from "~/pages/Container/Map/js/context";
|
|
|
|
|
import mitt from "~/pages/Container/Map/js/mitt";
|
|
|
|
|
import {
|
|
|
|
|
changePeopleTrajectorySelectVisibleMittKey,
|
|
|
|
|
clickBackMittKey,
|
|
|
|
|
clickBranchOfficePointMittKey,
|
|
|
|
|
clickPortPointMittKey,
|
|
|
|
|
deletePeoplePositionPointMittKey,
|
|
|
|
|
resetAllBottomUtilsCheckMittKey,
|
|
|
|
|
resetBottomCurrentIndexMittKey,
|
|
|
|
|
} from "~/pages/Container/Map/js/mittKey";
|
|
|
|
|
import "./index.less";
|
|
|
|
|
|
2026-01-12 16:51:34 +08:00
|
|
|
const animationTime = 1000;
|
2026-01-07 16:38:01 +08:00
|
|
|
function Header(props) {
|
2026-01-05 14:53:49 +08:00
|
|
|
const { currentPort, currentBranchOffice, mapMethods, area } = useContext(Context);
|
|
|
|
|
|
2026-01-12 16:51:34 +08:00
|
|
|
const [animationShow, setAnimationShow] = useState(false);
|
|
|
|
|
const [displayTitle, setDisplayTitle] = useState(props.headerTitle);
|
|
|
|
|
const timer = useRef(null);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setAnimationShow(false);
|
|
|
|
|
timer.current = setTimeout(() => {
|
|
|
|
|
setDisplayTitle(props.headerTitle);
|
|
|
|
|
setAnimationShow(true);
|
|
|
|
|
}, animationTime);
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
timer.current && clearTimeout(timer.current);
|
|
|
|
|
};
|
|
|
|
|
}, [props.headerTitle]);
|
|
|
|
|
|
2026-01-05 14:53:49 +08:00
|
|
|
const onBack = () => {
|
2026-01-07 16:38:01 +08:00
|
|
|
sessionStorage.removeItem("mapCurrentBranchOfficeId");
|
2026-01-05 14:53:49 +08:00
|
|
|
mitt.emit(deletePeoplePositionPointMittKey);
|
|
|
|
|
if (currentPort !== "00003" && currentBranchOffice) {
|
2026-01-07 16:38:01 +08:00
|
|
|
mitt.emit(clickPortPointMittKey, { id: "", name: "秦港股份" });
|
|
|
|
|
mitt.emit(clickBranchOfficePointMittKey, { id: "", corpName: "秦港股份" });
|
2026-01-05 14:53:49 +08:00
|
|
|
mapMethods.current.removeWall();
|
|
|
|
|
mapMethods.current.removeFourColorDiagram();
|
|
|
|
|
mapMethods.current.removeBranchOfficePoint();
|
|
|
|
|
mapMethods.current.removeMarkPoint();
|
|
|
|
|
mapMethods.current.flyTo();
|
|
|
|
|
mapMethods.current.addPortPoint();
|
|
|
|
|
}
|
|
|
|
|
else if (currentBranchOffice) {
|
2026-01-07 16:38:01 +08:00
|
|
|
mitt.emit(clickBranchOfficePointMittKey, { id: "", corpName: "秦港股份" });
|
2026-01-05 14:53:49 +08:00
|
|
|
mapMethods.current.removeBranchOfficePoint();
|
|
|
|
|
mapMethods.current.removeMarkPoint();
|
|
|
|
|
mapMethods.current.returnPreviousCenterPoint();
|
2026-01-12 16:51:34 +08:00
|
|
|
// setTimeout(() => {
|
|
|
|
|
mapMethods.current.addBranchOfficePoint(area);
|
|
|
|
|
// }, 2000);
|
2026-01-05 14:53:49 +08:00
|
|
|
}
|
|
|
|
|
else if (currentPort) {
|
2026-01-07 16:38:01 +08:00
|
|
|
mitt.emit(clickPortPointMittKey, { id: "", name: "秦港股份" });
|
2026-01-05 14:53:49 +08:00
|
|
|
mapMethods.current.removeWall();
|
|
|
|
|
mapMethods.current.removeFourColorDiagram();
|
|
|
|
|
mapMethods.current.removeBranchOfficePoint();
|
|
|
|
|
mapMethods.current.removeMarkPoint();
|
|
|
|
|
mapMethods.current.flyTo();
|
|
|
|
|
mapMethods.current.addPortPoint();
|
|
|
|
|
}
|
|
|
|
|
mitt.emit(resetBottomCurrentIndexMittKey);
|
|
|
|
|
mitt.emit(resetAllBottomUtilsCheckMittKey);
|
|
|
|
|
mitt.emit(clickBackMittKey);
|
|
|
|
|
mitt.emit(changePeopleTrajectorySelectVisibleMittKey, false);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
2026-01-08 11:27:19 +08:00
|
|
|
<div className="map_content_header_container">
|
2026-01-12 16:51:34 +08:00
|
|
|
<CSSTransition
|
|
|
|
|
timeout={animationTime}
|
|
|
|
|
classNames={{
|
|
|
|
|
enter: "animate__animated",
|
|
|
|
|
enterActive: "animate__animated animate__fadeInDown",
|
|
|
|
|
exit: "animate__animated",
|
|
|
|
|
exitActive: "animate__animated animate__fadeOutUp",
|
|
|
|
|
}}
|
|
|
|
|
unmountOnExit
|
|
|
|
|
in={animationShow}
|
2026-01-08 14:57:25 +08:00
|
|
|
>
|
2026-01-12 16:51:34 +08:00
|
|
|
<header
|
|
|
|
|
className={`${displayTitle === "秦港股份安全监管平台" ? "port" : "branch_office"}`}
|
|
|
|
|
style={{ backgroundImage: `url(${displayTitle === "秦港股份安全监管平台" ? topImg1 : topImg2})` }}
|
|
|
|
|
>
|
|
|
|
|
{(currentPort && displayTitle === "秦港股份安全监管平台") && (
|
|
|
|
|
<div style={{ backgroundImage: `url(${backImg1})` }} className="back" onClick={onBack} />
|
|
|
|
|
)}
|
|
|
|
|
{displayTitle !== "秦港股份安全监管平台" && (
|
|
|
|
|
<div className="back" onClick={onBack}>
|
|
|
|
|
<img src={backImg2} alt="" />
|
|
|
|
|
<div>返回</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
<div className="title">{displayTitle}</div>
|
|
|
|
|
<div style={{ backgroundImage: `url(${guangImg})` }} className="guang" />
|
|
|
|
|
</header>
|
|
|
|
|
</CSSTransition>
|
2026-01-05 14:53:49 +08:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Header;
|