|
@@ -30,11 +30,13 @@ export class authUtils {
|
|
|
if (vueStore.state.user.id) {
|
|
|
//更新面包屑数据
|
|
|
vueStore.commit("updateBreadcrumbs", { to: to.path });
|
|
|
+ var prefitxMenuImg = "/" + (window as any).__systemConf.baseRouteUrl + '/imgs/navigation/';
|
|
|
+ var leftMenus = constructorMenu(vueStore.state.menus);
|
|
|
+ vueStore.commit("updateMenus", leftMenus);
|
|
|
return next();
|
|
|
}
|
|
|
-
|
|
|
let userInfoResult = await userController.getUserInfoById();
|
|
|
-
|
|
|
+
|
|
|
if (userInfoResult.result != logicConfig.resultObj.success) {
|
|
|
console.error("获取用户信息失败,原因:" + userInfoResult.message);
|
|
|
return next({ path: logicConfig.routerNameConfig.loginRouteName });
|
|
@@ -50,7 +52,10 @@ export class authUtils {
|
|
|
id: _userInfo.id,
|
|
|
name: _userInfo.name,
|
|
|
});
|
|
|
- vueStore.commit("updateMenus", _userInfo.menus || (window as any).__systemConf.menus);
|
|
|
+
|
|
|
+ var prefitxMenuImg = "/" + (window as any).__systemConf.baseRouteUrl + '/imgs/navigation/';
|
|
|
+ var leftMenus = constructorMenu(_userInfo.menus || (window as any).__systemConf.menus);
|
|
|
+ vueStore.commit("updateMenus", leftMenus);
|
|
|
|
|
|
//更新面包屑数据
|
|
|
vueStore.commit("updateBreadcrumbs", { to: to.path });
|
|
@@ -70,5 +75,20 @@ export class authUtils {
|
|
|
vueStore.commit("updateSelectProject", projects[0]);
|
|
|
|
|
|
next();
|
|
|
+
|
|
|
+
|
|
|
+ function constructorMenu(menus) {
|
|
|
+ menus.forEach(_c => {
|
|
|
+ if (_c.children && _c.children.length > 0) {
|
|
|
+ _c.children = constructorMenu(_c.children);
|
|
|
+ } else {
|
|
|
+ _c.normalImg = prefitxMenuImg + _c.icon + '_white.png';
|
|
|
+ _c.activeImg = prefitxMenuImg + _c.icon + '_yellow.png';
|
|
|
+ _c.state = to.path == _c.path ? 'active' : 'normal';
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return menus;
|
|
|
+ };
|
|
|
+
|
|
|
}
|
|
|
}
|