From 7b3273f175b29181337ecd719f4d345a605ea9f8 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期四, 20 六月 2024 17:48:56 +0800 Subject: [PATCH] 答题器优化 --- src/main.ts | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/src/main.ts b/src/main.ts index 8a1e974..de5d30d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -10,6 +10,7 @@ import toolClass from '@/assets/js/toolClass' import MG from '@/assets/js/middleGround/WebMiddleGroundApi.js' import './child.ts' +import { loginCtx } from '@/assets/js/config.ts' const handleGetToken = () => { return localStorage.getItem('token') @@ -17,6 +18,16 @@ // 璺敱鎵ц涔嬪墠鐨勪竴浜涙搷浣� router.beforeEach((to, from, next) => { + console.log(to, from) + const isInternalLink = from.fullPath.includes('/testBookReader') + if (isInternalLink) { + console.log('閫氳繃鍐呴儴閾炬帴杩涘叆椤圭洰') + sessionStorage.removeItem('loginCtx') + } else { + console.log(loginCtx, '閫氳繃澶栭儴閾炬帴杩涘叆椤圭洰') + sessionStorage.setItem('loginCtx', loginCtx) + } + next() // if (handleGetToken()) { // // 鏄惁鏄櫥褰曢〉闈紝鐩存帴鍒伴椤� -- Gitblit v1.9.1