|
@@ -1,33 +1,33 @@
|
|
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
|
|
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
|
|
-import {dynamicRoutes} from "./module/dynamicRoutes";
|
|
|
|
-import {globalRoutes} from "./module/globalRoutes";
|
|
|
|
|
|
+import { dynamicRoutes } from "./module/dynamicRoutes";
|
|
|
|
+import { globalRoutes } from "./module/globalRoutes";
|
|
|
|
|
|
import { useStore } from 'vuex'
|
|
import { useStore } from 'vuex'
|
|
|
|
|
|
const routes: Array<RouteRecordRaw> = [
|
|
const routes: Array<RouteRecordRaw> = [
|
|
- ...dynamicRoutes,
|
|
|
|
- ...globalRoutes
|
|
|
|
|
|
+ ...dynamicRoutes,
|
|
|
|
+ ...globalRoutes
|
|
]
|
|
]
|
|
|
|
|
|
const router = createRouter({
|
|
const router = createRouter({
|
|
- history: createWebHistory(process.env.BASE_URL),
|
|
|
|
- routes
|
|
|
|
|
|
+ history: createWebHistory(process.env.BASE_URL),
|
|
|
|
+ routes
|
|
})
|
|
})
|
|
|
|
|
|
/**
|
|
/**
|
|
* 设置标题
|
|
* 设置标题
|
|
*/
|
|
*/
|
|
router.afterEach((to, from) => {
|
|
router.afterEach((to, from) => {
|
|
- document.title = '复诊系统 - ' + to.meta.title;
|
|
|
|
|
|
+ document.title = '宝智达科技 - ' + to.meta.title;
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
-router.beforeEach((to,from,next)=>{
|
|
|
|
|
|
+router.beforeEach((to, from, next) => {
|
|
const store = useStore()
|
|
const store = useStore()
|
|
- const token = 1
|
|
|
|
- if(token){
|
|
|
|
|
|
+ const token = 1
|
|
|
|
+ if (token) {
|
|
next()
|
|
next()
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
//如果是登录页面路径,就直接next()
|
|
//如果是登录页面路径,就直接next()
|
|
if (to.path === '/') {
|
|
if (to.path === '/') {
|
|
next();
|
|
next();
|