From 14c7eb5bb180261cac785779de3d8bcc7eb36f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=B2=E4=B9=88=E4=BA=86?= Date: Thu, 31 Aug 2023 15:26:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=A9=E5=BA=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 4 ++-- pages/device/APF/comp/IO.vue | 15 +++++++++------ pages/device/APF/detail.vue | 11 ++++++++--- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/manifest.json b/manifest.json index 0c90d78..11f904f 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name" : "灿能物联", "appid" : "__UNI__88BC25B", "description" : "", - "versionName" : "1.2.4", - "versionCode" : 124, + "versionName" : "1.2.6", + "versionCode" : 126, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { diff --git a/pages/device/APF/comp/IO.vue b/pages/device/APF/comp/IO.vue index 9b5f181..a81cfd3 100644 --- a/pages/device/APF/comp/IO.vue +++ b/pages/device/APF/comp/IO.vue @@ -16,10 +16,10 @@ {{ item[3].clDid }} - {{ item[0].clDid ? item[0].value || '-' : ''}} - {{ item[1].clDid ? item[1].value || '-' : ''}} - {{ item[2].clDid ? item[2].value || '-' : ''}} - {{ item[3].clDid ? item[3].value || '-' : ''}} + {{ item[0].clDid ? item[0].value || '-' : '' }} + {{ item[1].clDid ? item[1].value || '-' : '' }} + {{ item[2].clDid ? item[2].value || '-' : '' }} + {{ item[3].clDid ? item[3].value || '-' : '' }} @@ -58,13 +58,16 @@ export default { for (let i = 0; i < this.IOData.length; i += 4) { arr.push(this.IOData.slice(i, i + 4)) } - arr.forEach(item => { + // 把每组的长度补齐到4 + arr.forEach((item) => { if (item.length < 4) { - for (let i = 0; i < 4 - item.length; i++) { + let length = 4 - item.length + for (let i = 0; i < length; i++) { item.push({}) } } }) + console.warn(arr) return arr } }, diff --git a/pages/device/APF/detail.vue b/pages/device/APF/detail.vue index 83119a1..e02e121 100644 --- a/pages/device/APF/detail.vue +++ b/pages/device/APF/detail.vue @@ -252,9 +252,7 @@ export default { uni.downloadFile({ url: this.deviceInfo.filePath, success: (res) => { - console.log(res) pathToBase64(res.tempFilePath).then((res) => { - console.log(res) this.topoImg = res }) }, @@ -321,7 +319,7 @@ export default { this.client = mqtt.connect('wx://' + MQTT_IP, MQTT_OPTIONS) // #endif // #ifdef H5 - this.client = mqtt.connect('wss://' + MQTT_IP, MQTT_OPTIONS) + this.client = mqtt.connect('ws://' + MQTT_IP, MQTT_OPTIONS) // #endif this.client .on('connect', () => { @@ -371,6 +369,13 @@ export default { // } // }) this.IOData = JSON.parse(message.toString()) + this.IOData.forEach(item=>{ + if(item.value === 0){ + item.value = '0' + }else if(!item.value){ + item.value = '' + } + }) } }) },