@using Common.Validation @using HushianWebApp.Service @inject AuthService AuthService @inject VerificationService verificationService;
نیاز برای ارتباط با کارشناسان وارد شود
@if (ID==0) {
} else{
}
@code { private bool visible = false; [Parameter] public EventCallback OnMultipleOfThree { get; set; } public string Username { get; set; } public int ID { get; set; } = 0; public string Code { get; set; } = string.Empty; //----------------- private string code1, code2, code3, code4; private ElementReference input1, input2, input3, input4; string validateStyleUser=""; } @functions{ async Task Login() { if (Username.Replace("-","").CheckMobile()) { visible = true; ID = await AuthService.login(new Common.Models.Auth.UserSide.AuthRequestFromUserSide() { Mobile = Username.Replace("-", "") }); validateStyleUser = ""; visible = false; } else { validateStyleUser =" border: 2px solid red; border-radius: 4px;"; } } async Task ver() { visible = true; if(await AuthService.Verificationlogin(ID, Code)) await OnMultipleOfThree.InvokeAsync(); visible = false; } private async Task MoveNext(ChangeEventArgs e) { if (e.Value?.ToString()?.Length == 1) { if (input1.Context == null) return; if (string.IsNullOrEmpty(code1)) await input2.FocusAsync(); else if (string.IsNullOrEmpty(code2)) await input3.FocusAsync(); else if (string.IsNullOrEmpty(code3)) await input4.FocusAsync(); else if (string.IsNullOrEmpty(code4)) { Code = $"{code1}{code2}{code3}{code4}"; } } } private async Task OnLastInput(ChangeEventArgs e) { code4 = e.Value?.ToString(); if (!string.IsNullOrEmpty(code4) && code4.Length == 1) { Code = $"{code1}{code2}{code3}{code4}"; await ver(); } } }