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 }, // 连接状态