Jelajahi Sumber

回路界面调试完成

lmj 1 tahun lalu
induk
melakukan
d1f3415fdd
2 mengubah file dengan 130 tambahan dan 39 penghapusan
  1. 129 38
      pages/loop/loop.js
  2. 1 1
      pages/loop/loop.wxss

+ 129 - 38
pages/loop/loop.js

@@ -123,7 +123,8 @@ Page({
           that.setData({
             equipment: Message.Device,
             subset:Message.id,
-            ID:Message.ID
+            ID:Message.ID,
+            indexes:0
           }) //记录当前的设备id和分组id
           if (Message.modules == 0) {
             that.setData({
@@ -299,9 +300,28 @@ Page({
                         var newSwitchstate = that.data.newSwitchstate
                         var choice = that.data.choice
                       //光控启动条件
-                      var light = Suc.lightControlCondition.split(',')
-                      for(let i = 0;i < light.length; i++){
-                        switch(light[i]){
+                      if(Suc.lightControlCondition.includes(',') == true){
+                        var light = Suc.lightControlCondition.split(',')
+                        for(let i = 0;i < light.length; i++){
+                          switch(light[i]){
+                            case '晴天':
+                              choice[0] = true
+                            break;
+                            case '多云':
+                              choice[1] = true
+                            break;
+                            case '阴天':
+                              choice[2] = true
+                            break;
+                            case '大阴天':
+                              choice[3] = true
+                            break;
+                          }
+                        } 
+                      }
+                      else{
+                        choice = [false,false,false,false]
+                        switch(Suc.lightControlCondition){
                           case '晴天':
                             choice[0] = true
                           break;
@@ -315,7 +335,7 @@ Page({
                             choice[3] = true
                           break;
                         }
-                      } 
+                      }
                       that.setData({choice:choice})
                         //时控1
                         if (Suc.timeCondition1Switch == 1) {
@@ -362,6 +382,7 @@ Page({
                         var newfonts = that.data.newfont
                         var newcolors = that.data.newcolor
                         var newSwitchstates = that.data.newSwitchstate
+                        var disableds = that.data.disabled
                         if (newSwitchs[0] == true) {
                           newfonts[0] = "white"
                           newcolors[0] = "blue"
@@ -384,16 +405,19 @@ Page({
                           newfonts[2] = "white"
                           newcolors[2] = "blue"
                           newSwitchstates[2] = "time"
+                          disableds = false
                         } else {
                           newfonts[2] = "#cccccc"
                           newcolors[2] = "#888888"
                           newSwitchstates[2] = ""
+                          disableds = true
                         }
                         that.setData({
                           newcolor: newcolors,
                           newfont: newfonts,
                           newSwitch: newSwitchs,
-                          newSwitchstate: newSwitchstates
+                          newSwitchstate: newSwitchstates,
+                          disabled:disableds
                         })
                       }
                     }
@@ -435,7 +459,6 @@ Page({
       duration: 2000
     })
     that.setData({deviceIndex: e.detail.value})
-    var group = wx.getStorageSync('group')
     var groupName = that.data.groupName[that.data.groupIndex]
     var deviceName = that.data.deviceName[that.data.deviceIndex]
     wx.setStorageSync('groupName', groupName) //分组名称
@@ -444,7 +467,9 @@ Page({
     var Message = enloop.deviceMessage(groupName, deviceName)
     that.setData({
       equipment: Message.Device,
-      subset:Message.id
+      subset:Message.id,
+      ID:Message.ID,
+      indexes:0
     }) //记录当前的设备id和分组id
     if (Message.modules == 0) {
       that.setData({
@@ -620,9 +645,28 @@ Page({
                   var newSwitchstate = that.data.newSwitchstate
                   var choice = that.data.choice
                       //光控启动条件
-                      var light = Suc.lightControlCondition.split(',')
-                      for(let i = 0;i < light.length; i++){
-                        switch(light[i]){
+                      if(Suc.lightControlCondition.includes(',') == true){
+                        var light = Suc.lightControlCondition.split(',')
+                        for(let i = 0;i < light.length; i++){
+                          switch(light[i]){
+                            case '晴天':
+                              choice[0] = true
+                            break;
+                            case '多云':
+                              choice[1] = true
+                            break;
+                            case '阴天':
+                              choice[2] = true
+                            break;
+                            case '大阴天':
+                              choice[3] = true
+                            break;
+                          }
+                        } 
+                      }
+                      else{
+                        choice = [false,false,false,false]
+                        switch(Suc.lightControlCondition){
                           case '晴天':
                             choice[0] = true
                           break;
@@ -636,7 +680,7 @@ Page({
                             choice[3] = true
                           break;
                         }
-                      } 
+                      }
                       that.setData({choice:choice})
                   //时控1
                   if (Suc.timeCondition1Switch == 1) {
@@ -683,6 +727,7 @@ Page({
                   var newfonts = that.data.newfont
                   var newcolors = that.data.newcolor
                   var newSwitchstates = that.data.newSwitchstate
+                  var disableds = that.data.disabled
                   if (newSwitchs[0] == true) {
                     newfonts[0] = "white"
                     newcolors[0] = "blue"
@@ -705,16 +750,19 @@ Page({
                     newfonts[2] = "white"
                     newcolors[2] = "blue"
                     newSwitchstates[2] = "time"
+                    disableds = false
                   } else {
                     newfonts[2] = "#cccccc"
                     newcolors[2] = "#888888"
                     newSwitchstates[2] = ""
+                    disableds = true
                   }
                   that.setData({
                     newcolor: newcolors,
                     newfont: newfonts,
                     newSwitch: newSwitchs,
-                    newSwitchstate: newSwitchstates
+                    newSwitchstate: newSwitchstates,
+                    disabled:disableds
                   })
                 }
               }
@@ -1251,25 +1299,44 @@ Page({
               var timeValue = that.data.timeValue
               var newSwitchstate = that.data.newSwitchstate
               var choice = that.data.choice
-                      //光控启动条件
-                      var light = Suc.lightControlCondition.split(',')
-                      for(let i = 0;i < light.length; i++){
-                        switch(light[i]){
-                          case '晴天':
-                            choice[0] = true
-                          break;
-                          case '多云':
-                            choice[1] = true
-                          break;
-                          case '阴天':
-                            choice[2] = true
-                          break;
-                          case '大阴天':
-                            choice[3] = true
-                          break;
-                        }
-                      } 
-                      that.setData({choice:choice})
+              //光控启动条件
+              if(Suc.lightControlCondition.includes(',') == true){
+                var light = Suc.lightControlCondition.split(',')
+                for(let i = 0;i < light.length; i++){
+                  switch(light[i]){
+                    case '晴天':
+                      choice[0] = true
+                    break;
+                    case '多云':
+                      choice[1] = true
+                    break;
+                    case '阴天':
+                      choice[2] = true
+                    break;
+                    case '大阴天':
+                      choice[3] = true
+                    break;
+                  }
+                } 
+              }
+              else{
+                choice = [false,false,false,false]
+                switch(Suc.lightControlCondition){
+                  case '晴天':
+                    choice[0] = true
+                  break;
+                  case '多云':
+                    choice[1] = true
+                  break;
+                  case '阴天':
+                    choice[2] = true
+                  break;
+                  case '大阴天':
+                    choice[3] = true
+                  break;
+                }
+              }
+              that.setData({choice:choice})
               //时控1
               if (Suc.timeCondition1Switch == 1) {
                 newSwitch[0] = true
@@ -1316,6 +1383,7 @@ Page({
               var newfonts = that.data.newfont
               var newcolors = that.data.newcolor
               var newSwitchstates = that.data.newSwitchstate
+              var disableds = that.data.disabled
               if (newSwitchs[0] == true) {
                 newfonts[0] = "white"
                 newcolors[0] = "blue"
@@ -1338,16 +1406,19 @@ Page({
                 newfonts[2] = "white"
                 newcolors[2] = "blue"
                 newSwitchstates[2] = "time"
+                disableds = false
               } else {
                 newfonts[2] = "#cccccc"
                 newcolors[2] = "#888888"
                 newSwitchstates[2] = ""
+                disableds = true
               }
               that.setData({
                 newcolor: newcolors,
                 newfont: newfonts,
                 newSwitch: newSwitchs,
-                newSwitchstate: newSwitchstates
+                newSwitchstate: newSwitchstates,
+                disabled:disableds
               })
             }
           }
@@ -2797,7 +2868,8 @@ Page({
         that.setData({
           equipment: message.Device,
           subset:message.id,
-          ID:message.ID
+          ID:message.ID,
+          indexes:0//将回路重新调回回路1
         }) //记录当前的设备id和分组id
         //旧设备
         if (message.modules == 0) {
@@ -2975,9 +3047,28 @@ Page({
                       var newSwitchstate = that.data.newSwitchstate
                       var choice = that.data.choice
                       //光控启动条件
-                      var light = Suc.lightControlCondition.split(',')
-                      for(let i = 0;i < light.length; i++){
-                        switch(light[i]){
+                      if(Suc.lightControlCondition.includes(',') == true){
+                        var light = Suc.lightControlCondition.split(',')
+                        for(let i = 0;i < light.length; i++){
+                          switch(light[i]){
+                            case '晴天':
+                              choice[0] = true
+                            break;
+                            case '多云':
+                              choice[1] = true
+                            break;
+                            case '阴天':
+                              choice[2] = true
+                            break;
+                            case '大阴天':
+                              choice[3] = true
+                            break;
+                          }
+                        } 
+                      }
+                      else{
+                        choice = [false,false,false,false]
+                        switch(Suc.lightControlCondition){
                           case '晴天':
                             choice[0] = true
                           break;
@@ -2991,7 +3082,7 @@ Page({
                             choice[3] = true
                           break;
                         }
-                      } 
+                      }
                       that.setData({choice:choice})
                       //时控1
                       if (Suc.timeCondition1Switch == 1) {

+ 1 - 1
pages/loop/loop.wxss

@@ -321,7 +321,7 @@ page{
   font-size: calc(100vw * 18/375);
   font-weight: 550;
   position: absolute;
-  left: 48%;
+  left: 50.5%;
 }
 
 .lightstartTime{