fix
This commit is contained in:
@@ -3,6 +3,7 @@ import { defineAsyncComponent } from 'vue'
|
||||
import { getBrowserInfo, murmur } from '@/tool/util'
|
||||
import { getCookie, setCookie } from "@/tool/cookie";
|
||||
const _import = (path: string) => defineAsyncComponent(() => import(`../views/${path}.vue`));
|
||||
const _import_custom = (path : string) => defineAsyncComponent(() => import(`../component/${path}`));
|
||||
|
||||
const routes: Array<RouteRecordRaw> = [
|
||||
{
|
||||
@@ -36,10 +37,32 @@ const routes: Array<RouteRecordRaw> = [
|
||||
name: 'history',
|
||||
component: _import('HistoryPage')
|
||||
},
|
||||
// {
|
||||
// path: '/testClickData',
|
||||
// name: 'testClickData',
|
||||
// component: _import('TestClickData')
|
||||
// },
|
||||
{
|
||||
path: '/testClickData',
|
||||
name: 'testClickData',
|
||||
component: _import('TestClickData')
|
||||
path: '/administrator',
|
||||
name: 'administrator',
|
||||
component: _import('Administrator'),
|
||||
children:[
|
||||
{
|
||||
path:'allUser',
|
||||
name:'allUser',
|
||||
component: _import_custom('Administrator/allUser.vue'),
|
||||
},
|
||||
{
|
||||
path:'testClickData',
|
||||
name:'testClickData',
|
||||
component: _import_custom('Administrator/TestClickData.vue'),
|
||||
},
|
||||
{
|
||||
path:'trialApproval',
|
||||
name:'trialApproval',
|
||||
component: _import_custom('Administrator/trialApproval.vue'),
|
||||
},
|
||||
]
|
||||
},
|
||||
// {//老版本history
|
||||
// path: '/oldHistory',
|
||||
@@ -56,11 +79,11 @@ const routes: Array<RouteRecordRaw> = [
|
||||
name: 'library',
|
||||
component: _import('LibraryPage')
|
||||
},
|
||||
{
|
||||
path: '/trialApproval',
|
||||
name: 'trialApproval',
|
||||
component: _import('trialApproval')
|
||||
},
|
||||
// {
|
||||
// path: '/trialApproval',
|
||||
// name: 'trialApproval',
|
||||
// component: _import('trialApproval')
|
||||
// },
|
||||
{
|
||||
path: '/setIdentification',
|
||||
name: 'setIdentification',
|
||||
@@ -89,7 +112,6 @@ router.beforeEach((to, from, next) => {
|
||||
// 检查路由是否存在
|
||||
// 机房用户
|
||||
let userInfo = JSON.parse(getCookie("userInfo") as any);
|
||||
|
||||
let murmurStr: any = localStorage.getItem('murmurStr')
|
||||
let getIsMurmur: any = getCookie("isMurmur")
|
||||
let token = getCookie("token");
|
||||
@@ -98,11 +120,13 @@ router.beforeEach((to, from, next) => {
|
||||
let userIdList = [83,88,6]
|
||||
const routeExists = router.getRoutes().some(({ name }) =>{
|
||||
if(name){
|
||||
return name === to.name
|
||||
console.log(name , to.name);
|
||||
return name === to.name
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
});
|
||||
|
||||
if (routeExists) {
|
||||
if (isMurmur && murmurStr && token) {
|
||||
const toName = to.name === 'login';
|
||||
|
||||
Reference in New Issue
Block a user