update firedir
This commit is contained in:
@@ -10,11 +10,15 @@ import icon3 from "../../../assets/CenterChart2icon3.svg";
|
||||
import useTimeCounter from "../../../hooks/useTimeCounter";
|
||||
|
||||
const FireInfo = () => {
|
||||
const dispatch = useDispatch();
|
||||
// const dispatch = useDispatch();
|
||||
const fireInfo = useSelector((state) => state.fireInfo);
|
||||
const time = fireInfo.lastFireChangeTime || "0分0秒";
|
||||
const [min, sec] = useTimeCounter(time);
|
||||
|
||||
const minsec = useTimeCounter(time);
|
||||
let [min, sec] = [0, 0];
|
||||
if (minsec) {
|
||||
min = minsec[0];
|
||||
sec = minsec[1];
|
||||
}
|
||||
// useEffect(() => {
|
||||
// const restTime = ctx?.runState?.lastFireChangeTime;
|
||||
// if (restTime == null) return;
|
||||
@@ -76,22 +80,22 @@ const FireInfo = () => {
|
||||
// };
|
||||
// }, [ctx?.runState?.lastFireChangeTime]);
|
||||
|
||||
useEffect(() => {
|
||||
setInterval(() => {
|
||||
dispatch({
|
||||
type: "fireInfo/setFireInfo",
|
||||
payload: {
|
||||
fireChangeTime: `${Math.ceil(Math.random() * 10)}:${Math.ceil(
|
||||
Math.random() * 10
|
||||
)}`,
|
||||
fireDirection: Math.random * 10 < 5 ? "东火" : "西火",
|
||||
lastFireChangeTime: `${Math.ceil(Math.random() * 60)}分${Math.ceil(
|
||||
Math.random() * 50
|
||||
)}秒`,
|
||||
},
|
||||
});
|
||||
}, 10000);
|
||||
}, []);
|
||||
// useEffect(() => {
|
||||
// setInterval(() => {
|
||||
// dispatch({
|
||||
// type: "fireInfo/setFireInfo",
|
||||
// payload: {
|
||||
// fireChangeTime: `${Math.ceil(Math.random() * 10)}:${Math.ceil(
|
||||
// Math.random() * 10
|
||||
// )}`,
|
||||
// fireDirection: Math.random * 10 < 5 ? "东火" : "西火",
|
||||
// lastFireChangeTime: `${Math.ceil(Math.random() * 60)}分${Math.ceil(
|
||||
// Math.random() * 50
|
||||
// )}秒`,
|
||||
// },
|
||||
// });
|
||||
// }, 10000);
|
||||
// }, []);
|
||||
|
||||
const data = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user