|
|
@ -328,9 +328,9 @@ router.beforeEach((to, from, next) => { |
|
|
|
.then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
// Vue.prototype.$message.error(res.msg)
|
|
|
|
return next({ |
|
|
|
name: "login", |
|
|
|
}); |
|
|
|
// return next({
|
|
|
|
// name: "login",
|
|
|
|
// });
|
|
|
|
} |
|
|
|
window.SITE_CONFIG["menuList"] = res.data; |
|
|
|
fnAddDynamicMenuRoutes(window.SITE_CONFIG["menuList"]); |
|
|
@ -341,9 +341,9 @@ router.beforeEach((to, from, next) => { |
|
|
|
}); |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
next({ |
|
|
|
name: "login", |
|
|
|
}); |
|
|
|
// next({
|
|
|
|
// name: "login",
|
|
|
|
// });
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
@ -397,14 +397,20 @@ function fnAddDynamicMenuRoutes(menuList = [], routes = []) { |
|
|
|
route["meta"]["iframeURL"] = URL; |
|
|
|
} else { |
|
|
|
URL = URL.replace(/^\//, "").replace(/_/g, "-"); |
|
|
|
route["path"] = route["name"] = URL.replace(/\//g, "-"); |
|
|
|
route["component"] = () => import(`@/views/modules/${URL}`); |
|
|
|
if (menuList[i].children && menuList[i].children.length >= 1) { |
|
|
|
route["path"] = route["name"] = URL; |
|
|
|
route["redirect"] = URL.replace(/\//g, "-"); |
|
|
|
} else { |
|
|
|
route["path"] = route["name"] = URL.replace(/\//g, "-"); |
|
|
|
route["component"] = () => import(`@/views/modules/${URL}`); |
|
|
|
} |
|
|
|
} |
|
|
|
routes.push(route); |
|
|
|
} |
|
|
|
if (temp.length >= 1) { |
|
|
|
return fnAddDynamicMenuRoutes(temp, routes); |
|
|
|
} |
|
|
|
// routers.reverse();
|
|
|
|
// 添加路由
|
|
|
|
router.addRoutes([ |
|
|
|
{ |
|
|
|