车辆对接
This commit is contained in:
@ -1,15 +1,17 @@
|
||||
/*
|
||||
* @Author: your name
|
||||
* @Date: 2021-11-29 13:50:46
|
||||
* @LastEditTime: 2021-11-29 14:58:33
|
||||
* @LastEditTime: 2021-12-28 14:19:32
|
||||
* @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 { 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 { 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';
|
||||
@ -21,17 +23,25 @@ import { AccountService } from '../../services/account.service';
|
||||
templateUrl: './edit-password.component.html'
|
||||
})
|
||||
export class AccountComponentsCenterEditComponent implements OnInit {
|
||||
url = `/rule?_allow_anonymous=true`;
|
||||
validateForm!: FormGroup;
|
||||
record: any;
|
||||
count = 0;
|
||||
type = 'create';
|
||||
isVisibleView = false
|
||||
passwordVisible = false;
|
||||
passwordVisible2 = false;
|
||||
password?: string;
|
||||
password2?: string;
|
||||
password: any;
|
||||
password2: any;
|
||||
interval$: any;
|
||||
confirmPasswordValidator!: ValidatorFn;
|
||||
confirmationValidator =
|
||||
(control: FormControl): { [s: string]: boolean } => {
|
||||
if (!control.value) {
|
||||
return { required: true };
|
||||
} else if (control?.value !== this.validateForm?.value?.passWord) {
|
||||
return { confirm: true, error: true };
|
||||
}
|
||||
return {};
|
||||
};
|
||||
captchaTooltipIcon: NzFormTooltipIcon = {
|
||||
type: 'info-circle',
|
||||
theme: 'twotone'
|
||||
@ -41,25 +51,27 @@ export class AccountComponentsCenterEditComponent implements OnInit {
|
||||
public ar: ActivatedRoute,
|
||||
private modalRef: NzModalRef,
|
||||
private fb: FormBuilder,
|
||||
public service: AccountService
|
||||
public service: AccountService,
|
||||
@Inject(DA_SERVICE_TOKEN) private tokenService: ITokenService
|
||||
) {}
|
||||
|
||||
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]]
|
||||
});
|
||||
this.initForm();
|
||||
console.log(this.record.phone)
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
@ -71,23 +83,36 @@ export class AccountComponentsCenterEditComponent implements OnInit {
|
||||
this.service.msgSrv.success('发送成功');
|
||||
e.preventDefault();
|
||||
this.codeCountDown();
|
||||
} else if (res.code === '503046') {
|
||||
// this.dun.popUp();
|
||||
} else {
|
||||
}else {
|
||||
this.service.msgSrv.success(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
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);
|
||||
// }
|
||||
// });
|
||||
if(!this.validateForm.valid) {
|
||||
this.service.msgSrv.warning('必填项为空或格式错误,请检查!')
|
||||
return;
|
||||
}
|
||||
console.log(this.validateForm)
|
||||
console.log(this.validateForm.value)
|
||||
const params = {
|
||||
...this.validateForm.value
|
||||
};
|
||||
console.log(params)
|
||||
|
||||
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)
|
||||
} else {
|
||||
this.service.msgSrv.error(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
/* code倒计时 */
|
||||
codeCountDown() {
|
||||
@ -99,11 +124,12 @@ export class AccountComponentsCenterEditComponent implements OnInit {
|
||||
}
|
||||
}, 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();
|
||||
}
|
||||
}
|
||||
handleCancel() {
|
||||
this.isVisibleView = false
|
||||
}
|
||||
handleOK() {
|
||||
this.modalRef.close()
|
||||
this.tokenService.clear();
|
||||
this.router.navigate(['/passport/login'])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user