diff --git a/src/App.vue b/src/App.vue index 3b6320d..0fcd973 100644 --- a/src/App.vue +++ b/src/App.vue @@ -11,15 +11,14 @@ const userInfoStore=areaObj() userInfoStore.changeUserInfoFn(510521) -const openPush=()=>{ +const openPush=(uid=11)=>{ var connection = new Push({ url: 'wss://chat.lihaink.cn/tts', // websocket地址 app_key: 'aaea61749929eb53a4bd75a1474c1d27', }); // 假设用户uid为1 -var uid = 11; // 浏览器监听user-2频道的消息,也就是用户uid为1的用户消息 -var user_channel = connection.subscribe('user-' + uid); +var user_channel = connection.subscribe( uid==11?'user-' + uid:uid+'user-plant' ); // 当user-2频道有message事件的消息时 user_channel.on('message', function (data) { @@ -35,7 +34,25 @@ globalEventBus.on('refresh', data => { router.go(0) }) -if( !JSON.parse(localStorage.getItem("TRADE_TYPE")) )openPush(); + + + +// 获取 URL 中的查询参数部分 +var queryString = window.location.hash.split("?")[1]; +// 解析查询参数字符串 +const searchParams = new URLSearchParams(queryString); + +// 读取名为 id 的参数 +const id = searchParams.get('local') || ''; +if (!JSON.parse(localStorage.getItem("TRADE_TYPE"))) { + if (id) { + openPush(id); + + } + else { + openPush(); + } +}