|
@@ -44,16 +44,18 @@ Vue.use(VueDirectiveImagePreviewer, {
|
|
|
//获取纯权限路由数组
|
|
|
let funList = [];
|
|
|
let fun_list = store.state.fun_list;
|
|
|
-fun_list.forEach(function(item) {
|
|
|
- item.list.forEach(function(iten) {
|
|
|
- funList.push(iten.iconRoute);
|
|
|
- if (iten.iconSubRouteList) {
|
|
|
- iten.iconSubRouteList.forEach(function(iteb) {
|
|
|
- funList.push(iteb)
|
|
|
- })
|
|
|
- }
|
|
|
+if (fun_list && fun_list.length > 0) {
|
|
|
+ fun_list.forEach(function(item) {
|
|
|
+ item.list.forEach(function(iten) {
|
|
|
+ funList.push(iten.iconRoute);
|
|
|
+ if (iten.iconSubRouteList) {
|
|
|
+ iten.iconSubRouteList.forEach(function(iteb) {
|
|
|
+ funList.push(iteb)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
-})
|
|
|
+}
|
|
|
//console.log(funList)
|
|
|
|
|
|
|
|
@@ -72,7 +74,12 @@ router.beforeEach((to, from, next) => {
|
|
|
if (funList.indexOf(to.name) > -1) {
|
|
|
next();
|
|
|
} else {
|
|
|
- mui.toast('无权访问');
|
|
|
+ //测试环境不验证权限
|
|
|
+ if (process.env.VUE_APP_NODE_NAME == 'devlopment') {
|
|
|
+ next();
|
|
|
+ } else {
|
|
|
+ mui.toast('无权访问');
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
//不验证
|