|
@@ -99,10 +99,7 @@ export class UserLoginComponent implements OnInit, OnDestroy {
|
|
|
this.state = res.data.state;
|
|
|
this.captchaType = res.data.captcha;
|
|
|
//init image captcha
|
|
|
- this.imageCaptchaService.captcha({ state: this.state, captcha: this.captchaType }).subscribe(res => {
|
|
|
- this.imageCaptcha = res.data.image;
|
|
|
- this.cdr.detectChanges();
|
|
|
- });
|
|
|
+ this.getImageCaptcha();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -113,8 +110,13 @@ export class UserLoginComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
getImageCaptcha(): void {
|
|
|
this.imageCaptchaService.captcha({ state: this.state, captcha: this.captchaType }).subscribe(res => {
|
|
|
- this.imageCaptcha = res.data.image;
|
|
|
- this.cdr.detectChanges();
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.imageCaptcha = res.data.image;
|
|
|
+ this.cdr.detectChanges();
|
|
|
+ } else {
|
|
|
+ //令牌失效时,重新刷新页面
|
|
|
+ window.location.reload();
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|