...
This commit is contained in:
@@ -31,15 +31,29 @@
|
||||
|
||||
<div class="d-flex">
|
||||
|
||||
<div class="container-input" style="width:150px;margin-left:5px">
|
||||
<input style="text-align:center;height:30px" type="number" id="Code" maxlength="64"
|
||||
@bind-value=Code title="کد احراز" class="input-form input_vk_1" required="" data-val="true" name="Code">
|
||||
<div style="width:200px;margin-left:5px;direction: ltr;">
|
||||
<input maxlength="1" type="text" inputmode="numeric" pattern="[0-9]*"
|
||||
@bind="code1" @oninput="MoveNext"
|
||||
style="width: 40px; height: 40px; text-align: center; border: 2px solid #ccc; border-radius: 5px; font-size: 20px;"
|
||||
@ref="input1" autoFocus />
|
||||
|
||||
<input maxlength="1" type="text" inputmode="numeric" pattern="[0-9]*"
|
||||
@bind="code2" @oninput="MoveNext"
|
||||
style="width: 40px; height: 40px; text-align: center; border: 2px solid #ccc; border-radius: 5px; font-size: 20px;"
|
||||
@ref="input2" />
|
||||
|
||||
<input maxlength="1" type="text" inputmode="numeric" pattern="[0-9]*"
|
||||
@bind="code3" @oninput="MoveNext"
|
||||
style="width: 40px; height: 40px; text-align: center; border: 2px solid #ccc; border-radius: 5px; font-size: 20px;"
|
||||
@ref="input3" />
|
||||
|
||||
<input maxlength="1" type="text" inputmode="numeric" pattern="[0-9]*"
|
||||
@bind="code4" @oninput="OnLastInput"
|
||||
style="width: 40px; height: 40px; text-align: center; border: 2px solid #ccc; border-radius: 5px; font-size: 20px;"
|
||||
@ref="input4" />
|
||||
|
||||
</div>
|
||||
<Button Color="ButtonColor.Primary" Type="ButtonType.Submit" class="btn-dark"
|
||||
style="text-align:center;height:30px" @onclick="ver">
|
||||
احراز
|
||||
</Button>
|
||||
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -51,7 +65,10 @@
|
||||
[Parameter] public EventCallback OnMultipleOfThree { get; set; }
|
||||
public string Username { get; set; }
|
||||
public int ID { get; set; } = 0;
|
||||
public string Code { get; set; } = string.Empty;
|
||||
public string Code { get; set; } = string.Empty;
|
||||
//-----------------
|
||||
private string code1, code2, code3, code4;
|
||||
private ElementReference input1, input2, input3, input4;
|
||||
}
|
||||
@functions{
|
||||
async Task Login()
|
||||
@@ -61,6 +78,7 @@
|
||||
{
|
||||
Mobile=Username
|
||||
});
|
||||
|
||||
visible = false;
|
||||
}
|
||||
async Task ver()
|
||||
@@ -70,4 +88,33 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user