个人中心
This commit is contained in:
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* @Author: your name
|
||||
* @Date: 2021-11-29 13:50:46
|
||||
* @LastEditTime: 2021-11-29 14:58:33
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
* @FilePath: \tms-obc-web\src\app\routes\account\components\edit\edit.component.ts
|
||||
*/
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators,ValidatorFn } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { STChange, STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st';
|
||||
import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
|
||||
import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer';
|
||||
import { NzFormTooltipIcon } from 'ng-zorro-antd/form';
|
||||
import { NzModalRef } from 'ng-zorro-antd/modal';
|
||||
|
||||
@Component({
|
||||
selector: 'app-account-components-edit',
|
||||
templateUrl: './edit-password.component.html',
|
||||
})
|
||||
export class AccountComponentsCenterEditComponent implements OnInit {
|
||||
url = `/rule?_allow_anonymous=true`;
|
||||
validateForm!: FormGroup;
|
||||
record: any;
|
||||
count = 0;
|
||||
type = 'create';
|
||||
passwordVisible = false;
|
||||
passwordVisible2 = false;
|
||||
password?: string;
|
||||
password2?: string;
|
||||
interval$: any;
|
||||
confirmPasswordValidator!: ValidatorFn;
|
||||
captchaTooltipIcon: NzFormTooltipIcon = {
|
||||
type: 'info-circle',
|
||||
theme: 'twotone'
|
||||
};
|
||||
constructor(
|
||||
public router: Router,
|
||||
public ar: ActivatedRoute,
|
||||
private modalRef: NzModalRef,
|
||||
private fb: FormBuilder,
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.validateForm = this.fb.group({
|
||||
passWord: [
|
||||
null,
|
||||
[
|
||||
Validators.required,
|
||||
Validators.maxLength(16),
|
||||
Validators.minLength(8),
|
||||
Validators.pattern('^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z-_]{8,16}$'),
|
||||
],
|
||||
],
|
||||
passWordTo: [null, [this.confirmPasswordValidator, Validators.required, Validators.maxLength(16), Validators.minLength(8)]],
|
||||
voucher: [null, [Validators.required]],
|
||||
});
|
||||
}
|
||||
|
||||
destroyModal(): void {
|
||||
this.modalRef.destroy();
|
||||
}
|
||||
getCaptcha(e: MouseEvent): void {
|
||||
e.preventDefault();
|
||||
this.codeCountDown()
|
||||
}
|
||||
save() {
|
||||
// const params = { id: this.record.id, name: this.validateForm.value.name };
|
||||
// this.service.request(this.service.$api_feedbackTypeupdate, params).subscribe((res) => {
|
||||
// if (res) {
|
||||
// this.modalRef.close(true);
|
||||
// this.service.msgSrv.success('保存成功!');
|
||||
// } else {
|
||||
// this.service.msgSrv.error(res.msg);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
/* code倒计时 */
|
||||
codeCountDown() {
|
||||
this.count = 59;
|
||||
this.interval$ = setInterval(() => {
|
||||
this.count -= 1;
|
||||
if (this.count <= 0) {
|
||||
clearInterval(this.interval$);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
submitForm(): void {
|
||||
// tslint:disable-next-line: forin
|
||||
for (const i in this.validateForm.controls) {
|
||||
this.validateForm.controls[i].markAsDirty();
|
||||
this.validateForm.controls[i].updateValueAndValidity();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user