From 9bbd640e5a4f6bbf46c74b37718c93730f6be8b3 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 21 三月 2024 09:42:56 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/header/floor.jsx |    7 ++++---
 zy-asrs-flow/src/pages/map/index.jsx        |    8 +++++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/header/floor.jsx b/zy-asrs-flow/src/pages/map/header/floor.jsx
index d37f172..ebef519 100644
--- a/zy-asrs-flow/src/pages/map/header/floor.jsx
+++ b/zy-asrs-flow/src/pages/map/header/floor.jsx
@@ -43,11 +43,11 @@
     const { styles } = useStyles();
 
     React.useEffect(() => {
-
-    }, [props]);
+        console.log(props);
+    }, []);
 
     const floorChange = (floor) => {
-        console.log(floor);
+        props.setCurFloor(floor);
     }
 
     return (
@@ -56,6 +56,7 @@
                 <Segmented
                     size={'large'}
                     options={floorSelectOptions}
+                    value={props.curFloor}
                     onChange={floorChange}
                     style={{
                         opacity: .8
diff --git a/zy-asrs-flow/src/pages/map/index.jsx b/zy-asrs-flow/src/pages/map/index.jsx
index 98adb43..1e1ada1 100644
--- a/zy-asrs-flow/src/pages/map/index.jsx
+++ b/zy-asrs-flow/src/pages/map/index.jsx
@@ -84,6 +84,7 @@
     const [dataFetched, setDataFetched] = React.useState(false);
     const [curSprite, setCurSPrite] = React.useState(null);
     const prevCurSpriteRef = React.useRef();
+    const [curFloor, setCurFloor] = React.useState(1);
 
     // init func
     React.useEffect(() => {
@@ -214,6 +215,10 @@
     }, [curSprite]);
     const prevCurSprite = prevCurSpriteRef.current;
 
+    // watch curFloor
+    React.useEffect(() => {
+    }, [curFloor]);
+
     // didClickSprite, stop triggers both sprite click and play's selection boxs
     React.useEffect(() => {
         player.updateDidClickSprite(didClickSprite);
@@ -343,7 +348,8 @@
                 <Content ref={contentRef} className={styles.content}>
                     <div ref={mapRef} style={{ position: "relative" }} >
                         <MapFloor
-
+                            curFloor={curFloor}
+                            setCurFloor={setCurFloor}
                         />
                         <FloatButton.Group
                             shape="square"

--
Gitblit v1.9.1