This commit is contained in:
lb 2023-11-09 16:30:27 +08:00
parent 96aab1bea1
commit c16a52a20e

View File

@ -4,6 +4,7 @@ import { useSelector } from "react-redux";
import { stateNameMap } from "../../../store/features/kilnSlice"; import { stateNameMap } from "../../../store/features/kilnSlice";
import { useEffect } from "react"; import { useEffect } from "react";
import { useDispatch } from "react-redux"; import { useDispatch } from "react-redux";
export default function Kiln() { export default function Kiln() {
const kilnInfo = useSelector((state) => state.kiln); const kilnInfo = useSelector((state) => state.kiln);
const dispatch = useDispatch(); const dispatch = useDispatch();
@ -15,21 +16,21 @@ export default function Kiln() {
})); }));
useEffect(() => { useEffect(() => {
setTimeout(() => { setInterval(() => {
dispatch({ dispatch({
type: "kiln/setKilnInfo", type: "kiln/setKilnInfo",
payload: { payload: {
kilnPressure: "100Pa", kilnPressure: Math.ceil(Math.random() * 100) + "Pa",
waterTemp: "100℃", waterTemp: Math.ceil(Math.random() * 100) + "℃",
waterFlow: "100m³/h", waterFlow: Math.ceil(Math.random() * 100) + "m³/h",
waterPressure: "100Pa", waterPressure: Math.ceil(Math.random() * 100) + "Pa",
combustionAirPressure: "100Pa", combustionAirPressure: Math.ceil(Math.random() * 100) + "Pa",
topTemp: "100℃", topTemp: Math.ceil(Math.random() * 100) + "℃",
compressedAirPressure: "100Pa", compressedAirPressure: Math.ceil(Math.random() * 100) + "Pa",
meltTemp: "100℃", meltTemp: Math.ceil(Math.random() * 100) + "℃",
}, },
}); });
}, 3000); }, 30000);
}, []); }, []);
// const infos = [ // const infos = [