#
luxiaotao1123
2024-10-10 3c08965fb1fbdd2faf53edb811ec9d797c1b0527
#
1个文件已修改
11 ■■■■■ 已修改文件
zy-acs-flow/src/map/MapPage.jsx 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/map/MapPage.jsx
@@ -26,8 +26,10 @@
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();
@@ -58,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();
@@ -77,6 +84,10 @@
        notify('Welcome to Rcs', 'info');
        return () => {
            if (websocket) {
                websocket.onMessage = () => { }
                websocket.close();
            }
            player.destroy();
            window.removeEventListener('resize', handleResize);
            Tool.patchRaLayout('');