fix bug
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ErrorData, SFComponent, SFSchema, SFStringWidgetSchema, SFUISchema } from '@delon/form';
|
||||
import { _HttpClient } from '@delon/theme';
|
||||
// import { CaptchaComponent } from '@shared';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalRef } from 'ng-zorro-antd/modal';
|
||||
import { Observable, Observer } from 'rxjs';
|
||||
import { interval, Observable, Observer } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { AccountService } from '../../services/account.service';
|
||||
|
||||
@Component({
|
||||
@ -33,7 +34,7 @@ export class AccountComponentsEditNameComponent implements OnInit, AfterViewInit
|
||||
codeTips: any;
|
||||
interval$: any;
|
||||
|
||||
constructor(private modal: NzModalRef, public msgSrv: NzMessageService, public http: _HttpClient, public service: AccountService) {}
|
||||
constructor(private modal: NzModalRef, public msgSrv: NzMessageService, public http: _HttpClient, public service: AccountService,private cdr: ChangeDetectorRef,) {}
|
||||
ngAfterViewInit(): void {
|
||||
// this.dun.init();
|
||||
}
|
||||
@ -142,7 +143,7 @@ export class AccountComponentsEditNameComponent implements OnInit, AfterViewInit
|
||||
// code==503046 弹出网易盾
|
||||
if (res && res.code === '1') {
|
||||
this.service.msgSrv.success('发送成功');
|
||||
this.codeCountDown();
|
||||
this.createInterval();
|
||||
} else if (res.code === '503046') {
|
||||
// this.dun.popUp();
|
||||
} else {
|
||||
@ -159,7 +160,7 @@ export class AccountComponentsEditNameComponent implements OnInit, AfterViewInit
|
||||
// code==503046 弹出网易盾
|
||||
if (res && res.code === '1') {
|
||||
this.service.msgSrv.success('发送成功');
|
||||
this.codeCountDown2();
|
||||
this.createInterval2();
|
||||
} else if (res.code === '503046') {
|
||||
// this.dun.popUp();
|
||||
} else {
|
||||
@ -168,28 +169,46 @@ export class AccountComponentsEditNameComponent implements OnInit, AfterViewInit
|
||||
});
|
||||
}
|
||||
|
||||
/* code倒计时 */
|
||||
codeCountDown() {
|
||||
// /* code倒计时 */
|
||||
// codeCountDown() {
|
||||
// this.count = 59;
|
||||
// this.interval$ = setInterval(() => {
|
||||
// this.count -= 1;
|
||||
// if (this.count <= 0) {
|
||||
// clearInterval(this.interval$);
|
||||
// }
|
||||
// }, 1000);
|
||||
// }
|
||||
private createInterval() {
|
||||
this.count = 59;
|
||||
this.interval$ = setInterval(() => {
|
||||
this.count -= 1;
|
||||
if (this.count <= 0) {
|
||||
clearInterval(this.interval$);
|
||||
}
|
||||
}, 1000);
|
||||
interval(1000)
|
||||
.pipe(take(60))
|
||||
.subscribe((x: any) => {
|
||||
this.count = 59 - (x + 1);
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
codeCountDown2() {
|
||||
private createInterval2() {
|
||||
this.count2 = 59;
|
||||
this.interval$ = setInterval(() => {
|
||||
this.count2 -= 1;
|
||||
if (this.count <= 0) {
|
||||
clearInterval(this.interval$);
|
||||
}
|
||||
}, 1000);
|
||||
interval(1000)
|
||||
.pipe(take(60))
|
||||
.subscribe((x: any) => {
|
||||
this.count2 = 59 - (x + 1);
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
}
|
||||
// codeCountDown2() {
|
||||
// this.count2 = 59;
|
||||
// this.interval$ = setInterval(() => {
|
||||
// this.count2 -= 1;
|
||||
// if (this.count <= 0) {
|
||||
// clearInterval(this.interval$);
|
||||
// }
|
||||
// }, 1000);
|
||||
// }
|
||||
/* 网易盾验证通过 */
|
||||
captchaDone(validate: any) {
|
||||
this.codeCountDown();
|
||||
this.createInterval();
|
||||
}
|
||||
|
||||
getInfo() {
|
||||
|
||||
Reference in New Issue
Block a user