This commit is contained in:
Iruka 2024-09-30 10:23:30 +08:00
parent 56f17f651d
commit 12f2d45ee4
4 changed files with 22 additions and 21 deletions

View File

@ -3,5 +3,5 @@ VITE_BASE_API = 'http://39.105.121.219'
#VITE_BASE_API = 'http://127.0.0.1'
#VITE_BASE_API = 'http://api.jsyzhineng.com'
VITE_BASE_MQTT = 'mqtt://39.105.121.219:8083/mqtt'
#VITE_BASE_MQTT = 'mqtt://8.130.77.146:8083/mqtt'
VITE_BASE_MQTT = '39.105.121.219:8083/mqtt'
#VITE_BASE_MQTT = '8.130.77.146:8083/mqtt'

View File

@ -1,5 +1,5 @@
ENV = 'production'
VITE_BASE_API = 'http://api.jsyzhineng.com'
VITE_BASE_MQTT = 'ws://39.105.121.219:8083/mqtt'
#VITE_BASE_MQTT = 'ws://8.130.77.146:8083/mqtt'
#VITE_BASE_MQTT = '39.105.121.219:8083/mqtt'
VITE_BASE_MQTT = '8.130.77.146:8083/mqtt'

32
App.vue
View File

@ -36,36 +36,35 @@
methods: {
//indexData
indexDataHandler(e, data) {
// console.error("indexDataHandler_1", {
// e: e,
// data: data
// });
if (e == this.indexData.eventType.land) {
// console.error(":", this.indexData.selectItem)
this.dc.setLandItem(this.indexData.selectItem, null);
}
if (e == this.indexData.eventType.device) {
// console.error(":", this.indexData.device)
this.dc.setStations(this.indexData.device.stations);
this.dc.setFlapValves(this.indexData.device.flapValves);
this.dc.setValves(this.indexData.selectItem.id, this.indexData.device.waterOutlets);
}
uni.hideLoading();
console.error("indexDataHandler_2:", {
indexData: this.indexData,
dc: this.dc,
})
// console.error("indexDataHandler_2:", {
// e: e,
// data: data,
// indexData: this.indexData,
// dc: this.dc,
// })
},
//Mqtt
mqttLink(userId) {
console.error("mqttLink");
this.mqtt.link(userId);
},
//Mqtt
mqttEnd() {
this.mqtt.over();
//Mqtt
mqttSubscribes(topics) {
this.mqtt.subscribes(topics);
},
//Mqtt
mqttUnsubscribes(topics) {
this.mqtt.unsubscribes(topics);
},
//Mqtt
mqttMsgHandler(topic, data) {
@ -74,6 +73,11 @@
data: data,
});
},
//Mqtt
mqttEnd() {
this.mqtt.over();
},
}
}
</script>

View File

@ -25,9 +25,6 @@ class MqttUtil {
static client;
static connected = false;
static reconnectCount = 0;
onCallback = (data) => {
console.error("onCallback:", data)
};
//接收创建来的数据
constructor(eventHandler) {