手机登录

This commit is contained in:
Taric Xin
2021-12-07 19:53:27 +08:00
parent 01258211b3
commit 4ad7282e51
2 changed files with 6 additions and 9 deletions

View File

@ -188,11 +188,9 @@ export class UserLoginComponent implements OnInit, OnDestroy {
if (!this.captchaSF.valid) {
return;
}
// this.userSrv.loginByCaptcha(this.captchaSF.value.phone, this.captchaSF.value.smsCode, this.captchaSF.value.sc);
this.userSrv.loginByMobile(this.captchaSF.value.phone, this.captchaSF.value.smsCode, this.captchaSF.value.sc);
} else {
this.accountSF.validator({ emitError: true });
console.log(this.accountSF.value);
if (!this.accountSF.valid) {
return;
}

View File

@ -29,7 +29,7 @@ export class EAUserService extends BaseService {
/**
* 手机号登录
*/
$api_login_by_mobile = `/scce/cuc/cuc/user/sms/login?_allow_anonymous=true`;
$api_login_by_mobile = `/api/mdc/cuc/user/sms/login?_allow_anonymous=true`;
// 登录路径
private $api_login = `/scce/cuc/cuc/user/login?_allow_anonymous=true`;
private $api_captcha_login = `/scce/cuc/cuc/user/sms/login?_allow_anonymous=true`;
@ -99,10 +99,10 @@ export class EAUserService extends BaseService {
loginByMobile(mobile: string, captcha: string, sc: string) {
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.cacheSrv.set(cacheConf.token, res.token);
this.tokenSrv.set({ token: res.token });
this.doAfterLogin();
// this.eventSrv.event.emit(eventConf.reflesh_login_status);
this.router.navigate([this.ar.snapshot.queryParams.returnUrl || '/']);
this.router.navigate(['/']);
}
});
}
@ -117,8 +117,7 @@ export class EAUserService extends BaseService {
if (res?.token) {
this.tokenSrv.set({ token: res.token });
this.doAfterLogin();
this.router.navigate([this.ar.snapshot.queryParams.returnUrl || '/']);
// this.eventSrv.event.emit(eventConf.reflesh_login_status, this.ar.snapshot.queryParams.returnUrl || '/');
this.router.navigate(['/']);
}
});
}