From 359a1a1966a999eeacb42c2c30d41990926d7d7e Mon Sep 17 00:00:00 2001 From: gofnnp Date: Sat, 24 Sep 2022 11:13:00 +0400 Subject: [PATCH] =?UTF-8?q?dev=20#12720=20=D1=81=D0=B4=D0=B5=D0=BB=D0=B0?= =?UTF-8?q?=D0=BB=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=BE=D0=BD=D0=B0?= =?UTF-8?q?=D0=BB=20"=D0=9E=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BA=D0=BE=D0=B4=20=D0=BF=D0=BE=D0=B2=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=BD=D0=BE"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/account/auth/auth.component.html | 5 +++++ .../pages/account/auth/auth.component.scss | 17 ++++++++++++++--- src/app/pages/account/auth/auth.component.ts | 19 ++++++++++++++++++- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/app/pages/account/auth/auth.component.html b/src/app/pages/account/auth/auth.component.html index f84c712..b7a22fc 100644 --- a/src/app/pages/account/auth/auth.component.html +++ b/src/app/pages/account/auth/auth.component.html @@ -86,6 +86,11 @@ >

+

+ Не пришел код? + Отправить повторно + через {{timeLeft}}с +

Пароль введен неверно

diff --git a/src/app/pages/account/auth/auth.component.scss b/src/app/pages/account/auth/auth.component.scss index d677247..97beb28 100644 --- a/src/app/pages/account/auth/auth.component.scss +++ b/src/app/pages/account/auth/auth.component.scss @@ -1,6 +1,7 @@ :host { - display: flex; - justify-content: center; + display: flex; + justify-content: center; + .woocommerce-form-login__submit { width: 150px; } @@ -18,6 +19,7 @@ font-weight: 700; font-size: 20px; line-height: 24px; + &::before { content: ""; width: 19px; @@ -48,6 +50,7 @@ width: 80%; margin-bottom: 16px; max-width: 400px; + .button { width: 100%; font-weight: 600; @@ -62,6 +65,7 @@ font-size: 16px; line-height: 20px; } + label { display: inline-block; margin-bottom: 8px; @@ -72,6 +76,7 @@ font-size: 18px; line-height: 22px; } + .input-text { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", @@ -87,9 +92,15 @@ border-radius: 4px; width: 100%; } + + .resend-code { + color: #0d457e; + font-weight: 600; + } } + .decoration-pattern { width: calc(100% - 24px); height: 34px; } -} +} \ No newline at end of file diff --git a/src/app/pages/account/auth/auth.component.ts b/src/app/pages/account/auth/auth.component.ts index 0279005..b6eed35 100644 --- a/src/app/pages/account/auth/auth.component.ts +++ b/src/app/pages/account/auth/auth.component.ts @@ -21,6 +21,7 @@ export class AuthComponent { public phoneToConfirm!: string; public loading = false; public errorConfirmCode: boolean = false; + timeLeft: number = 0; constructor( private phoneFormatter: FormatPhoneService, @@ -32,10 +33,18 @@ export class AuthComponent { ) { } - getCode(event: SubmitEvent): void { + getCode(event: any): void { event.preventDefault(); this.loading = true; this.phoneToConfirm = '+' + this.phone.replace(/\D/g, ''); + if (this.timeLeft) { + this.messageService.add({ + severity: 'custom', + summary: `Отправить повторно можно через ${this.timeLeft}с`, + }); + this.loading = false; + return; + } this.jsonrpc.rpc({ method: 'sendVerifyByPhone', params: [this.phoneToConfirm] @@ -49,6 +58,14 @@ export class AuthComponent { } if (result.code === 0) { this.isCodeConfirm = true; + this.timeLeft = 60; + const interval = setInterval(() => { + if(this.timeLeft > 0) { + this.timeLeft--; + } else { + clearInterval(interval); + } + },1000) } this.loading = false; },