From 50223d066f7bb4446e47467463783b7f0170f889 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Wed, 06 Jun 2018 13:59:30 +0800
Subject: [PATCH] 登录失效拦截完善

---
 src/app/routes/passport/login/login.component.ts |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/app/routes/passport/login/login.component.ts b/src/app/routes/passport/login/login.component.ts
index a793455..f0ee060 100644
--- a/src/app/routes/passport/login/login.component.ts
+++ b/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;
                        }
                     }                  
                 }

--
Gitblit v1.8.0