fengxiang
2018-06-06 50223d066f7bb4446e47467463783b7f0170f889
src/app/routes/passport/login/login.component.ts
@@ -11,6 +11,7 @@
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',
@@ -85,8 +86,11 @@
            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();
@@ -99,7 +103,7 @@
                       this.router.navigate(['/']);
                   }
                },
                (err: HttpErrorResponse) => {
                (err: HttpErrorResponse) => {
                    if (!!err) {
                        const errMsg = err.error;
                        console.log(errMsg);
@@ -109,6 +113,9 @@
                       } 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;
                       }
                    }                  
                }