|
@@ -71,18 +71,27 @@ Vue.prototype.routerLoad = {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- findMen(arr, indexPath) {
|
|
|
- let status = false;
|
|
|
+ findMen(arrList, arr, indexPath) {
|
|
|
arr.map((v) => {
|
|
|
+ // if ('/' + v.linkPath !== indexPath) {
|
|
|
+ // if (!!v.children) {
|
|
|
+ // this.findMen(arrList, item.children, indexPath);
|
|
|
+ // } else {
|
|
|
+ // arrList.push(true)
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+
|
|
|
+ // }
|
|
|
+
|
|
|
if (v.children) {
|
|
|
- this.findMen(v.children);
|
|
|
+ this.findMen(arrList, v.children, indexPath);
|
|
|
} else {
|
|
|
- if ('/' + v.linkPath === indexPath) {
|
|
|
- status = true;
|
|
|
+ if ('/' + v.linkPath == indexPath) {
|
|
|
+ arrList.push(true)
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- return status;
|
|
|
+
|
|
|
},
|
|
|
close() {
|
|
|
let activeRout = localStorage.getItem('path');
|
|
@@ -99,6 +108,16 @@ Vue.prototype.routerLoad = {
|
|
|
http.get('/sc-user-center/user/findUserMenu', { appId: '1002' }).then(({ status, data, msg }) => {
|
|
|
if (0 === status) {
|
|
|
store.commit('setMenuList', data[0].children);
|
|
|
+ if (data[0].children[0].children == null) {
|
|
|
+ router.push({
|
|
|
+ path: '/' + data[0].children[0].linkPath
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ router.push({
|
|
|
+ path: '/' + data[0].children[0].children[0].linkPath
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
store.commit('setThisDetai', data[0]);
|
|
|
}
|
|
|
});
|
|
@@ -138,12 +157,15 @@ Vue.prototype.routerLoad = {
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
if (to.path !== '/404') {
|
|
|
// console.log()
|
|
|
- let PermissionsRouter = Vue.prototype.routerLoad.findMen(store.getters.getMenuList, to.fullPath);
|
|
|
- if (PermissionsRouter) {
|
|
|
+ let newa = [];
|
|
|
+ console.log()
|
|
|
+ Vue.prototype.routerLoad.findMen(newa, store.getters.getMenuList, to.fullPath);
|
|
|
+ if (newa.length) {
|
|
|
next();
|
|
|
} else {
|
|
|
- next({ path: 404 });
|
|
|
+ next({ path: '404' });
|
|
|
}
|
|
|
+ next();
|
|
|
// 跳转时存储路由
|
|
|
localStorage.setItem('path', to.fullPath);
|
|
|
} else {
|