登录接口实现
This commit is contained in:
27
src/app/shared/services/business/environment.service.ts
Normal file
27
src/app/shared/services/business/environment.service.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { cacheConf } from '@conf/cache.conf';
|
||||
import { sysConf } from '@conf/sys.conf';
|
||||
import { BaseService } from '../core/base.service';
|
||||
import { EACacheService } from './../core/cache.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class EAEnvironmentService extends BaseService {
|
||||
constructor(public injector: Injector, private eaCacheSrv: EACacheService) {
|
||||
super(injector);
|
||||
}
|
||||
|
||||
/**
|
||||
* 环境信息
|
||||
*/
|
||||
public get env(): { appId: string; tenantId: string } {
|
||||
const cacheEnv: any = this.eaCacheSrv.get(cacheConf.env);
|
||||
// 附加环境变量
|
||||
const env: { appId: string; tenantId: string } = {
|
||||
appId: cacheEnv?.appId || sysConf.appId,
|
||||
tenantId: cacheEnv?.tenantId || sysConf.tenantId,
|
||||
};
|
||||
return env;
|
||||
}
|
||||
}
|
||||
@ -25,7 +25,7 @@ export class EAUserService extends BaseService {
|
||||
/**
|
||||
* 账号密码登录
|
||||
*/
|
||||
$api_login_by_account = `/scce/cuc/cuc/user/login?_allow_anonymous=true`;
|
||||
$api_login_by_account = `/cuc/user/login?_allow_anonymous=true`;
|
||||
/**
|
||||
* 手机号登录
|
||||
*/
|
||||
@ -112,7 +112,7 @@ export class EAUserService extends BaseService {
|
||||
* @param account 账号
|
||||
* @param password 密码
|
||||
*/
|
||||
loginByAccount(account: string, password: string, sc: string) {
|
||||
loginByAccount(account: string, password: string, sc?: string) {
|
||||
this.request(this.$api_login_by_account, { username: account, password, sc }, 'POST', true, 'FORM').subscribe((res: any) => {
|
||||
if (res?.token) {
|
||||
this.tokenSrv.set({ token: res.token });
|
||||
|
||||
@ -10,3 +10,5 @@ export * from './business/enterprise.service';
|
||||
export * from './business/captcha.service';
|
||||
export * from './business/user.service';
|
||||
export * from './business/sl-platform.service';
|
||||
export * from './business/user.service';
|
||||
export * from './business/environment.service';
|
||||
|
||||
Reference in New Issue
Block a user