This commit is contained in:
Taric Xin
2021-12-27 10:06:54 +08:00
parent aefcd67313
commit 6a3f551509
6 changed files with 42 additions and 27 deletions

View File

@ -105,7 +105,7 @@ export class AccountComponentsEditNameComponent implements OnInit, AfterViewInit
const params = { const params = {
// phoneNumber: phone // phoneNumber: phone
}; };
this.service.request(this.service.$api_get_current_user_info, params, 'POST', true, 'FORM').subscribe((res) => { this.service.request(this.service.$api_get_current_user_smVerification, params, 'POST', true, 'FORM').subscribe((res) => {
console.log(res); console.log(res);
// code==503046 弹出网易盾 // code==503046 弹出网易盾
if (res && res.code === '1') { if (res && res.code === '1') {

View File

@ -7,17 +7,18 @@
* @FilePath: \tms-obc-web\src\app\routes\account\components\edit\edit.component.ts * @FilePath: \tms-obc-web\src\app\routes\account\components\edit\edit.component.ts
*/ */
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormGroup, Validators,ValidatorFn } from '@angular/forms'; import { FormBuilder, FormGroup, Validators, ValidatorFn } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { STChange, STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st'; import { STChange, STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form'; import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer'; import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer';
import { NzFormTooltipIcon } from 'ng-zorro-antd/form'; import { NzFormTooltipIcon } from 'ng-zorro-antd/form';
import { NzModalRef } from 'ng-zorro-antd/modal'; import { NzModalRef } from 'ng-zorro-antd/modal';
import { AccountService } from '../../services/account.service';
@Component({ @Component({
selector: 'app-account-components-edit', selector: 'app-account-components-edit',
templateUrl: './edit-password.component.html', templateUrl: './edit-password.component.html'
}) })
export class AccountComponentsCenterEditComponent implements OnInit { export class AccountComponentsCenterEditComponent implements OnInit {
url = `/rule?_allow_anonymous=true`; url = `/rule?_allow_anonymous=true`;
@ -25,8 +26,8 @@ export class AccountComponentsCenterEditComponent implements OnInit {
record: any; record: any;
count = 0; count = 0;
type = 'create'; type = 'create';
passwordVisible = false; passwordVisible = false;
passwordVisible2 = false; passwordVisible2 = false;
password?: string; password?: string;
password2?: string; password2?: string;
interval$: any; interval$: any;
@ -40,8 +41,8 @@ export class AccountComponentsCenterEditComponent implements OnInit {
public ar: ActivatedRoute, public ar: ActivatedRoute,
private modalRef: NzModalRef, private modalRef: NzModalRef,
private fb: FormBuilder, private fb: FormBuilder,
) { public service: AccountService
} ) {}
ngOnInit() { ngOnInit() {
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
@ -51,11 +52,11 @@ export class AccountComponentsCenterEditComponent implements OnInit {
Validators.required, Validators.required,
Validators.maxLength(16), Validators.maxLength(16),
Validators.minLength(8), Validators.minLength(8),
Validators.pattern('^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z-_]{8,16}$'), 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)]], passWordTo: [null, [this.confirmPasswordValidator, Validators.required, Validators.maxLength(16), Validators.minLength(8)]],
voucher: [null, [Validators.required]], voucher: [null, [Validators.required]]
}); });
} }
@ -63,19 +64,30 @@ export class AccountComponentsCenterEditComponent implements OnInit {
this.modalRef.destroy(); this.modalRef.destroy();
} }
getCaptcha(e: MouseEvent): void { getCaptcha(e: MouseEvent): void {
e.preventDefault(); this.service.request(this.service.$api_get_current_user_smVerification).subscribe(res => {
this.codeCountDown() console.log(res);
// code==503046 弹出网易盾
if (res && res.code === '1') {
this.service.msgSrv.success('发送成功');
e.preventDefault();
this.codeCountDown();
} else if (res.code === '503046') {
// this.dun.popUp();
} else {
this.service.msgSrv.success(res.msg);
}
});
} }
save() { save() {
// const params = { id: this.record.id, name: this.validateForm.value.name }; // const params = { id: this.record.id, name: this.validateForm.value.name };
// this.service.request(this.service.$api_feedbackTypeupdate, params).subscribe((res) => { // this.service.request(this.service.$api_feedbackTypeupdate, params).subscribe((res) => {
// if (res) { // if (res) {
// this.modalRef.close(true); // this.modalRef.close(true);
// this.service.msgSrv.success('保存成功!'); // this.service.msgSrv.success('保存成功!');
// } else { // } else {
// this.service.msgSrv.error(res.msg); // this.service.msgSrv.error(res.msg);
// } // }
// }); // });
} }
/* code倒计时 */ /* code倒计时 */
codeCountDown() { codeCountDown() {

View File

@ -20,6 +20,9 @@ export class AccountService extends BaseService {
// 获取当前登录用户详情 // 获取当前登录用户详情
$api_get_current_user_info = `/api/mdc/cuc/user/getUserInfo`; $api_get_current_user_info = `/api/mdc/cuc/user/getUserInfo`;
// 根据当前登录用户绑定的手机号码获取短信验证码
$api_get_current_user_smVerification = `/api/mdc/pbc/smsSend/getSmVerificationCodeByToken`;
constructor(public injector: Injector) { constructor(public injector: Injector) {
super(injector); super(injector);
} }

View File

@ -108,7 +108,7 @@ export class UserRetrievePasswordComponent implements OnInit, AfterViewInit {
submitForm2() { submitForm2() {
for (const i in this.formGroup2.controls) { for (const i in this.formGroup2.controls) {
if ( this.formGroup2.controls[i]) { if (this.formGroup2.controls[i]) {
this.formGroup2.controls[i].markAsDirty(); this.formGroup2.controls[i].markAsDirty();
this.formGroup2.controls[i].updateValueAndValidity(); this.formGroup2.controls[i].updateValueAndValidity();
} }
@ -145,8 +145,8 @@ export class UserRetrievePasswordComponent implements OnInit, AfterViewInit {
return; return;
} }
if (this.formGroup1.value.phone) { if (this.formGroup1.value.phone) {
this.service.http this.service
.post(`${this.service.$getAccountSMVerificationCode}`, null, { phoneNumber: this.formGroup1.value.phone }) .request(`${this.service.$api_send_sms_by_mobile}`, { phoneNumber: this.formGroup1.value.phone })
.subscribe((res: any) => { .subscribe((res: any) => {
// console.log(res, 'res'); // console.log(res, 'res');
if (res.success) { if (res.success) {

View File

@ -14,7 +14,7 @@ import { BaseService } from '../core/base.service';
}) })
export class EACaptchaService extends BaseService { export class EACaptchaService extends BaseService {
// 通过手机号发送短信验证码 // 通过手机号发送短信验证码
private $api_send_sms_by_mobile = `/scm/sms/sms/verification/getSMVerificationCode?_allow_anonymous=true&_allow_badcode=true`; private $api_send_sms_by_mobile = `/api/mdc/pbc/smsSend/getSMVerificationCode?_allow_anonymous=true&_allow_badcode=true`;
// 验证手机号为平台用户后发送短信验证码 // 验证手机号为平台用户后发送短信验证码
private $api_send_sms__by_validate_mobile = `/chiauserBasicInfo/forgetPassword/getAccountSMVerificationCode`; private $api_send_sms__by_validate_mobile = `/chiauserBasicInfo/forgetPassword/getAccountSMVerificationCode`;

View File

@ -38,8 +38,8 @@ export class EAUserService extends BaseService {
public $api_get_agreement_info = `/scce/pbc/pbc/agreementInfo/getAgreementInfoByType?_allow_anonymous=true`; public $api_get_agreement_info = `/scce/pbc/pbc/agreementInfo/getAgreementInfoByType?_allow_anonymous=true`;
// 未登录验证身份 // 未登录验证身份
public $forgetPasswordVerifyIdentity = `/scm/cuc/cuc/userBasicInfo/forgetPassword/verifyIdentity?_allow_anonymous=true`; public $forgetPasswordVerifyIdentity = `/scm/cuc/cuc/userBasicInfo/forgetPassword/verifyIdentity?_allow_anonymous=true`;
// 未登录账号发送验证码 // 通过手机号发送短信验证码
public $getAccountSMVerificationCode = `/scm/cuc/cuc/userBasicInfo/forgetPassword/getAccountSMVerificationCode?_allow_anonymous=true`; public $api_send_sms_by_mobile = `/api/mdc/pbc/smsSend/getSMVerificationCode?_allow_anonymous=true&_allow_badcode=true`;
// 未设置密码的用户设置用户密码 // 未设置密码的用户设置用户密码
public $api_set_password = `/scce/cuc/cuc/userBasicInfo/setPassword`; public $api_set_password = `/scce/cuc/cuc/userBasicInfo/setPassword`;
// 凭证修改密码 // 凭证修改密码