edit
This commit is contained in:
		| @ -32,9 +32,9 @@ export class AuthGuard extends ACLGuard { | ||||
|   constructor( | ||||
|     srv: ACLService, | ||||
|     public srv1: ACLService, | ||||
|     private baseService: BaseService, | ||||
|     private menuService: MenuService, | ||||
|     private settings: SettingsService, | ||||
|     private userService: EAUserService, | ||||
|     router: Router, | ||||
|     private inject: Injector | ||||
|   ) { | ||||
| @ -62,7 +62,7 @@ export class AuthGuard extends ACLGuard { | ||||
|     if (!router) { | ||||
|       return type === 1 ? super.canActivate(route, state) : super.canActivateChild(route, state); | ||||
|     } | ||||
|     return this.baseService | ||||
|     return this.userService | ||||
|       .request('/api/mdc/cuc/userAuthority/isUserAdmin', { | ||||
|         appUserId: this.settings.user.appUserId | ||||
|       }) | ||||
| @ -74,13 +74,14 @@ export class AuthGuard extends ACLGuard { | ||||
|             return of(true); | ||||
|           } else { | ||||
|             // 如果不是超级管理员 获取权限 | ||||
|             return this.baseService.request('/api/mdc/cuc/functionButton/getUserFunctionButton', { link: router }); | ||||
|             return this.userService.request('/api/mdc/cuc/functionButton/getUserFunctionButton', { link: router }); | ||||
|           } | ||||
|         }), | ||||
|         switchMap(res => { | ||||
|           if (res?.abilities) { | ||||
|             this.srv1.setAbility(res.abilities || []); | ||||
|             this.menuService.resume(); | ||||
|             // this.menuService.resume(); | ||||
|             this.userService.loadUserMenus(); | ||||
|           } | ||||
|           return type === 1 ? super.canActivate(route, state) : super.canActivateChild(route, state); | ||||
|         }) | ||||
|  | ||||
| @ -47,7 +47,7 @@ export class StartupService { | ||||
|       }); | ||||
|  | ||||
|       let data; | ||||
|       if (this.coreSrv.loginStatus && environment.production) { | ||||
|       if (this.coreSrv.loginStatus) { | ||||
|         // 本地菜单 | ||||
|         // data = this.loadMockData(); | ||||
|         // 远程菜单 | ||||
|  | ||||
| @ -64,7 +64,7 @@ export class EAUserService extends BaseService { | ||||
|   /** | ||||
|    * 获取用户菜单 | ||||
|    */ | ||||
|   $api_get_user_menus = `/scce/cuc/cuc/functionInfo/queryUserHaveFunctionsList`; | ||||
|   $api_get_user_menus = `/api/mdc/cuc/functionInfo/getUserHaveFunctionsList`; | ||||
|   /** | ||||
|    * 获取用户角色 | ||||
|    */ | ||||
| @ -152,9 +152,11 @@ export class EAUserService extends BaseService { | ||||
|    * 加载用户菜单 | ||||
|    */ | ||||
|   async loadUserMenus() { | ||||
|     return this.asyncRequest('assets/mocks/menu-data.json', {}, 'GET').then(res => { | ||||
|       this.cacheSrv.set(cacheConf.menu, res.menu); | ||||
|       this.menuService.add(res.menu); | ||||
|     return this.asyncRequest(this.$api_get_user_menus, { | ||||
|       appId: this.envSrv.getEnvironment().appId | ||||
|     }).then(res => { | ||||
|       this.cacheSrv.set(cacheConf.menu, res.data); | ||||
|       this.menuService.add(res.data); | ||||
|     }); | ||||
|     // this.request('assets/mocks/menu-data.json', {}, 'GET').subscribe((res: any) => { | ||||
|     //   this.cacheSrv.set(cacheConf.menu, res.menu); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user