From 52004b1df435b30d57ae5b95e50bffd54b0eef5b Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Fri, 23 Feb 2024 23:48:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E7=8F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 25 +++++++-- src/components/areaMap.vue | 105 ++++++++++++++++++++++++----------- src/components/farmerMap.vue | 84 ++++++++++++++++++++++------ src/view/detail.vue | 11 +++- 4 files changed, 169 insertions(+), 56 deletions(-) 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(); + } +}