edit
This commit is contained in:
@ -32,9 +32,9 @@ export class AuthGuard extends ACLGuard {
|
|||||||
constructor(
|
constructor(
|
||||||
srv: ACLService,
|
srv: ACLService,
|
||||||
public srv1: ACLService,
|
public srv1: ACLService,
|
||||||
private baseService: BaseService,
|
|
||||||
private menuService: MenuService,
|
private menuService: MenuService,
|
||||||
private settings: SettingsService,
|
private settings: SettingsService,
|
||||||
|
private userService: EAUserService,
|
||||||
router: Router,
|
router: Router,
|
||||||
private inject: Injector
|
private inject: Injector
|
||||||
) {
|
) {
|
||||||
@ -62,7 +62,7 @@ export class AuthGuard extends ACLGuard {
|
|||||||
if (!router) {
|
if (!router) {
|
||||||
return type === 1 ? super.canActivate(route, state) : super.canActivateChild(route, state);
|
return type === 1 ? super.canActivate(route, state) : super.canActivateChild(route, state);
|
||||||
}
|
}
|
||||||
return this.baseService
|
return this.userService
|
||||||
.request('/api/mdc/cuc/userAuthority/isUserAdmin', {
|
.request('/api/mdc/cuc/userAuthority/isUserAdmin', {
|
||||||
appUserId: this.settings.user.appUserId
|
appUserId: this.settings.user.appUserId
|
||||||
})
|
})
|
||||||
@ -74,13 +74,14 @@ export class AuthGuard extends ACLGuard {
|
|||||||
return of(true);
|
return of(true);
|
||||||
} else {
|
} 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 => {
|
switchMap(res => {
|
||||||
if (res?.abilities) {
|
if (res?.abilities) {
|
||||||
this.srv1.setAbility(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);
|
return type === 1 ? super.canActivate(route, state) : super.canActivateChild(route, state);
|
||||||
})
|
})
|
||||||
|
|||||||
@ -47,7 +47,7 @@ export class StartupService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let data;
|
let data;
|
||||||
if (this.coreSrv.loginStatus && environment.production) {
|
if (this.coreSrv.loginStatus) {
|
||||||
// 本地菜单
|
// 本地菜单
|
||||||
// data = this.loadMockData();
|
// data = this.loadMockData();
|
||||||
// 远程菜单
|
// 远程菜单
|
||||||
|
|||||||
@ -43,8 +43,8 @@ export class EAUserService extends BaseService {
|
|||||||
// 未设置密码的用户设置用户密码
|
// 未设置密码的用户设置用户密码
|
||||||
public $api_set_password = `/scce/cuc/cuc/userBasicInfo/setPassword`;
|
public $api_set_password = `/scce/cuc/cuc/userBasicInfo/setPassword`;
|
||||||
// 凭证修改密码
|
// 凭证修改密码
|
||||||
// 未登录账号发送验证码
|
// 未登录账号发送验证码
|
||||||
public $getAccountSMVerificationCode = `/api/mdc/cuc/userBasicInfo/forgetPassword/getAccountSMVerificationCode?_allow_anonymous=true`;
|
public $getAccountSMVerificationCode = `/api/mdc/cuc/userBasicInfo/forgetPassword/getAccountSMVerificationCode?_allow_anonymous=true`;
|
||||||
// 凭证修改密码
|
// 凭证修改密码
|
||||||
public $voucherUpdatePassword = `/api/mdc/cuc/userBasicInfo/forgetPassword/voucherUpdatePassword?_allow_anonymous=true`;
|
public $voucherUpdatePassword = `/api/mdc/cuc/userBasicInfo/forgetPassword/voucherUpdatePassword?_allow_anonymous=true`;
|
||||||
// 检测用户名是否存在
|
// 检测用户名是否存在
|
||||||
@ -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() {
|
async loadUserMenus() {
|
||||||
return this.asyncRequest('assets/mocks/menu-data.json', {}, 'GET').then(res => {
|
return this.asyncRequest(this.$api_get_user_menus, {
|
||||||
this.cacheSrv.set(cacheConf.menu, res.menu);
|
appId: this.envSrv.getEnvironment().appId
|
||||||
this.menuService.add(res.menu);
|
}).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.request('assets/mocks/menu-data.json', {}, 'GET').subscribe((res: any) => {
|
||||||
// this.cacheSrv.set(cacheConf.menu, res.menu);
|
// this.cacheSrv.set(cacheConf.menu, res.menu);
|
||||||
|
|||||||
Reference in New Issue
Block a user