|
|
@ -11,6 +11,7 @@ |
|
|
|
import mqtt from 'mqtt'; |
|
|
|
import $mitt from '@/utils/earthMap/mitt'; |
|
|
|
import { useUserStore } from '/@/store/modules/user'; |
|
|
|
import { nextTick } from 'vue'; |
|
|
|
|
|
|
|
const host = '192.168.1.200'; // 连接主机
|
|
|
|
const port = import.meta.env.VUE_APP_MQTT_PORT || 8083; // 连接端口
|
|
|
@ -67,7 +68,11 @@ export default class MqttUnit { |
|
|
|
if (topic.startsWith('/getTokenInfo/')) { |
|
|
|
const userStore = useUserStore(); |
|
|
|
// console.log("getTokenInfo数据");
|
|
|
|
this.client.publish('/tokenInfo/', userStore.token); |
|
|
|
// console.log("userStore.token",userStore.token);
|
|
|
|
console.log("userStore.token",userStore.getToken); |
|
|
|
nextTick(() => { |
|
|
|
this.client.publish('/tokenInfo/', userStore.getToken); |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
// 将client对象挂载window全局对象中
|
|
|
|