24c6ad37 by renchao@pashanhoo.com

feat:权限

1 parent e6aa69df
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-24 17:28:37
* @LastEditTime: 2023-03-27 14:16:28
*/
import Vue from 'vue'
import router from "./router";
......@@ -24,6 +24,7 @@ router.beforeEach(async (to, from, next) => {
localStorage.removeItem("token");
next();
} else {
window.document.documentElement.setAttribute("data-theme", 'blue');
let code = Vue.prototype.BASE_API.CODE
//判断token是否存在
const hasToken = localStorage.getItem("token");
......@@ -35,6 +36,7 @@ router.beforeEach(async (to, from, next) => {
if (hasAddRoute) {
next();
} else {
//请求菜单
const { result: getMenuData } = (await getMenuInfo(code)) || [];
const accessRoutes = await store.dispatch(
......@@ -54,7 +56,7 @@ router.beforeEach(async (to, from, next) => {
} else {
next();
}
window.document.documentElement.setAttribute("data-theme", 'blue');
}
} else {
if (code == 'BDCSBPT') {
......