Browse Source

开发环境不验证权限

wgl 4 năm trước cách đây
mục cha
commit
c4a7fc181e
1 tập tin đã thay đổi với 17 bổ sung10 xóa
  1. 17 10
      src/projects/business/main.js

+ 17 - 10
src/projects/business/main.js

@@ -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 {
 				//不验证