登录接口实现

This commit is contained in:
Taric Xin
2021-12-07 15:35:48 +08:00
parent 9167bb35f4
commit 4e0c3a3d03
14 changed files with 425 additions and 248 deletions

View 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;
}
}

View File

@ -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 });