| | |
| | | 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 = () => { |
| | |
| | | |
| | | // 路由执行之前的一些操作 |
| | | router.beforeEach((to, from, next) => { |
| | | // 如果有token |
| | | if (handleGetToken()) { |
| | | // 是否是登录页面,直接到首页 |
| | | if (to.path === '/login') { |
| | | next({ path: '/transmission' }) |
| | | next({ path: '/home', query: { bookId: localStorage.getItem('bookId') } }) |
| | | } else { |
| | | // 如果不是登录页面,跳转到目标的页面 |
| | | next() |
| | |
| | | } |
| | | } |
| | | }) |
| | | |
| | | |
| | | // qiankun主应用与微应用通讯 |
| | | // import { initGlobalState, type MicroAppStateActions } from 'qiankun' |
| | |
| | | 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) |
| | |
| | | } |
| | | |
| | | app.mount('#parentApp') |
| | | |