From 01bece15ccc2d53bb4890c9b1d9a0127940880d4 Mon Sep 17 00:00:00 2001 From: lld <15027638633@163.com> Date: Tue, 30 Dec 2025 17:27:38 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D=EF=BC=8Cmqtt=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=BB=98=E8=AE=A4=E5=80=BC=EF=BC=9B=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E4=B8=89=E5=88=99=E8=BF=90=E7=AE=97=EF=BC=8C?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=8A=B6=E6=80=81=E5=8F=98=E6=9B=B4=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.js | 4 +--- pages/control/index.vue | 6 ++++++ pages/demo/index.vue | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/config.js b/config.js index 10c8aae..4bd12cd 100644 --- a/config.js +++ b/config.js @@ -1,8 +1,6 @@ // 应用全局配置 module.exports = { - // baseUrl: 'https://vue.ruoyi.vip/prod-api', - baseUrl: 'http://172.14.24.109:8088', - // baseUrl: 'http://1.94.254.176:8088', + baseUrl: "production" ? "/api" : "http://localhost:8088", // 应用信息 appInfo: { // 应用名称 diff --git a/pages/control/index.vue b/pages/control/index.vue index 89f65f4..7cdbc81 100644 --- a/pages/control/index.vue +++ b/pages/control/index.vue @@ -521,6 +521,12 @@ export default { if (allKeysNumeric) { // console.info(msgData) this.status = {...msgData} + // 3. 遍历msgData的所有键,根据值设置this.show的对应文本 + Object.keys(msgData).forEach(key => { + const value = msgData[key]; + // 判断值:0→暂停,1→运行,其他值可补充默认值(可选) + this.show[key] = value === 0 ? '暂停' : '运行'; + }); // console.info("imei: "+this.publishTopic+"copy: ",this.status) } const allKeysNumeric2 = Object.keys(msgData).every(key => /^\d+$/.test(key)); diff --git a/pages/demo/index.vue b/pages/demo/index.vue index ed2ecd4..8ad983a 100644 --- a/pages/demo/index.vue +++ b/pages/demo/index.vue @@ -238,10 +238,10 @@ export default { return { // MQTT配置 mqttConfig: { - broker: '', // 公共测试服务器 + broker: 'ws://1.94.254.176:9001/mqtt', // 公共测试服务器 clientId: 'uniapp_mqtt_' + Math.random().toString(16).substr(2, 8), - username: '', - password: '', + username: 'admin', + password: 'Admin#12345678', timeout: 30 }, // 连接状态