From 7d657d4429024d3abfa275697af05bc02fe4fea0 Mon Sep 17 00:00:00 2001 From: fengerli <528575642@qq.com> Date: Fri, 6 Feb 2026 13:42:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?100J=E5=8A=9F=E8=83=BD=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/index.js | 6 +- pages/100J/HBY100-J.vue | 143 ++++++++++++++------ pages/100J/audioManager/AudioList.vue | 182 ++++++++++++++++++-------- 3 files changed, 230 insertions(+), 101 deletions(-) diff --git a/config/index.js b/config/index.js index 3776862..31d9e3c 100644 --- a/config/index.js +++ b/config/index.js @@ -5,10 +5,10 @@ const config = { BASE_URL: 'http://192.168.2.34:8000',//http://139.224.253.23:8000 API_PREFIX: '', // MQTT 配置 - MQTT_HOST: 'www.cnxhyc.com', - MQTT_PORT: 8083, + MQTT_HOST: '47.120.79.150', + MQTT_PORT: 9083, MQTT_USERNAME: 'admin', - MQTT_PASSWORD: '#YtvpSfCNG' + MQTT_PASSWORD: '#YtvpSfCNG' }, // 生产环境 production: { diff --git a/pages/100J/HBY100-J.vue b/pages/100J/HBY100-J.vue index 79fd685..204cbc2 100644 --- a/pages/100J/HBY100-J.vue +++ b/pages/100J/HBY100-J.vue @@ -43,26 +43,26 @@ {{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus === 2 ? '故障' : '在线' }} - - 定位信息 - - - {{ deviceInfo && deviceInfo.longitude ? Number(deviceInfo.longitude).toFixed(4) : '' }} - {{ deviceInfo && deviceInfo.latitude ? Number(deviceInfo.latitude).toFixed(4) : '' }} - - - - {{ deviceInfo.address }} - + + 定位信息 + + + {{ deviceInfo && deviceInfo.longitude ? Number(deviceInfo.longitude).toFixed(4) : '' }} + {{ deviceInfo && deviceInfo.latitude ? Number(deviceInfo.latitude).toFixed(4) : '' }} - + + + {{ deviceInfo.address }} + + + - {{ deviceInfo.chargeState === 1 ? '报警中' : '强制报警' }} + {{ deviceInfo.voiceStrobeAlarm === 1 ? '报警中' : '强制报警' }} 解除 @@ -80,7 +80,7 @@ @@ -148,32 +148,32 @@ 亮度 - {{ formData.sta_LightDimmer }}% + {{ formData.lightBrightness }}% - 频率 - {{ formData.sta_LightFreq }}HZ + {{ formData.strobeFrequency }}HZ - 音量 - {{ formData.sta_VoiceVolume }} + {{ formData.volume }} - + 产品信息 @@ -211,6 +211,7 @@ - \ No newline at end of file From 943d98dd40a09124497d7948cc815e2623e5e1e1 Mon Sep 17 00:00:00 2001 From: fengerli <528575642@qq.com> Date: Fri, 6 Feb 2026 13:44:35 +0800 Subject: [PATCH 2/2] 1 --- pages/100J/audioManager/AudioList.vue | 72 +++++++++++++-------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/pages/100J/audioManager/AudioList.vue b/pages/100J/audioManager/AudioList.vue index 40d2c38..0ddca29 100644 --- a/pages/100J/audioManager/AudioList.vue +++ b/pages/100J/audioManager/AudioList.vue @@ -85,8 +85,7 @@ - + @@ -207,7 +206,7 @@ }, updateProgress: 0, // 升级进度,0-100 isUpdating: false, // 是否正在升级(控制进度条显示/隐藏) - upgradeTimer: null // 升级超时定时器,初始为null + mqttSubscribeSuccess: false // MQTT订阅是否成功 } }, onLoad() { @@ -488,26 +487,28 @@ // 解析MQTT返回的payload const payloadObj = typeof payload === 'string' ? JSON.parse( payload) : payload; - // 取出进度值 - const progress = payloadObj.data.progress; + // 取出进度值(用可选链避免字段不存在报错) + const progress = payloadObj.data?.progress; if (progress !== undefined && !isNaN(progress) && progress >= 0 && progress <= 100) { this.updateProgress = progress; console.log('当前升级进度:', progress + '%'); - // 进度到100%时 + // 进度到100%时,触发升级完成逻辑 if (progress === 100) { clearTimeout(this.upgradeTimer); uni.showToast({ - title: '更新完成!', + title: '升级完成!', icon: 'success', duration: 2000 }); this.isUpdating = false; - item.useStatus = 1 + setTimeout(() => { + uni.navigateBack(); + }, 1500); } } } catch (e) { - clearTimeout(this.upgradeTimer); + clearTimeout(this.upgradeTimer); console.error('解析MQTT payload失败:', e); } }) @@ -521,20 +522,22 @@ } }) - this.upgradeTimer = setTimeout(() => { - // 超时后 - uni.showToast({ - title: '响应超时', - icon: 'none', - duration: 2000 - }); - this.isUpdating = false; // 关闭进度条 - this.updateProgress = 0; - //this.mqttClient.unsubscribe(statusTopic); - }, 20000); //20s超时 + this.upgradeTimer = setTimeout(() => { + // 超时后执行:隐藏进度条+提示超时+重置进度 + uni.showToast({ + title: '升级进度同步超时', + icon: 'none', + duration: 2000 + }); + this.isUpdating = false; // 关闭进度条 + this.updateProgress = 0; // 重置进度值 + // 可选:如果需要取消MQTT订阅,加这行(根据需求选择) + // this.mqttClient.unsubscribe(statusTopic); + }, 6000); // 6000ms = 6秒,时间可直接修改 }, closePop: function() { this.Status.Pop.showPop = false; + if (this.Status.Pop.cancelCallback) { this.Status.Pop.cancelCallback(); } @@ -636,21 +639,18 @@ } -