|
|
|
@ -6,8 +6,6 @@ import { get } from "@/plugins/requests/index.js"; |
|
|
|
|
import api from "@/api"; |
|
|
|
|
import util from "@/libs/util"; |
|
|
|
|
import BasicLayout from "@/layouts/home"; |
|
|
|
|
import store from '@/store' |
|
|
|
|
|
|
|
|
|
Vue.use(Router); |
|
|
|
|
const createRouter = () => new Router({ |
|
|
|
|
mode: Setting.routerMode, |
|
|
|
@ -61,6 +59,7 @@ function getPermission() { |
|
|
|
|
|
|
|
|
|
let data = res.permissionMenu[0].children; |
|
|
|
|
if (data.length > 0) { |
|
|
|
|
console.log(11, data) |
|
|
|
|
data.forEach(e => { |
|
|
|
|
// 第一级路由,需要根据匹配到的path,塞进对应的路由children里
|
|
|
|
|
let str = e.path.split("/")[1]; |
|
|
|
@ -77,6 +76,7 @@ function getPermission() { |
|
|
|
|
let children = []; |
|
|
|
|
// 第二级是按钮级数据,一级归属当前页的同级页面,实际上一共就一级路由
|
|
|
|
|
if (e.children && e.children.length > 0) { |
|
|
|
|
console.log(e.children) |
|
|
|
|
e.children.forEach(i => { |
|
|
|
|
// 避免重复生成路由
|
|
|
|
|
if (i.path && permissionRouters[index] && !permissionRouters[index].children.some(e => i.path === e.path)) { |
|
|
|
@ -260,14 +260,10 @@ router.beforeEach(function(to, from, next) { |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (to.path !== "/login" && to.path !== '/redirect') { |
|
|
|
|
if (store.state.user.fromClient) { |
|
|
|
|
location.href = `${location.origin}/student` |
|
|
|
|
} else { |
|
|
|
|
next({ |
|
|
|
|
path: "/login", |
|
|
|
|
query: { redirect: to.path } |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 根据路由元信息设置文档标题
|
|
|
|
|