This commit is contained in:
wangshiming
2022-02-17 14:50:21 +08:00
parent 2e4e4d1574
commit b67e17f1d8
2 changed files with 42 additions and 23 deletions

View File

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

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2022-01-25 16:03:45 * @Date : 2022-01-25 16:03:45
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-02-15 10:40:43 * @LastEditTime : 2022-02-17 14:44:14
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\dynamic-setting\\dynamic-setting-h5\\dynamic-setting-h5.component.ts * @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\dynamic-setting\\dynamic-setting-h5\\dynamic-setting-h5.component.ts
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
*/ */
@ -60,7 +60,7 @@ export class DynamicSettingH5Component implements OnInit {
params = params.map((item: any) => { params = params.map((item: any) => {
console.log(item); console.log(item);
if (item.itemType == 9) { if (item.itemType == 9) {
const files = item.itemValue?.map(({ url, name }: any) => ({ url, name })); const files = item.itemValue?.map(({ response, name }: any) => ({ url:response?.data?.fullFilePath, name }));
return { return {
...item, ...item,
remark: item.remark ? JSON.stringify(item.remark) : null, remark: item.remark ? JSON.stringify(item.remark) : null,