dev #14384 Правка ошибок отображения WPA КофеЛайк: change keydown to input on code enter listener

This commit is contained in:
nikolay 2023-06-21 10:27:05 +04:00
parent 15e9fe7ec4
commit 798ec5e21a

View File

@ -53,14 +53,14 @@ export class LoginComponent implements OnInit, AfterViewInit {
@ViewChild('field2', { static: false }) field2!: ElementRef; @ViewChild('field2', { static: false }) field2!: ElementRef;
@ViewChild('field3', { static: false }) field3!: ElementRef; @ViewChild('field3', { static: false }) field3!: ElementRef;
@HostListener('window:keydown', ['$event']) @HostListener('window:input', ['$event'])
HandlKeyEvents(event: any) { HandlKeyEvents(event: any) {
if (!event.target.classList.contains('field')) return; if (!event.target.classList.contains('field')) return;
const key = event.key.toLocaleLowerCase(); const key = event.data
let elementId = ''; let elementId = '';
switch (key) { switch (key) {
case 'backspace': case null:
elementId = event.target.id; elementId = event.target.id;
event.target.value = ''; event.target.value = '';
const prevInputIndex = this.inputIds.indexOf(elementId) - 1; const prevInputIndex = this.inputIds.indexOf(elementId) - 1;
@ -93,15 +93,19 @@ export class LoginComponent implements OnInit, AfterViewInit {
switch (i) { switch (i) {
case 0: case 0:
this.field.nativeElement.focus(); this.field.nativeElement.focus();
this.field.nativeElement.click();
break; break;
case 1: case 1:
this.field1.nativeElement.focus(); this.field1.nativeElement.focus();
this.field1.nativeElement.click();
break; break;
case 2: case 2:
this.field2.nativeElement.focus(); this.field2.nativeElement.focus();
this.field2.nativeElement.click();
break; break;
case 3: case 3:
this.field3.nativeElement.focus(); this.field3.nativeElement.focus();
this.field3.nativeElement.click();
break; break;
} }
}, 0); }, 0);
@ -155,7 +159,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
} }
submitCode() { submitCode() {
const data = this.codeForm.value; const data = this.codeForm.value;
this.jsonrpc this.jsonrpc
.rpc( .rpc(
{ {