From f496d63b038c4f6ac9476ae8ff0d0ec679ce5473 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 15 三月 2024 22:09:00 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/index.jsx         |   16 ++++++++++------
 zy-asrs-flow/src/pages/map/header/search.jsx |   12 ------------
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/header/search.jsx b/zy-asrs-flow/src/pages/map/header/search.jsx
index d59615c..4fb895d 100644
--- a/zy-asrs-flow/src/pages/map/header/search.jsx
+++ b/zy-asrs-flow/src/pages/map/header/search.jsx
@@ -69,18 +69,6 @@
     const [filterSensorList, setFilterSensorList] = React.useState([]);
     const [curSensorLabel, setCurSensorLabel] = React.useState(null);
 
-    // useEffect(() => {
-    //     const intervalID = setInterval(() => {
-    //         if (!curSensorLabel) {
-    //             let sensorListAll = getAllSensorList(curSensorType);
-    //             setSensorList(sensorListAll);
-    //             setFilterSensorList(sensorListAll);
-    //         }
-    //     }, 1000)
-
-    //     return () => clearInterval(intervalID);
-    // }, [props]);
-
     // first select
     React.useEffect(() => {
         if (!Utils.getMapContainer()) { return; }
diff --git a/zy-asrs-flow/src/pages/map/index.jsx b/zy-asrs-flow/src/pages/map/index.jsx
index a3aa714..7933169 100644
--- a/zy-asrs-flow/src/pages/map/index.jsx
+++ b/zy-asrs-flow/src/pages/map/index.jsx
@@ -80,9 +80,10 @@
     const prevSpriteBySettingsRef = React.useRef();
     const [curSprite, setCurSPrite] = React.useState(null);
     const [drawerVisible, setDrawerVisible] = React.useState(false);
+    const [dataFetched, setDataFetched] = React.useState(false);
 
     // init func
-    React.useEffect(() => {
+    React.useEffect(async () => {
         player = new Player(mapRef.current, styles.dark, didClickSprite);
         setApp(player.app);
         setMapContainer(player.mapContainer);
@@ -97,7 +98,8 @@
         };
         window.addEventListener('resize', handleResize);
 
-        Utils.fetchMapData(intl);
+        await Utils.fetchMapData(intl);
+        setDataFetched(true);
         setTimeout(() => {
             player.adaptScreen();
         }, 200)
@@ -234,10 +236,12 @@
                 <Header className={styles.header}>
                     <Row style={{ height: '100%' }}>
                         <Col className={styles.headerCol} span={12} style={{}}>
-                            <MapSearch
-                                curSprite={curSprite}
-                                setCurSPrite={setCurSPrite}
-                            />
+                            {dataFetched && (
+                                <MapSearch
+                                    curSprite={curSprite}
+                                    setCurSPrite={setCurSPrite}
+                                />
+                            )}
                         </Col>
                         {/* 3C40C6 */}
                         <Col span={12} style={{ backgroundColor: '#4a69bd' }}>

--
Gitblit v1.9.1