From 1d37cc9cb15c01d0f411f2c8c384f71a612fb2b9 Mon Sep 17 00:00:00 2001
From: litian <2804272236@qq.com>
Date: 星期一, 14 四月 2025 15:23:33 +0800
Subject: [PATCH] xiugai

---
 src/main.ts |   47 ++++++++++++++++++++++++++++++++---------------
 1 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/src/main.ts b/src/main.ts
index 6bb3e37..78dfb1f 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -10,6 +10,13 @@
 import toolClass from '@/assets/js/toolClass'
 import MG from '@/assets/js/middleGround/WebMiddleGroundApi.js'
 import './child.ts'
+import { loginCtx } from '@/assets/js/config.ts'
+
+// 鍏紡杈撳叆
+import { MathfieldElement } from "mathlive"
+// 鍏紡瑙f瀽
+import VueLatex from 'vatex'
+
 
 const handleGetToken = () => {
   return localStorage.getItem('token')
@@ -17,23 +24,31 @@
 
 // 璺敱鎵ц涔嬪墠鐨勪竴浜涙搷浣�
 router.beforeEach((to, from, next) => {
-  if (handleGetToken()) {
-    // 鏄惁鏄櫥褰曢〉闈紝鐩存帴鍒伴椤�
-    if (to.path === '/login') {
-      next({ path: '/home', query: { bookId: localStorage.getItem('bookId') } })
-    } else {
-      // 濡傛灉涓嶆槸鐧诲綍椤甸潰锛岃烦杞埌鐩爣鐨勯〉闈�
-      next()
-    }
+  const isInternalLink = from.fullPath.includes('/testBookReader')
+  if (isInternalLink) {
+    sessionStorage.removeItem('loginCtx')
   } else {
-    // 娌℃湁token
-    if (!to.meta || !to.meta.auth) {
-      // 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝鐩存帴杩涘叆
-      next()
-    } else {
-      next(`/login?redirect=${to.fullPath}`) // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤�
-    }
+    sessionStorage.setItem('loginCtx', loginCtx)
   }
+
+  next()
+  // if (handleGetToken()) {
+  //   // 鏄惁鏄櫥褰曢〉闈紝鐩存帴鍒伴椤�
+  //   if (to.path === '/login') {
+  //     next({ path: '/home', query: { bookId: localStorage.getItem('bookId') } })
+  //   } else {
+  //     // 濡傛灉涓嶆槸鐧诲綍椤甸潰锛岃烦杞埌鐩爣鐨勯〉闈�
+  //     next()
+  //   }
+  // } else {
+  //   // 娌℃湁token
+  //   if (!to.meta || !to.meta.auth) {
+  //     // 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝鐩存帴杩涘叆
+  //     next()
+  //   } else {
+  //     next(`/login?redirect=${to.fullPath}`) // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤�
+  //   }
+  // }
 })
 
 // qiankun涓诲簲鐢ㄤ笌寰簲鐢ㄩ�氳
@@ -65,8 +80,10 @@
 
 const app = createApp(App)
 
+
 app.provide('toolClass', toolClass)
 app.provide('MG', MG)
+app.use(VueLatex)
 app.use(router)
 app.use(ElementPlus)
 app.use(pinia)

--
Gitblit v1.9.1