edit
This commit is contained in:
@ -19,7 +19,7 @@ import { BaseService } from '../core/base.service';
|
||||
import { EACacheService } from '../core/cache.service';
|
||||
import { EAEventService } from '../core/event.service';
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class EAUserService extends BaseService {
|
||||
/**
|
||||
@ -57,7 +57,7 @@ export class EAUserService extends BaseService {
|
||||
/**
|
||||
* 根据Token获取用户详情
|
||||
*/
|
||||
$api_get_user_by_token = `/scce/cuc/cuc/user/getUserDetail`;
|
||||
$api_get_user_by_token = `/api/mdc/cuc/user/getUserDetail`;
|
||||
/**
|
||||
* 获取用户菜单
|
||||
*/
|
||||
@ -72,10 +72,11 @@ export class EAUserService extends BaseService {
|
||||
public injector: Injector,
|
||||
public cacheSrv: EACacheService,
|
||||
public eventSrv: EAEventService,
|
||||
public settings: SettingsService,
|
||||
public router: Router,
|
||||
public ar: ActivatedRoute,
|
||||
@Inject(DA_SERVICE_TOKEN) public tokenSrv: ITokenService,
|
||||
private settingSrv: SettingsService,
|
||||
private settingSrv: SettingsService
|
||||
) {
|
||||
super(injector);
|
||||
}
|
||||
@ -97,7 +98,7 @@ export class EAUserService extends BaseService {
|
||||
* @param captcha 验证码
|
||||
*/
|
||||
loginByMobile(mobile: string, captcha: string, sc: string) {
|
||||
this.asyncRequest(this.$api_login_by_mobile, { phone: mobile, smsCode: captcha, sc }, 'POST', true, 'FORM').then((res) => {
|
||||
this.asyncRequest(this.$api_login_by_mobile, { phone: mobile, smsCode: captcha, sc }, 'POST', true, 'FORM').then(res => {
|
||||
if (res?.token) {
|
||||
// this.cacheSrv.set(cacheConf.token, res.token);
|
||||
this.tokenSrv.set({ token: res.token });
|
||||
@ -123,7 +124,7 @@ export class EAUserService extends BaseService {
|
||||
}
|
||||
|
||||
async doAfterLogin() {
|
||||
// await this.loadUserInfo();
|
||||
await this.loadUserInfo();
|
||||
// await this.loadUserMenus();
|
||||
await this.loadUserRoles();
|
||||
}
|
||||
@ -132,8 +133,9 @@ export class EAUserService extends BaseService {
|
||||
* 加载用户信息
|
||||
*/
|
||||
async loadUserInfo() {
|
||||
return this.asyncRequest(this.$api_get_user_by_token).then((res) => {
|
||||
this.cacheSrv.set(cacheConf.user, res);
|
||||
return this.asyncRequest(this.$api_get_user_by_token).then(res => {
|
||||
this.cacheSrv.set(cacheConf.user, res.data);
|
||||
this.settings.setUser(res.data);
|
||||
});
|
||||
}
|
||||
|
||||
@ -141,7 +143,7 @@ export class EAUserService extends BaseService {
|
||||
* 加载用户菜单
|
||||
*/
|
||||
async loadUserMenus() {
|
||||
return this.asyncRequest(this.$api_get_user_menus, { appId: sysConf.appId }).then((res) => {
|
||||
return this.asyncRequest(this.$api_get_user_menus, { appId: sysConf.appId }).then(res => {
|
||||
this.cacheSrv.set(cacheConf.menu, res);
|
||||
});
|
||||
}
|
||||
@ -182,7 +184,7 @@ export class EAUserService extends BaseService {
|
||||
if (res.success === true) {
|
||||
return true;
|
||||
}
|
||||
}),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@ -198,7 +200,7 @@ export class EAUserService extends BaseService {
|
||||
if (res.success === true) {
|
||||
return true;
|
||||
}
|
||||
}),
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user