| | |
| | | import { ReuseTabService } from '@delon/abc'; |
| | | import { environment } from '@env/environment'; |
| | | import { CookieService } from 'angular2-cookie/services/cookies.service'; |
| | | import { debounce } from 'rxjs/operators'; |
| | | @Component({ |
| | | selector: 'passport-login', |
| | | templateUrl: './login.component.html', |
| | |
| | | if (this.mobile.invalid || this.captcha.invalid) return; |
| | | } |
| | | this.loading = true; |
| | | this.loginService.validate(this.userName.value, this.password.value).subscribe( |
| | | this.loginService.validate(this.userName.value, this.password.value).subscribe( |
| | | (res: Authorization) => { |
| | | this.validateError['password_incorrect'] = false; |
| | | this.validateError['account_expired'] = false; |
| | | this.validateError['server_offline'] = false; |
| | | if (res.token != null) { |
| | | // 清空路由复用信息 |
| | | this.reuseTabService.clear(); |
| | |
| | | this.router.navigate(['/']); |
| | | } |
| | | }, |
| | | (err: HttpErrorResponse) => { |
| | | (err: HttpErrorResponse) => { |
| | | if (!!err) { |
| | | const errMsg = err.error; |
| | | console.log(errMsg); |
| | |
| | | } else if (errMsg.status === 401 && errMsg.errorCode === 12) { |
| | | this.validateError['account_expired'] = true; |
| | | this.loading = false; |
| | | } else if (!errMsg.status && !errMsg.errorCode) { |
| | | this.validateError['server_offline'] = true; |
| | | this.loading = false; |
| | | } |
| | | } |
| | | } |