闫增涛
2024-06-20 7b3273f175b29181337ecd719f4d345a605ea9f8
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()) {
  //   // 是否是登录页面,直接到首页