diff --git a/src/api/index.js b/src/api/index.js index 745cccd..f2fe046 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -6,7 +6,6 @@ let host = 'http://192.168.31.137:9000/'; // 赓 // let host = "http://39.108.250.202:9000/"; // 测试服 - let uploadURL = Setting.upload.apiURL; let host1 = "http://39.108.250.202:8080/"; // 川大 diff --git a/src/router/index.js b/src/router/index.js index 1b6e536..8d1b2e9 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -41,11 +41,30 @@ function getPermission(){ name:e.name, component:`../pages${e.path}`, meta:[], + children:[] } // 取得页面内的次级路由以及页面按钮 if(e.children&&e.children.length>0){ - // 先判断是否有path,有就是页面 - e + let meta = [] + let children = [] + e.children.forEach(i=>{ + // 先判断是否有path,有就是页面,页面需要额外进入children, + if(i.path){ + let obj = { + path:i.path, + name:i.name, + component:`../pages${i.path}`, + meta:[], + } + // 额外处理该页面的按钮,只有两级,懒得递归 + if(i.children&&i.children.length>0){ + + } + children.push(obj) + }else{ + meta.push(i.name) + } + }) // 其他的是按钮 } @@ -55,7 +74,7 @@ function getPermission(){ }) } // 权限 -router.beforeEach((to,from,next)=>{ +router.beforeEach(function(to,from,next){ if(to.path == '/login'){ localStorage.removeItem(Setting.tokenKey) } diff --git a/src/router/permission.js b/src/router/permission.js index 5468d8d..b2f6cad 100644 --- a/src/router/permission.js +++ b/src/router/permission.js @@ -2,26 +2,26 @@ import router from "./index"; import Setting from "@/setting"; import util from "@/libs/util"; -router.beforeEach((to, from, next) => { - document.title = Setting.titleSuffix; - const role = util.local.get(Setting.tokenKey); - if (!role && to.path !== "/login") { - next("/login"); - } else if (role && to.path == "/login") { - next("/index"); - } else { - let mg = from.query.mg; - if (mg) { - if (!to.query.mg) { - next({ - path: to.path, - query: { mg } - }); - } else { - next(); - } - } else { - next(); - } - } -}); \ No newline at end of file +// router.beforeEach((to, from, next) => { +// document.title = Setting.titleSuffix; +// const role = util.local.get(Setting.tokenKey); +// if (!role && to.path !== "/login") { +// next("/login"); +// } else if (role && to.path == "/login") { +// next("/index"); +// } else { +// let mg = from.query.mg; +// if (mg) { +// if (!to.query.mg) { +// next({ +// path: to.path, +// query: { mg } +// }); +// } else { +// next(); +// } +// } else { +// next(); +// } +// } +// }); \ No newline at end of file