7c233183 by renchao@pashanhoo.com

feat:权限

1 parent a5a1fa20
1 /* 1 /*
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-03-24 17:28:37 4 * @LastEditTime: 2023-03-27 14:20:03
5 */ 5 */
6 import Vue from 'vue' 6 import Vue from 'vue'
7 import router from "./router"; 7 import router from "./router";
...@@ -24,6 +24,7 @@ router.beforeEach(async (to, from, next) => { ...@@ -24,6 +24,7 @@ router.beforeEach(async (to, from, next) => {
24 localStorage.removeItem("token"); 24 localStorage.removeItem("token");
25 next(); 25 next();
26 } else { 26 } else {
27 window.document.documentElement.setAttribute("data-theme", 'blue');
27 let code = Vue.prototype.BASE_API.CODE 28 let code = Vue.prototype.BASE_API.CODE
28 //判断token是否存在 29 //判断token是否存在
29 const hasToken = localStorage.getItem("token"); 30 const hasToken = localStorage.getItem("token");
...@@ -35,6 +36,7 @@ router.beforeEach(async (to, from, next) => { ...@@ -35,6 +36,7 @@ router.beforeEach(async (to, from, next) => {
35 if (hasAddRoute) { 36 if (hasAddRoute) {
36 next(); 37 next();
37 } else { 38 } else {
39
38 //请求菜单 40 //请求菜单
39 const { result: getMenuData } = (await getMenuInfo(code)) || []; 41 const { result: getMenuData } = (await getMenuInfo(code)) || [];
40 const accessRoutes = await store.dispatch( 42 const accessRoutes = await store.dispatch(
...@@ -54,7 +56,7 @@ router.beforeEach(async (to, from, next) => { ...@@ -54,7 +56,7 @@ router.beforeEach(async (to, from, next) => {
54 } else { 56 } else {
55 next(); 57 next();
56 } 58 }
57 window.document.documentElement.setAttribute("data-theme", 'blue'); 59
58 } 60 }
59 } else { 61 } else {
60 if (code == 'BDCSBPT') { 62 if (code == 'BDCSBPT') {
......