From cbd9fde3a2f8d4f5c45bea1a5215ad843e8dabc6 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 10 十月 2024 14:32:45 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/map/MapPage.jsx |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/zy-acs-flow/src/map/MapPage.jsx b/zy-acs-flow/src/map/MapPage.jsx
index 5ed4622..283b0e0 100644
--- a/zy-acs-flow/src/map/MapPage.jsx
+++ b/zy-acs-flow/src/map/MapPage.jsx
@@ -22,10 +22,14 @@
 import Player from './player';
 import * as Tool from './tool';
 import { NotificationProvider, useNotification } from './Notification';
+import Insight from "./insight";
 import Device from "./Device";
+import Settings from "./settings";
 import * as Http from './http';
+import WebSocketClient from './websocket'
 
 let player;
+let websocket;
 
 const Map = () => {
     const notify = useNotification();
@@ -39,6 +43,7 @@
     const [mapContainer, setMapContainer] = useState(null);
 
     const [mode, setMode] = useState(MapMode.OBSERVER_MODE);
+    const [insightVisible, setInsightVisible] = useState(false);
     const [deviceVisible, setDeviceVisible] = useState(false);
     const [settingsVisible, setSettingsVisible] = useState(false);
 
@@ -55,8 +60,13 @@
             Tool.setMapContainer(player.mapContainer);
             Tool.setThemeMode(themeMode);
             Http.setNotify(notify);
+            // websocket = new WebSocketClient('/ws/map/websocket');
 
             await Http.fetchMapData(0);
+            // websocket.connect();
+            // websocket.onMessage = (data) => {
+            //     Tool.updateMapStatusInRealTime(data, () => curFloorRef.current, setCurSPrite);
+            // }
 
         }
         initialize();
@@ -74,6 +84,10 @@
         notify('Welcome to Rcs', 'info');
 
         return () => {
+            if (websocket) {
+                websocket.onMessage = () => { }
+                websocket.close();
+            }
             player.destroy();
             window.removeEventListener('resize', handleResize);
             Tool.patchRaLayout('');
@@ -291,6 +305,14 @@
                 </SpeedDial>
             </Box>
 
+            <Insight
+                open={insightVisible}
+                onCancel={() => {
+                    setInsightVisible(false);
+                }}
+                width={378}
+            />
+
             <Device
                 open={deviceVisible}
                 onCancel={() => {
@@ -300,6 +322,16 @@
                 width={378}
             />
 
+            <Settings
+                open={settingsVisible}
+                onCancel={() => {
+                    setSpriteSettings(null);
+                    setSettingsVisible(false);
+                }}
+                sprite={spriteSettings}
+                width={570}
+            />
+
         </Box>
     );
 }

--
Gitblit v1.9.1