From 0d70f01c3553b6c33e5ee86f89f8d0fbd42825d5 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期三, 19 六月 2024 20:00:41 +0800
Subject: [PATCH] 答题器功能

---
 src/main.ts |   91 ++++++++++++++++++++++++---------------------
 1 files changed, 48 insertions(+), 43 deletions(-)

diff --git a/src/main.ts b/src/main.ts
index 2e71243..8a1e974 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -8,7 +8,7 @@
 import router from './router'
 import * as ElementPlusIconsVue from '@element-plus/icons-vue'
 import toolClass from '@/assets/js/toolClass'
-import request from '@/plugin/axios/index.ts'
+import MG from '@/assets/js/middleGround/WebMiddleGroundApi.js'
 import './child.ts'
 
 const handleGetToken = () => {
@@ -17,29 +17,57 @@
 
 // 璺敱鎵ц涔嬪墠鐨勪竴浜涙搷浣�
 router.beforeEach((to, from, next) => {
-  // 濡傛灉鏈塼oken
-  if (handleGetToken()) {
-    // 鏄惁鏄櫥褰曢〉闈紝鐩存帴鍒伴椤�
-    if (to.path === '/login') {
-      next({ path: '/transmission' })
-    } else {
-      // 濡傛灉涓嶆槸鐧诲綍椤甸潰锛岃烦杞埌鐩爣鐨勯〉闈�
-      next()
-    }
-  } else {
-    // 娌℃湁token
-    if (!to.meta || !to.meta.auth) {
-      // 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝鐩存帴杩涘叆
-      next()
-    } else {
-      next(`/login?redirect=${to.fullPath}`) // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤�
-    }
-  }
+  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涓诲簲鐢ㄤ笌寰簲鐢ㄩ�氳
+// import { initGlobalState, type MicroAppStateActions } from 'qiankun'
+// import state from './qiankunState/state'
+
+// state.bb = (data) => {
+//   console.log(data);
+// }
+
+// 鍒濆鍖� state
+// const actions: any = initGlobalState(state)
+
+// 鐩戝惉state鍙樺寲
+// actions.onGlobalStateChange((state: any, prev: any) => {
+//   // state: 鍙樻洿鍚庣殑鐘舵��; prev 鍙樻洿鍓嶇殑鐘舵��
+//   console.log("鐖跺眰change锛�",state, prev)
+// })
+// 璁剧疆state鐨勫��
+// actions.setGlobalState(state)
+
+// console.log(actions,"actions");
+
+// app.provide('qiankunActions', actions)
+// window.qiankunActions = actions
+
+// 绉婚櫎褰撳墠搴旂敤鐨勭姸鎬佺洃鍚紝寰簲鐢� umount 鏃朵細榛樿璋冪敤
+// actions.offGlobalStateChange()
+
 const app = createApp(App)
+
 app.provide('toolClass', toolClass)
-app.provide('request', request)
+app.provide('MG', MG)
 app.use(router)
 app.use(ElementPlus)
 app.use(pinia)
@@ -48,26 +76,3 @@
 }
 
 app.mount('#parentApp')
-
-// qiankun涓诲簲鐢ㄤ笌寰簲鐢ㄩ�氳
-import { initGlobalState, type MicroAppStateActions } from 'qiankun'
-import state from './qiankunState/state'
-
-state.bb = (data) => {
-  console.log(data);
-}
-
-// 鍒濆鍖� state
-const actions: any = initGlobalState(state)
-// 鐩戝惉state鍙樺寲
-actions.onGlobalStateChange((state: any, prev: any) => {
-  // state: 鍙樻洿鍚庣殑鐘舵��; prev 鍙樻洿鍓嶇殑鐘舵��
-  console.log("鐖跺眰change锛�",state, prev)
-})
-// 璁剧疆state鐨勫��
-actions.setGlobalState(state)
-
-console.log(actions,"actions");
-
-// 绉婚櫎褰撳墠搴旂敤鐨勭姸鎬佺洃鍚紝寰簲鐢� umount 鏃朵細榛樿璋冪敤
-// actions.offGlobalStateChange()

--
Gitblit v1.9.1