Browse Source

修复.current

anxiaoxia 2 years ago
parent
commit
1ec5bc04b2
1 changed files with 6 additions and 6 deletions
  1. 6 6
      src/pages/Equipment/components/deviceModal/airEq/index.jsx

+ 6 - 6
src/pages/Equipment/components/deviceModal/airEq/index.jsx

@@ -81,7 +81,7 @@ export default ({ spaceId, projectId }) => {
   const changeIsLoading = (val) => {
     let countTimer = 0;
     airLoadingTimer.current = setInterval(() => {
-      if (countTimer >= 30 || isNowAirStatus === val) {
+      if (countTimer >= 30 || isNowAirStatus.current === val) {
         setIsOpen(val); // 开关
         setIsLoading(false);
         clearInterval(airLoadingTimer.current);
@@ -99,14 +99,14 @@ export default ({ spaceId, projectId }) => {
     getFeedbackDocumentsHttp(paramsObj)
       .then((res) => {
         const val = res.icon == 7 ? false : true;
-        if (firstLoading) {
-          isNowAirStatus = val;
+        if (firstLoading.current) {
+          isNowAirStatus.current = val;
           setIsOpen(val); // 开关
           setIsLoading(false);
         } else {
-          isNowAirStatus = val;
+          isNowAirStatus.current = val;
         }
-        firstLoading = false;
+        firstLoading.current = false;
         // setFirstLoading(false)
         timerGetAirInfo(1000);
         setStatusText(res.spaceStatus); // 状态文案
@@ -114,7 +114,7 @@ export default ({ spaceId, projectId }) => {
       })
       .catch(() => {
         timerGetAirInfo(1000);
-        firstLoading = false;
+        firstLoading.current = false;
         // setIsLoading(false);
       });
   }, []);