Selaa lähdekoodia

修改了主页界面的部分功能

hxz 2 vuotta sitten
vanhempi
commit
b9c3ade666
6 muutettua tiedostoa jossa 489 lisäystä ja 787 poistoa
  1. 3 1
      api/device.js
  2. 1 1
      https/env.js
  3. 435 784
      pages/control/control.js
  4. 1 0
      pages/scene/scene.js
  5. 1 1
      project.private.config.json
  6. 48 0
      utils/control.js

+ 3 - 1
api/device.js

@@ -7,5 +7,7 @@ module.exports = {
   //修改设备
   putDevice: (params) => request('/devices', 'PUT', params),
   //删除设备
-  delDevice: (Device) => request('/devices?id=' + Device,'DELETE')
+  delDevice: (Device) => request('/devices?id=' + Device,'DELETE'),
+  //获取回路参数
+  getloop:(Device) => request('/devices/relays?id=' + Device,'GET')
 }

+ 1 - 1
https/env.js

@@ -5,7 +5,7 @@ module.exports = {
   },
   // 添加设备和分组
   prod:{
-    baseUrl:'http://192.168.110.58:8120/api/minigrogram/lightcontrol'
+    baseUrl:'http://110.40.223.170:8120/api/minigrogram/lightcontrol'
   },
   //获取设备具体信息
   intell:{

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 435 - 784
pages/control/control.js


+ 1 - 0
pages/scene/scene.js

@@ -534,6 +534,7 @@ Page({
     getGroup().then(res => {
       if(res.data.code == 0){
         var data = res.data.data
+        console.log(data)
         if(data != null){
           for(let i = 0;i <data.length;i++){
             if(data[i].devices != null){

+ 1 - 1
project.private.config.json

@@ -3,7 +3,7 @@
   "setting": {
     "compileHotReLoad": true,
     "bigPackageSizeSupport": true,
-    "urlCheck": true
+    "urlCheck": false
   },
   "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
   "libVersion": "2.27.1"

+ 48 - 0
utils/control.js

@@ -129,6 +129,54 @@ function loopname(deviceid,groupid,loop,loops,slice,groupName,deviceName,group,c
   } 
 }
 
+//分组下拉和设备下拉的获取(主页界面)
+function droplist(){
+  var group = wx.getStorageSync('group')
+  //获取分组下拉  
+  var groups = []
+  for(let i = 0;i < group.length;i++){
+    groups.push(group[i].groupName)
+  }
+  //改变分组下标
+  if(wx.getStorageSync('groupName') != ''){
+    let GroupName = that.data.groupName
+    for(let n = 0;n < GroupName.length;n++){
+      if(GroupName[n] == wx.getStorageSync('groupName')){
+        var groupIndex = n
+      }
+    }
+  }
+  else{wx.setStorageSync('groupName',that.data.groupName[that.data.groupIndex])}
+  //获取设备下拉
+  var device = []
+  var groupName = that.data.groupName
+  var groupIndex = that.data.groupIndex
+  for(let j = 0;j < group.length;j++){
+    if(groupName[groupIndex] == group[j].groupName){
+      if(group[j].devices != null && group[j].devices.length != 0){
+        for(let p = 0;p < group[j].devices.length;p++){
+          device.push(group[j].devices[p].deviceName)     
+        }
+        that.setData({deviceName:device})
+        //改变设备下标
+        if(wx.getStorageSync('deviceName') != ''){
+          var DeviceName = that.data.deviceName
+          for(let m = 0;m < DeviceName.length;m++){
+            if(DeviceName[m] == wx.getStorageSync('deviceName')){
+              that.setData({
+                deviceIndex:m
+              })
+            }
+          }
+        }
+        else{
+          wx.setStorageSync('deviceName', that.data.deviceName[that.data.deviceIndex])
+        }
+      }
+    }
+  }
+}
+
 module.exports = {
   getlooplist:getlooplist,
   Switch:Switch,