闫增涛
2024-10-25 ff96a1b5320642e010221382bf95ce8f5efdbd1c
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,13 @@
// 路由执行之前的一些操作
router.beforeEach((to, from, next) => {
  const isInternalLink = from.fullPath.includes('/testBookReader')
  if (isInternalLink) {
    sessionStorage.removeItem('loginCtx')
  } else {
    sessionStorage.setItem('loginCtx', loginCtx)
  }
  next()
  // if (handleGetToken()) {
  //   // 是否是登录页面,直接到首页