车辆对接

This commit is contained in:
wangshiming
2021-12-28 16:33:45 +08:00
parent 8d381ef42a
commit 1c5ca651ea
12 changed files with 223 additions and 173 deletions

View File

@ -172,7 +172,9 @@ export class AccountComponentsCenterComponent implements OnInit {
const modalRef = this.modalService.create({
nzTitle: '设置/修改登录密码',
nzContent: AccountComponentsCenterEditComponent,
nzComponentParams: { },
nzComponentParams: {
record: this.infoData
},
});
modalRef.afterClose.subscribe((result: any) => {
if (result === true) {

View File

@ -1,7 +1,7 @@
<!--
* @Author: your name
* @Date: 2021-11-29 11:06:01
* @LastEditTime: 2021-12-27 20:37:25
* @LastEditTime: 2021-12-28 14:11:58
* @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-name\edit-name.component.html
@ -57,3 +57,16 @@
<button nz-button nzType="primary" (click)="handleNew()">确定</button>
</ng-template>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleOk" [nzWidth]="600" (nzOnCancel)="handleCancel('1')" [nzFooter]='null' >
<ng-container *nzModalContent>
<nz-result
nzStatus="success"
nzTitle="修改成功!"
nzSubTitle="您已绑定新手机号,以后可用新手机号登录!"
>
<div nz-result-extra>
<button nz-button nzType="primary" (click)="handleCancel('3')">确定</button>
</div>
</nz-result>
</ng-container>
</nz-modal>

View File

@ -24,6 +24,7 @@ export class AccountComponentsEditNameComponent implements OnInit, AfterViewInit
ui!: SFUISchema;
uiView: SFUISchema = {};
isVisibleView = false;
isVisibleOk = false;
formData: any = {};
count = 0;
count2 = 0;
@ -236,6 +237,8 @@ export class AccountComponentsEditNameComponent implements OnInit, AfterViewInit
this.isVisibleView = false
} else if(type === '2') {
console.log(type)
} else if(type === '3') {
this.modal.close()
}
}
handleOK() {
@ -250,8 +253,8 @@ export class AccountComponentsEditNameComponent implements OnInit, AfterViewInit
this.service.http.post(this.service.$api_get_verifyPhone, params).subscribe((res) => {
console.log(res);
if (res.success) {
this.modal.close(true);
this.service.msgSrv.success(res.msg);
this.isVisibleOk = true;
} else {
this.service.msgSrv.warning(res.msg);
}

View File

@ -1,7 +1,7 @@
<!--
* @Author: your name
* @Date: 2021-11-29 13:50:46
* @LastEditTime: 2021-11-29 14:44:30
* @LastEditTime: 2021-12-28 14:02:39
* @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.html
@ -9,13 +9,14 @@
<form nz-form [formGroup]="validateForm">
<nz-form-item>
<nz-form-label nzRequired>新密码</nz-form-label>
<nz-form-control nzErrorTip="请填写反馈类型,20字以内">
<nz-input-group [nzSuffix]="suffixTemplate">
<nz-form-control nzErrorTip="密码格式错误">
<nz-input-group [nzSuffix]="suffixTemplate" name='passWord'>
<input
[type]="passwordVisible ? 'text' : 'password'"
nz-input
placeholder="input password"
placeholder="请输入新密码"
[(ngModel)]="password"
formControlName="passWord"
/>
</nz-input-group>
<ng-template #suffixTemplate>
@ -25,12 +26,13 @@
</nz-form-item>
<nz-form-item>
<nz-form-label nzRequired>确认新密码</nz-form-label>
<nz-form-control nzErrorTip="请填写反馈类型,20字以内">
<nz-input-group [nzSuffix]="suffixTemplate2">
<nz-form-control nzErrorTip="密码不一致">
<nz-input-group [nzSuffix]="suffixTemplate2" name='passWordTo'>
<input
[type]="passwordVisible2 ? 'text' : 'password'"
nz-input
placeholder="input password"
formControlName="passWordTo"
placeholder="请确认输入新密码"
[(ngModel)]="password2"
/>
</nz-input-group>
@ -41,30 +43,25 @@
</nz-form-item>
<nz-form-item>
<nz-form-label nzRequired>手机号</nz-form-label>
158****4444
</nz-form-item>
<nz-form-item>
{{this.record?.phone}}
</nz-form-item>
<nz-form-item>
<nz-form-label
[nzSm]="6"
[nzXs]="24"
nzFor="captcha"
nzFor="smsVerifyCode"
nzRequired
nzTooltipTitle="Please click 'Get captcha'"
[nzTooltipIcon]="captchaTooltipIcon"
>
Captcha
验证码
</nz-form-label>
<nz-form-control
[nzSm]="14"
[nzXs]="24"
nzErrorTip="Please input the captcha you got!"
nzExtra="We must make sure that your are a human."
>
<div nz-row [nzGutter]="8">
<div nz-col [nzSpan]="12">
<input nz-input formControlName="captcha" id="captcha" />
<input nz-input formControlName="smsVerifyCode" id="smsVerifyCode" />
</div>
<div nz-col [nzSpan]="12">
<div nz-col [nzSpan]="12" style="display: flex; align-items: center;">
<button nz-button *ngIf="count < 1;" (click)="getCaptcha($event)">获取验证码</button>
<span *ngIf="count > 1;">{{ count > 0 ? '请等待' + count + 's' : '获取验证码' }}</span>
</div>
@ -74,5 +71,20 @@
</form>
<div *nzModalFooter>
<button nz-button nzType="default" (click)="destroyModal()">取消</button>
<button nz-button nzType="primary" (click)="save()" >保存</button>
<button nz-button nzType="primary" (click)="save()" >确定</button>
</div>
<nz-modal [(nzVisible)]="isVisibleView" [nzWidth]="600" (nzOnCancel)="handleCancel()" [nzFooter]='null' >
<ng-container *nzModalContent>
<nz-result
nzStatus="success"
nzTitle="密码设置成功!"
nzSubTitle="请牢记您的新密码修改密码后需重新登录3秒后自动跳转至登录页..."
>
<div nz-result-extra>
<button nz-button nzType="primary" (click)="handleOK()">重新登录</button>
</div>
</nz-result>
</ng-container>
</nz-modal>

View File

@ -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'])
}
}

View File

@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2021-11-02 11:12:21
* @LastEditTime: 2021-12-27 17:10:47
* @LastEditTime: 2021-12-28 13:52:35
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \scm-ows-ui\src\app\routes\account\services\account.service.ts
@ -31,6 +31,8 @@ export class AccountService extends BaseService {
// 凭证修改手机号
$api_set_voucherUpdatePhone = `/api/mdc/cuc/userBasicInfo/forgetPassword/voucherUpdatePhone`;
// 凭证修改密码
$api_set_phoneUpdatePassword = `/api/mdc/cuc/userBasicInfo/phoneUpdatePassword`;
constructor(public injector: Injector) {
super(injector);
}