add socket

This commit is contained in:
lb
2023-07-03 14:17:11 +08:00
parent 6d7e8de0ed
commit e728ec582e
11 changed files with 484 additions and 357 deletions

View File

@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import React, { useState, useContext } from 'react';
import SocketContext from '../../../store/socket-data-provider';
import icon1 from '@/assets/CenterChart2icon1.svg';
import icon2 from '@/assets/CenterChart2icon2.svg';
import icon3 from '@/assets/CenterChart2icon3.svg';
@@ -8,12 +8,25 @@ import icon4 from '@/assets/CenterChart2icon4.svg';
import cls from './leftbox.module.less';
const Chart2 = () => {
const [data, setData] = useState([
{ icon: icon1, label: '换火时间', value: '08:34' },
{ icon: icon3, label: '剩余时间', value: '1170s' },
{ icon: icon2, label: '当前火向', value: '南向' },
// { icon: icon4, label: '车间温度', value: '28℃' },
]);
const ctx = useContext(SocketContext);
const data = [
{
icon: icon1,
label: '换火时间',
value: ctx.runState?.fireChangeTime || '00:00',
},
{
icon: icon3,
label: '剩余时间',
value: ctx.runState?.lastFireChangeTime.split('S')[0] + 's' || '0s',
},
{
icon: icon2,
label: '当前火向',
value: ctx.runState?.fireDirection || '东火',
},
];
return (
<div className={`${cls.leftbox} flex h-half`}>