import cls from "./index.module.css"; import GradientText from "../../../Common/GradientText"; import { useSelector } from "react-redux"; import { useEffect, useState } from "react"; import eIcon1 from "../../../../assets/Icon/dontknowwhatitis.png"; import eIcon2 from "../../../../assets/Icon/lightnen.png"; function Energy(props) { const [isPage1] = useState(props.page === 1); const energyInfo = useSelector((state) => state.energy?.info); // useEffect(() => { // const timer = setInterval(() => { // setIsPage1((pre) => !pre); // }, 10000); // return () => { // clearInterval(timer); // } // }, []); return (
{isPage1 ? ( eicon1 ) : ( eicon2 )} {!isPage1 && (
智慧能源光伏发电(昨日)/kWh {(+energyInfo?.elecQty6)?.toFixed(2) || 0}
许昌安彩光伏发电(昨日)/kWh {(+energyInfo?.elecQty7)?.toFixed(2) || 0}
智慧能源光伏发电(总量)/kWh {(+energyInfo?.elecQty4)?.toFixed(2) || 0}
许昌安彩光伏发电(总量)/kWh {(+energyInfo?.elecQty5)?.toFixed(2) || 0}
)} {isPage1 && ( <>
余热发电(实时)/kWh {(+energyInfo?.elecQty1)?.toFixed(2) || 0}
余热发电(总量)/kWh {(+energyInfo?.elecQty3)?.toFixed(2) || 0}
水耗量/Km³ {(+energyInfo?.waterQty)?.toFixed(2) || 0} 天然气I/Nm³ {energyInfo?.ngQty1?.replace("Nm³", "") || "0Nm³"} 电耗量/kWh {(+energyInfo?.elecQty2)?.toFixed(2) || 0} 天然气II/Nm³ {energyInfo?.ngQty2?.replace("Nm³", "") || "0Nm³"} )}
); } export default Energy;