edit
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* @Description :
|
||||
* @Description :
|
||||
* @Version : 1.0
|
||||
* @Author : Shiming
|
||||
* @Date : 2021-12-27 10:30:56
|
||||
@ -9,14 +9,11 @@
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
*/
|
||||
|
||||
import { Component, Inject, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { STChange, STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st';
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { DA_SERVICE_TOKEN, ITokenService } from '@delon/auth';
|
||||
|
||||
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';
|
||||
import { AccountService } from '../../services/account.service';
|
||||
@ -30,14 +27,13 @@ export class AccountComponentsCenterEditComponent implements OnInit {
|
||||
record: any;
|
||||
count = 0;
|
||||
type = 'create';
|
||||
isVisibleView = false
|
||||
isVisibleView = false;
|
||||
passwordVisible = false;
|
||||
passwordVisible2 = false;
|
||||
password: any;
|
||||
password2: any;
|
||||
interval$: any;
|
||||
confirmationValidator =
|
||||
(control: FormControl): { [s: string]: boolean } => {
|
||||
confirmationValidator = (control: FormControl): { [s: string]: boolean } => {
|
||||
if (!control.value) {
|
||||
return { required: true };
|
||||
} else if (control?.value !== this.validateForm?.value?.passWord) {
|
||||
@ -51,7 +47,6 @@ export class AccountComponentsCenterEditComponent implements OnInit {
|
||||
};
|
||||
constructor(
|
||||
public router: Router,
|
||||
public ar: ActivatedRoute,
|
||||
private modalRef: NzModalRef,
|
||||
private fb: FormBuilder,
|
||||
public service: AccountService,
|
||||
@ -61,19 +56,21 @@ export class AccountComponentsCenterEditComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
this.initForm();
|
||||
}
|
||||
initForm () {
|
||||
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, [ Validators.required, Validators.maxLength(16), Validators.minLength(8), this.confirmationValidator,]],
|
||||
smsVerifyCode: [null, [Validators.required]],
|
||||
});
|
||||
}
|
||||
initForm() {
|
||||
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, [Validators.required, Validators.maxLength(16), Validators.minLength(8), this.confirmationValidator]],
|
||||
smsVerifyCode: [null, [Validators.required]]
|
||||
});
|
||||
}
|
||||
destroyModal(): void {
|
||||
this.modalRef.destroy();
|
||||
}
|
||||
@ -84,28 +81,28 @@ export class AccountComponentsCenterEditComponent implements OnInit {
|
||||
this.service.msgSrv.success('发送成功');
|
||||
e.preventDefault();
|
||||
this.codeCountDown();
|
||||
}else {
|
||||
} else {
|
||||
this.service.msgSrv.success(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
save() {
|
||||
if(!this.validateForm.valid) {
|
||||
this.service.msgSrv.warning('必填项为空或格式错误,请检查!')
|
||||
if (!this.validateForm.valid) {
|
||||
this.service.msgSrv.warning('必填项为空或格式错误,请检查!');
|
||||
return;
|
||||
}
|
||||
const params = {
|
||||
const params = {
|
||||
...this.validateForm.value
|
||||
};
|
||||
this.service.request(this.service.$api_set_phoneUpdatePassword, params).subscribe((res) => {
|
||||
this.service.request(this.service.$api_set_phoneUpdatePassword, params).subscribe(res => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success('修改密码成功!');
|
||||
this.isVisibleView = true;
|
||||
setTimeout(() => {
|
||||
this.tokenService.clear();
|
||||
this.router.navigate(['/passport/login'])
|
||||
this.modalRef.close()
|
||||
}, 3000)
|
||||
this.router.navigate(['/passport/login']);
|
||||
this.modalRef.close();
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -120,11 +117,11 @@ export class AccountComponentsCenterEditComponent implements OnInit {
|
||||
}, 1000);
|
||||
}
|
||||
handleCancel() {
|
||||
this.isVisibleView = false
|
||||
}
|
||||
handleOK() {
|
||||
this.modalRef.close()
|
||||
this.tokenService.clear();
|
||||
this.router.navigate(['/passport/login'])
|
||||
}
|
||||
this.isVisibleView = false;
|
||||
}
|
||||
handleOK() {
|
||||
this.modalRef.close();
|
||||
this.tokenService.clear();
|
||||
this.router.navigate(['/passport/login']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user