diff --git a/src/App.vue b/src/App.vue index 83e1dc4..81fd29e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -21,21 +21,23 @@ code: '' }; }, - created() { + mounted() { this.load() }, methods: { load() { - // 获取名为id的查询参数值 + // 获取名为code的查询参数值 + console.log(this.$route.query.code) if (this.cite.code === "") { this.code = this.$route.query.code; this.cite.code = this.code; }else{ this.code = this.cite.code; } - - console.log(this.code); // 输出查询参数的值 - this.initMqtt() + // 判断是否是广告屏 + if(this.$route.name != 'advertising') { + this.initMqtt() + } if (this.cite.facility === "") { this.getDeviceByCode(); } @@ -50,7 +52,7 @@ username: 'admin', //用户名 password: 'public' //密码 } - this.client = mqtt.connect('tcp://192.168.250.29:8083/mqtt', options) //调用连接的api + this.client = mqtt.connect('ws://114.67.196.224:8083/mqtt', options) //调用连接的api //连接成功 this.client.on('connect', (e) => { console.log('连接成功', e) @@ -88,7 +90,7 @@ }, getDeviceByCode() { getDeviceByCode({ code: this.code }).then((res) => { - this.cite.facility = res.data; + this.cite.facility = res; }); }, }