From b5602d49814716838fc116e9a856d1ce1ef229ea Mon Sep 17 00:00:00 2001 From: gtz <535262213@qq.com> Date: Tue, 12 Sep 2023 16:15:01 +0800 Subject: [PATCH] websocket_reset --- src/components/CenterTopData/LeftBoxes/index.jsx | 6 +++--- .../LeftBar/substitutionCharts/GoodRateChart/index.jsx | 4 ++-- src/pages/index.jsx | 2 +- websocket/server.ts | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/CenterTopData/LeftBoxes/index.jsx b/src/components/CenterTopData/LeftBoxes/index.jsx index aff4208..cdabaad 100644 --- a/src/components/CenterTopData/LeftBoxes/index.jsx +++ b/src/components/CenterTopData/LeftBoxes/index.jsx @@ -9,10 +9,10 @@ import cls from './leftbox.module.less'; const Chart2 = () => { const ctx = useContext(SocketContext); - let [time, setTime] = useState([19, 28]); + let [time, setTime] = useState([0, 0]); useEffect(() => { - const restTime = ctx.runState?.lastFireChangeTime || '19分28秒'; + const restTime = ctx.runState?.lastFireChangeTime; if (restTime == null) return; console.log('restTime is:', restTime); let timer = null; @@ -77,7 +77,7 @@ const Chart2 = () => { { icon: icon1, label: '换火时间', - value: ctx.runState?.fireChangeTime || '19:56', + value: ctx.runState?.fireChangeTime || '00:00', }, { icon: icon3, diff --git a/src/components/LeftBar/substitutionCharts/GoodRateChart/index.jsx b/src/components/LeftBar/substitutionCharts/GoodRateChart/index.jsx index 7f43468..13ccc67 100644 --- a/src/components/LeftBar/substitutionCharts/GoodRateChart/index.jsx +++ b/src/components/LeftBar/substitutionCharts/GoodRateChart/index.jsx @@ -8,7 +8,7 @@ import { randomInt } from '../../../../utils'; const GoodRateChart = (props) => { const options = { color: ['#FFD160', '#12FFF5', '#2760FF'], - grid: { top: 28, right: 12, bottom: 64, left: 48 }, + grid: { top: 28, right: 12, bottom: 48, left: 48 }, xAxis: { type: 'category', data: Array(7) @@ -147,7 +147,7 @@ const GoodRateChart = (props) => { - + ); }; diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 659141e..49ce72e 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -15,7 +15,7 @@ export default function index() { const v = (value / 100).toFixed(2); const styles = { - transform: `scale(${v})`, + transform: `scale(${(v * 3840) / 4320}, ${v})`, // transform: `scale(${v * 24 / 33}, ${v})`, transformOrigin: 'top left', }; diff --git a/websocket/server.ts b/websocket/server.ts index f60341c..3900627 100644 --- a/websocket/server.ts +++ b/websocket/server.ts @@ -28,6 +28,7 @@ wss.on('connection', function (ws, req) { const timer = setInterval(() => { sendMsg(ws, 'kiln-info'); // 窑炉信息 sendMsg(ws, 'energy-cost'); // 运行状态 + sendMsg(ws, 'run-state'); // 运行状态 sendMsg(ws, 'realtime'); sendMsg(ws, 'his-trend'); // sendMsg(ws, 'gas'); @@ -36,7 +37,7 @@ wss.on('connection', function (ws, req) { }, frequency * 1000); const timer1 = setInterval(() => { - sendMsg(ws, 'run-state'); // 运行状态 + // sendMsg(ws, 'run-state'); // 运行状态 }, frequency1 * 1000); ws.on('close', function () {