From 6a3f551509aacd777f5979107e9c2a9cf80a6ca2 Mon Sep 17 00:00:00 2001 From: Taric Xin Date: Mon, 27 Dec 2021 10:06:54 +0800 Subject: [PATCH] edit --- .../edit-name/edit-name.component.ts | 2 +- .../edit-password/edit-password.component.ts | 52 ++++++++++++------- .../account/services/account.service.ts | 3 ++ .../retrieve-password.component.ts | 6 +-- .../services/business/captcha.service.ts | 2 +- .../shared/services/business/user.service.ts | 4 +- 6 files changed, 42 insertions(+), 27 deletions(-) diff --git a/src/app/routes/account/components/edit-name/edit-name.component.ts b/src/app/routes/account/components/edit-name/edit-name.component.ts index e6d05807..86c8bb08 100644 --- a/src/app/routes/account/components/edit-name/edit-name.component.ts +++ b/src/app/routes/account/components/edit-name/edit-name.component.ts @@ -105,7 +105,7 @@ export class AccountComponentsEditNameComponent implements OnInit, AfterViewInit const params = { // 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); // code==503046 弹出网易盾 if (res && res.code === '1') { diff --git a/src/app/routes/account/components/edit-password/edit-password.component.ts b/src/app/routes/account/components/edit-password/edit-password.component.ts index fb6ff72a..e6929a3d 100644 --- a/src/app/routes/account/components/edit-password/edit-password.component.ts +++ b/src/app/routes/account/components/edit-password/edit-password.component.ts @@ -7,17 +7,18 @@ * @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 { 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'; +import { AccountService } from '../../services/account.service'; @Component({ selector: 'app-account-components-edit', - templateUrl: './edit-password.component.html', + templateUrl: './edit-password.component.html' }) export class AccountComponentsCenterEditComponent implements OnInit { url = `/rule?_allow_anonymous=true`; @@ -25,8 +26,8 @@ export class AccountComponentsCenterEditComponent implements OnInit { record: any; count = 0; type = 'create'; - passwordVisible = false; - passwordVisible2 = false; + passwordVisible = false; + passwordVisible2 = false; password?: string; password2?: string; interval$: any; @@ -40,8 +41,8 @@ export class AccountComponentsCenterEditComponent implements OnInit { public ar: ActivatedRoute, private modalRef: NzModalRef, private fb: FormBuilder, - ) { - } + public service: AccountService + ) {} ngOnInit() { this.validateForm = this.fb.group({ @@ -51,11 +52,11 @@ export class AccountComponentsCenterEditComponent implements OnInit { Validators.required, Validators.maxLength(16), 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)]], - voucher: [null, [Validators.required]], + voucher: [null, [Validators.required]] }); } @@ -63,19 +64,30 @@ export class AccountComponentsCenterEditComponent implements OnInit { this.modalRef.destroy(); } getCaptcha(e: MouseEvent): void { - e.preventDefault(); - this.codeCountDown() + this.service.request(this.service.$api_get_current_user_smVerification).subscribe(res => { + 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() { - // 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); - // } - // }); + // 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() { diff --git a/src/app/routes/account/services/account.service.ts b/src/app/routes/account/services/account.service.ts index d0adea3d..5196e0b6 100644 --- a/src/app/routes/account/services/account.service.ts +++ b/src/app/routes/account/services/account.service.ts @@ -20,6 +20,9 @@ export class AccountService extends BaseService { // 获取当前登录用户详情 $api_get_current_user_info = `/api/mdc/cuc/user/getUserInfo`; + + // 根据当前登录用户绑定的手机号码获取短信验证码 + $api_get_current_user_smVerification = `/api/mdc/pbc/smsSend/getSmVerificationCodeByToken`; constructor(public injector: Injector) { super(injector); } diff --git a/src/app/routes/passport/components/retrieve-password/retrieve-password.component.ts b/src/app/routes/passport/components/retrieve-password/retrieve-password.component.ts index a5c9814f..70f2efb0 100644 --- a/src/app/routes/passport/components/retrieve-password/retrieve-password.component.ts +++ b/src/app/routes/passport/components/retrieve-password/retrieve-password.component.ts @@ -108,7 +108,7 @@ export class UserRetrievePasswordComponent implements OnInit, AfterViewInit { submitForm2() { 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].updateValueAndValidity(); } @@ -145,8 +145,8 @@ export class UserRetrievePasswordComponent implements OnInit, AfterViewInit { return; } if (this.formGroup1.value.phone) { - this.service.http - .post(`${this.service.$getAccountSMVerificationCode}`, null, { phoneNumber: this.formGroup1.value.phone }) + this.service + .request(`${this.service.$api_send_sms_by_mobile}`, { phoneNumber: this.formGroup1.value.phone }) .subscribe((res: any) => { // console.log(res, 'res'); if (res.success) { diff --git a/src/app/shared/services/business/captcha.service.ts b/src/app/shared/services/business/captcha.service.ts index 72d31eb9..73cfad31 100644 --- a/src/app/shared/services/business/captcha.service.ts +++ b/src/app/shared/services/business/captcha.service.ts @@ -14,7 +14,7 @@ import { BaseService } from '../core/base.service'; }) 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`; diff --git a/src/app/shared/services/business/user.service.ts b/src/app/shared/services/business/user.service.ts index 0aed939d..83e1f246 100644 --- a/src/app/shared/services/business/user.service.ts +++ b/src/app/shared/services/business/user.service.ts @@ -38,8 +38,8 @@ export class EAUserService extends BaseService { 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 $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`; // 凭证修改密码