Browse Source

fix isWithinLocation 设备调节去掉距离限制

anxiaoxia 1 year ago
parent
commit
63d4d8115f

+ 76 - 76
src/packagesEnv/pages/officehome/airHand/air-hand-card.wpy

@@ -323,18 +323,18 @@ wepy.component({
       this.$emit('setCanScroll', true)
     },
     eachAirOpen(aindex) {
-      isWithinLocation()
-        .then(() => {
-          this.allDevices[aindex].open = !this.allDevices[aindex].open
-          var value = this.allDevices[aindex].open ? 1 : 0
+    //   isWithinLocation()
+    //     .then(() => {
+      this.allDevices[aindex].open = !this.allDevices[aindex].open
+      var value = this.allDevices[aindex].open ? 1 : 0
 
-          this.changeOneAir(
+      this.changeOneAir(
             this.allDevices[aindex].id,
             this.allDevices[aindex].switchCode,
             value
           )
-        })
-        .catch(() => {})
+        // })
+        // .catch(() => {})
     },
     showDetail(funcid) {
       this.$emit('showDetail', { funcid: funcid })
@@ -495,85 +495,85 @@ wepy.component({
     },
     changeZongAir(btnType, value) {
       if (!this.airData.isOpen && btnType != 'sw') return
-      isWithinLocation()
-        .then(() => {
-          if (this.roomType === '开放') {
-            this.showWorkTime = this.checkAirCanOpen(
+    //   isWithinLocation()
+    //     .then(() => {
+      if (this.roomType === '开放') {
+        this.showWorkTime = this.checkAirCanOpen(
               'air',
               !this.airData.isOpen
             )
-            if (!this.showWorkTime) {
-              return
-            }
-          }
-          var _this = this
-          if (btnType == 'gear' && value == 'windLow') {
+        if (!this.showWorkTime) {
+          return
+        }
+      }
+      var _this = this
+      if (btnType == 'gear' && value == 'windLow') {
             // 降挡
-            if (this.airGear > 1) {
-              this.airGear--
-              this.isAutoGear = 0
-            } else {
-              return
-            }
-          }
-          if (btnType == 'gear' && value == 'windUp') {
+        if (this.airGear > 1) {
+          this.airGear--
+          this.isAutoGear = 0
+        } else {
+          return
+        }
+      }
+      if (btnType == 'gear' && value == 'windUp') {
             // 升档
-            if (this.airGear < 3) {
-              this.airGear++
-              this.isAutoGear = 0
-            } else {
-              return
-            }
-          }
-          if (btnType == 'gear' && value == 'auto') {
-            this.isAutoGear = this.isAutoGear == 1 ? 0 : 1
-          }
-          if (btnType == 'mode') {
-            this.airMode = value
+        if (this.airGear < 3) {
+          this.airGear++
+          this.isAutoGear = 0
+        } else {
+          return
+        }
+      }
+      if (btnType == 'gear' && value == 'auto') {
+        this.isAutoGear = this.isAutoGear == 1 ? 0 : 1
+      }
+      if (btnType == 'mode') {
+        this.airMode = value
+      }
+      if (btnType == 'sw') {
+        this.airData.isOpen = !this.airData.isOpen
+      }
+
+      let paramArr = []
+      this.allDevices.forEach((dele) => {
+        if (btnType == 'sw') {
+          let paramObj = {
+            id: dele.id,
+            code: dele.switchCode,
+            value: _this.airData.isOpen ? 1 : 0
           }
-          if (btnType == 'sw') {
-            this.airData.isOpen = !this.airData.isOpen
+          paramArr.push(paramObj)
+        }
+        var pvalue
+        dele.allModel.forEach((mele) => {
+          if (mele.id == 'temp') {
+            pvalue = value
+          } else if (mele.id == 'gear') {
+            pvalue = _this.isAutoGear == 1 ? 4 : _this.airGear
+          } else if (mele.id == 'mode') {
+            pvalue = _this.airMode
           }
 
-          let paramArr = []
-          this.allDevices.forEach((dele) => {
-            if (btnType == 'sw') {
-              let paramObj = {
-                id: dele.id,
-                code: dele.switchCode,
-                value: _this.airData.isOpen ? 1 : 0
-              }
-              paramArr.push(paramObj)
+          if (mele.id == btnType) {
+            let paramObj = {
+              id: dele.id,
+              code: mele.code,
+              value: pvalue
             }
-            var pvalue
-            dele.allModel.forEach((mele) => {
-              if (mele.id == 'temp') {
-                pvalue = value
-              } else if (mele.id == 'gear') {
-                pvalue = _this.isAutoGear == 1 ? 4 : _this.airGear
-              } else if (mele.id == 'mode') {
-                pvalue = _this.airMode
-              }
-
-              if (mele.id == btnType) {
-                let paramObj = {
-                  id: dele.id,
-                  code: mele.code,
-                  value: pvalue
-                }
-                paramArr.push(paramObj)
-              }
-            })
-          })
+            paramArr.push(paramObj)
+          }
+        })
+      })
 
-          this.vibrateShort()
-          wx.showLoading()
+      this.vibrateShort()
+      wx.showLoading()
 
           //  下达指令
-          changeManualTempHttp(paramArr, {
-            curTemp: _this.temperature,
-            equipType: 'airConditioner'
-          })
+      changeManualTempHttp(paramArr, {
+        curTemp: _this.temperature,
+        equipType: 'airConditioner'
+      })
             .then((res) => {
               if (btnType == 'temp') {
                 _this.airTemp = value
@@ -583,8 +583,8 @@ wepy.component({
             .catch(() => {
               wx.hideLoading()
             })
-        })
-        .catch(() => {})
+        // })
+        // .catch(() => {})
     },
     changeOneAir(id, code, value, deviceObjCopy) {
       var _this = this

+ 39 - 39
src/packagesEnv/pages/officehome/components/lamp-adjust.wpy

@@ -465,51 +465,51 @@ wepy.component({
       return true
     },
     eqChange(value, id, index) {
-      isWithinLocation().then(() => {
-        if (this.roomType === '开放') {
-          this.showWorkTime = this.checkLampCanOpen(value, id)
-          if (!this.showWorkTime) return
-        }
-        this.fifteenTimeout()
-        let params = []
-        if (id === 'allLamp') {
-          params = this.initData
-          params.forEach(item => {
-            item.switch = value
-          })
+    //   isWithinLocation().then(() => {
+      if (this.roomType === '开放') {
+        this.showWorkTime = this.checkLampCanOpen(value, id)
+        if (!this.showWorkTime) return
+      }
+      this.fifteenTimeout()
+      let params = []
+      if (id === 'allLamp') {
+        params = this.initData
+        params.forEach(item => {
+          item.switch = value
+        })
          // 前端现更改灯的状态,15s后获取设备状态
-          this.lampList.map(item => {
+        this.lampList.map(item => {
+          item.switch = value
+          this.setLampItem(item)
+        })
+        this.initData.map(item => {
+          item.switch = value
+          this.setLampItem(item)
+        })
+        this.lampSw = value
+      } else {
+        params = [{ id: id, switch: value }]
+          //  前端现更改灯的状态,15s后获取设备状态
+        if (this.lampList.length === 1) {
+          this.lampSw = value
+        }
+        this.lampList.map(item => {
+          if (item.id === id) {
             item.switch = value
             this.setLampItem(item)
-          })
-          this.initData.map(item => {
+          }
+        })
+        this.initData.map(item => {
+          if (item.id === id) {
             item.switch = value
             this.setLampItem(item)
-          })
-          this.lampSw = value
-        } else {
-          params = [{ id: id, switch: value }]
-          //  前端现更改灯的状态,15s后获取设备状态
-          if (this.lampList.length === 1) {
-            this.lampSw = value
           }
-          this.lampList.map(item => {
-            if (item.id === id) {
-              item.switch = value
-              this.setLampItem(item)
-            }
-          })
-          this.initData.map(item => {
-            if (item.id === id) {
-              item.switch = value
-              this.setLampItem(item)
-            }
-          })
-        }
-        this.fifteenTimeout()
-        setallLampHttp(params).then(res => {})
-        this.vibrateShort()
-      })
+        })
+      }
+      this.fifteenTimeout()
+      setallLampHttp(params).then(res => {})
+      this.vibrateShort()
+    //   })
     },
     // 15s 之后再请求状态
     fifteenTimeout() {