xzw %!s(int64=4) %!d(string=hai) anos
pai
achega
b004a61f85
Modificáronse 2 ficheiros con 34 adicións e 13 borrados
  1. 33 9
      js/main_2020_show.js
  2. 1 4
      js/showHardware.js

+ 33 - 9
js/main_2020_show.js

@@ -29,7 +29,25 @@ $("#hotPannel input.mui-switch").on('change',()=>{
     window.changeDeviceStatus(window.hotNeedUpdatePannel)
 })
 
+hardwareTypes = null
 
+$.ajax({//设备类型列表
+    method: "GET",
+    headers: {
+        "Content-Type": "application/json",
+    },
+    dataType: "json",
+    contentType: "application/json",
+    url: `/api/device/getType`,
+    success: function (data) {
+    if (data.code === 0) { 
+        hardwareTypes = data.data 
+    } else {
+        console.error('设备类型列表获取失败')
+    }
+} 
+
+ 
 
 !function() {
     "use strict";
@@ -15438,9 +15456,9 @@ window.Modernizr = function(n, e, t) {
                 
             } 
             if(d.infoAttribute.hardware){
-                var Code = d.infoAttribute.hardware.deviceCode;
-                if(Code!= void 0){
-                    window.hardwareHotList[Code] = this//硬件列表
+                var code = d.infoAttribute.hardware.code;
+                if(code!= void 0){
+                    window.hardwareHotList[code] = this//硬件列表
                 }
             }
             
@@ -15548,11 +15566,17 @@ window.Modernizr = function(n, e, t) {
                   url: `/api/device/getStatus/${hardware.deviceCode}`, 
                   success:  (data)=> {
                     console.log(data)  
-                    if (data.code === 0) { 
-                        if(hardware.devTypeId == "温湿度"){
-                    
-                        }else if(hardware.devTypeId == "温湿度"){
-                            
+                    if (data.code === 0) {
+
+                        var devType = hardwareTypes.find(type=>type.id == hardware.devTypeId).name
+ 
+                        if(devType == "灯控"){
+                        
+                        }else if(devType == "温湿度"){
+                            loadTemperature({
+                                id:"temperature",//dom Id
+                                val:70 //度数    
+                            })
                         }
                         $("#hotPannel>div").css("display","block");
                         $("#hotPannel .title").text(hardware.name); 
@@ -26049,7 +26073,7 @@ window.Modernizr = function(n, e, t) {
             minimalMemoryMode: r.valueFromHash("m3", r.isMobile()),
             startupFlyinDelay: 3e3,
             dollhouseDefault: {
-                minDistance: 15,
+                minDistance: 10,
                 maxDistance: 50,
                 minPolarAngle: n.Math.degToRad(10),
                 maxPolarAngle: n.Math.degToRad(90)

+ 1 - 4
js/showHardware.js

@@ -129,7 +129,7 @@ $(function () {
   }
 
 
-  let loadTemperature = function (params={}) {
+  window.loadTemperature = function (params={}) {
     let {id="temperature",val} = params
        //加载温度计
     var chartDom = document.getElementById(id);
@@ -241,6 +241,3 @@ $(function () {
   })
 
 });
-
-
-