diff --git a/src/pages/Container/Map/components/BottomUtils/index.js b/src/pages/Container/Map/components/BottomUtils/index.js index 889a4d2..dc81854 100644 --- a/src/pages/Container/Map/components/BottomUtils/index.js +++ b/src/pages/Container/Map/components/BottomUtils/index.js @@ -1,4 +1,5 @@ import { useContext, useEffect, useState } from "react"; +import { CSSTransition } from "react-transition-group"; import bg7 from "~/assets/images/map_bi/bottom_utils/bg7.png"; import bg8 from "~/assets/images/map_bi/bottom_utils/bg8.png"; import titleImg from "~/assets/images/map_bi/bottom_utils/title.png"; @@ -91,7 +92,17 @@ function BottomUtils(props) { onClick={() => optionsClick(index)} >
{item.label}
- {(isCurrentActive && item.list?.length > 0) && ( + 0)} + >
{item.list?.map((item1, index1) => (
))}
- )} +
); })} diff --git a/src/pages/Container/Map/components/CenterUtils/index.js b/src/pages/Container/Map/components/CenterUtils/index.js index 3f54f60..00ef68f 100644 --- a/src/pages/Container/Map/components/CenterUtils/index.js +++ b/src/pages/Container/Map/components/CenterUtils/index.js @@ -1,4 +1,5 @@ import { useContext, useState } from "react"; +import { CSSTransition } from "react-transition-group"; import statisticsTitleImg from "~/assets/images/map_bi/center_utils/statistics_title.png"; import guangImg from "~/assets/images/map_bi/center_utils/tabguang.png"; import tabLeftImg from "~/assets/images/map_bi/center_utils/tableft.png"; @@ -27,6 +28,8 @@ function CenterUtils(props) { const [activeIndex, setActiveIndex] = useState(1); const onChangeArea = (index) => { + if (index === activeIndex) + return; setActiveIndex(index); props.setArea(list[index].area); mapMethods.current.removeBranchOfficePoint(); @@ -38,7 +41,17 @@ function CenterUtils(props) { return (
- {(currentPort === "00003" && !currentBranchOffice && !pureMap) && ( +
- {(activeIndex === 0 || activeIndex === 1) && ( +
西港区
@@ -69,8 +92,18 @@ function CenterUtils(props) {
车辆:33辆
- )} - {(activeIndex === 2 || activeIndex === 1) && ( +
+
东港区
@@ -78,10 +111,10 @@ function CenterUtils(props) {
车辆:33辆
- )} +
- )} +
); } diff --git a/src/pages/Container/Map/components/Header/index.js b/src/pages/Container/Map/components/Header/index.js index 351ae0a..28b7e99 100644 --- a/src/pages/Container/Map/components/Header/index.js +++ b/src/pages/Container/Map/components/Header/index.js @@ -1,4 +1,5 @@ -import { useContext } from "react"; +import { useContext, useEffect, useRef, useState } from "react"; +import { CSSTransition } from "react-transition-group"; import backImg1 from "~/assets/images/map_bi/back1.png"; import backImg2 from "~/assets/images/map_bi/back2.png"; import guangImg from "~/assets/images/map_bi/guang.png"; @@ -17,9 +18,26 @@ import { } from "~/pages/Container/Map/js/mittKey"; import "./index.less"; +const animationTime = 1000; function Header(props) { const { currentPort, currentBranchOffice, mapMethods, area } = useContext(Context); + 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]); + const onBack = () => { sessionStorage.removeItem("mapCurrentBranchOfficeId"); mitt.emit(deletePeoplePositionPointMittKey); @@ -38,9 +56,9 @@ function Header(props) { mapMethods.current.removeBranchOfficePoint(); mapMethods.current.removeMarkPoint(); mapMethods.current.returnPreviousCenterPoint(); - setTimeout(() => { - mapMethods.current.addBranchOfficePoint(area); - }, 2000); + // setTimeout(() => { + mapMethods.current.addBranchOfficePoint(area); + // }, 2000); } else if (currentPort) { mitt.emit(clickPortPointMittKey, { id: "", name: "秦港股份" }); @@ -59,26 +77,34 @@ function Header(props) { return (
-
- {(currentPort && props.headerTitle === "秦港股份安全监管平台") && ( -
- )} - {props.headerTitle !== "秦港股份安全监管平台" && ( -
- -
返回
-
- )} -
{props.headerTitle}
-
-
+
+ {(currentPort && displayTitle === "秦港股份安全监管平台") && ( +
+ )} + {displayTitle !== "秦港股份安全监管平台" && ( +
+ +
返回
+
+ )} +
{displayTitle}
+
+
+
); } diff --git a/src/pages/Container/Map/components/RightUtils/index.js b/src/pages/Container/Map/components/RightUtils/index.js index 4e58703..26dbe94 100644 --- a/src/pages/Container/Map/components/RightUtils/index.js +++ b/src/pages/Container/Map/components/RightUtils/index.js @@ -1,5 +1,6 @@ import { message } from "antd"; import { useContext, useEffect, useState } from "react"; +import { CSSTransition } from "react-transition-group"; import tooltipImg2 from "~/assets/images/map_bi/right_utils/branch_office/bg11.png"; import buttonBg from "~/assets/images/map_bi/right_utils/branch_office/button.png"; import tooltipImg1 from "~/assets/images/map_bi/right_utils/port/tooltip.png"; @@ -21,7 +22,7 @@ function RightUtils(props) { const { currentPort, mapMethods, pureMap, currentBranchOffice, bottomUtilsCurrentIndex } = useContext(Context); const [list, setList] = useState(portUtilsList); - const [isShowChildLevel, setIsShowChildLevel] = useState(true); + const [isShowChildLevel, setIsShowChildLevel] = useState(false); useEffect(() => { mitt.on(initRightUtilsMittKey, () => { @@ -134,7 +135,17 @@ function RightUtils(props) { const renderBranchOfficeUtils = () => { return (
- {(isShowChildLevel && bottomUtilsCurrentIndex !== -1) && ( +
{ list.map((item, index) => ( @@ -149,8 +160,8 @@ function RightUtils(props) { )) }
- )} - {bottomUtilsCurrentIndex !== -1 && ( +
+ {(bottomUtilsCurrentIndex !== -1) && (
setIsShowChildLevel(!isShowChildLevel)}