From bb7b5573950785770e6c4ba9b42adf1939684375 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期四, 11 四月 2024 20:34:42 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/map/index.jsx | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/zy-asrs-flow/src/pages/map/index.jsx b/zy-asrs-flow/src/pages/map/index.jsx
index 987f5d2..21351a2 100644
--- a/zy-asrs-flow/src/pages/map/index.jsx
+++ b/zy-asrs-flow/src/pages/map/index.jsx
@@ -1,5 +1,5 @@
import * as React from 'react'
-import * as PIXI from 'pixi.js';
+import * as TWEEDLE from 'tweedle.js';
import { FormattedMessage, useIntl, useModel } from '@umijs/max';
import { Layout, Button, Flex, Row, Col, FloatButton, Select, notification, Segmented } from 'antd';
const { Header, Content } = Layout;
@@ -90,6 +90,7 @@
const storedValue = localStorage.getItem('curFloor');
return storedValue !== null ? JSON.parse(storedValue) : null;
});
+ const curFloorRef = React.useRef(curFloor);
const [batchSprites, setBatchSprites] = React.useState([]);
const [batchDrawerVisible, setBatchDrawerVisible] = React.useState(false);
@@ -105,10 +106,9 @@
websocket = new WebSocketClient('/ws/map/websocket');
websocket.connect();
-
- setInterval(() => {
- websocket.sendMessage('asds')
- }, 1000)
+ websocket.onMessage = (data) => {
+ Utils.updateMapStatusInRealTime(data, () => curFloorRef.current, setCurSPrite);
+ }
const handleResize = () => {
setWindowSize({
@@ -131,7 +131,6 @@
}, 200)
}
initialize();
- console.log(1);
}, []);
// resize
@@ -256,6 +255,7 @@
// watch curFloor
React.useEffect(() => {
+ curFloorRef.current = curFloor;
if (!mapContainer && !dataFetched) {
return;
}
--
Gitblit v1.9.1