From c9d6446308b5018fd858f494c13a3b3ff34db134 Mon Sep 17 00:00:00 2001 From: kun <1422840143@qq.com> Date: Tue, 16 Apr 2024 23:17:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20BUG=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 ++-- src/routers/index.ts | 21 +++++++++++++++++---- src/views/sevenLargeScreen/indexL.vue | 4 +++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.env.development b/.env.development index 3b065fe..72fbe82 100644 --- a/.env.development +++ b/.env.development @@ -3,7 +3,7 @@ NODE_ENV = 'development' # 本地环境接口地址(/api/index.ts文件中使用) # 后端本地 -# VITE_API_URL = 'http://192.168.34.221:9111' +VITE_API_URL = 'http://192.168.34.221:9111' # VITE_API_URL = 'http://192.168.34.221:28888' # VITE_API_URL = 'http://121.196.214.246/api' # VITE_API_URL = 'http://jxj.zhgdyun.com:100' @@ -21,7 +21,7 @@ NODE_ENV = 'development' # 七参数标准版(测试平台) # VITE_API_URL = 'http://182.90.224.237:15551' # agjt -VITE_API_URL = 'http://47.93.215.234:9809' +# VITE_API_URL = 'http://47.93.215.234:9809' # 上传 VITE_ULD_API_URL = 'http://192.168.34.155:8012/onlinePreview?url=' diff --git a/src/routers/index.ts b/src/routers/index.ts index 7fab94d..be46d16 100644 --- a/src/routers/index.ts +++ b/src/routers/index.ts @@ -37,11 +37,24 @@ const router = createRouter({ router.beforeEach(async (to, from, next) => { const globalStore = GlobalStore(); // 解决首次跳转失败 - let freeToken = window.location.href.indexOf("token") != -1; - if (freeToken) { - globalStore.token = window.location.href.split("token=")[1]; + // let freeToken = window.location.href.indexOf("token") != -1; + // let freeSn = window.location.href.indexOf("sn") != -1; + // if (freeToken) { + // globalStore.token = window.location.href.split("token=")[1]; + // } + let urlParams = new URLSearchParams(window.location.href.split('?')[1]); + let params = {} as any; + urlParams.forEach((value, key) => { + params[key] = value; + }); + console.log(params,'我的测试11111') + if(params.token){ + globalStore.token = params.token; + } + if(params.sn){ + globalStore.setSN(params.sn); } - console.log("免登录", freeToken, globalStore.token); + // console.log("免登录", freeToken, globalStore.token); // 1.NProgress 开始 NProgress.start(); diff --git a/src/views/sevenLargeScreen/indexL.vue b/src/views/sevenLargeScreen/indexL.vue index 72c4c17..198bc40 100644 --- a/src/views/sevenLargeScreen/indexL.vue +++ b/src/views/sevenLargeScreen/indexL.vue @@ -457,7 +457,9 @@ onMounted(async () => { const newToken = window.location.href.split("token=")[1]; const data: any = await jumpLargeUserInfoApi({ token: newToken }); console.log("跳转请求的数据----", data.result); - store.setSN(data.result.sn); + if(data.result.sn){ + store.setSN(data.result.sn); + } store.setToken(data.result.token); store.setAccount(data.result.account); store.setAccountType(data.result.accountType);