From 53217ec58e70cee5016572dff90808350ee57f4c Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Thu, 29 Feb 2024 09:24:40 +0800 Subject: [PATCH] add --- src/App.vue | 29 +++++++++++++++-------------- src/components/index/topCenter.vue | 1 - src/components/index/topLeft.vue | 1 - src/components/index/topRight.vue | 1 - src/view/index.vue | 8 ++++---- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/App.vue b/src/App.vue index 2add3a3..07c56e9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3,9 +3,23 @@ import { areaObj } from "@/store/index.js" import { globalEventBus } from '@/common/eventBus' import { Push } from '@/common/push' +// 获取 URL 中的查询参数部分 +var queryString = window.location.hash.split("?")[1]; +// 解析查询参数字符串 +const searchParamsType = new URLSearchParams(queryString); +// 读取名为 id 的参数 +const type = searchParamsType.get('type') || ''; +if (type) { localStorage.setItem("TRADE_TYPE", true) } +else { + localStorage.setItem("TRADE_TYPE", false) +} +const isMainScreen = Boolean(type) +console.log(isMainScreen, 'isMainScreen') const openPush = (uid = 10) => { + if (isMainScreen) return + var connection = new Push({ url: 'wss://chat.lihaink.cn/tts', // websocket地址 app_key: 'aaea61749929eb53a4bd75a1474c1d27', @@ -64,20 +78,7 @@ const searchParams = new URLSearchParams(queryString); // 读取名为 id 的参数 const id = searchParams.get('local') || ''; -console.log(id); // 输出 id 参数的值 - - - -if (!JSON.parse(localStorage.getItem("TRADE_TYPE"))) { - if (id) { - openPush(id); - - } - else { - openPush(); - } -} - +id ? openPush(id) : openPush()