This commit is contained in:
mmrbnjd
2025-10-24 14:26:20 +03:30
parent 58975ce589
commit 214112a92a
21 changed files with 559 additions and 2893 deletions

View File

@@ -1,7 +1,18 @@
@using Common.Validation
@using HushianWebApp.Service
@using HushianWebApp.Services
@inject AuthService AuthService
@inject VerificationService verificationService;
@inject NavigationManager navigationManager;
@page "/UserPanelLogin"
@layout UserPanelLayout
@inject ILocalStorageService localStorageService;
@inject ChatService chatService;
<div class="d-flex justify-content-center align-items-center" style="height: 100%;">
<div class="login-container p-4 bg-white rounded shadow-sm" style="max-width: 400px; width: 100%;">
<div class="text-center mb-4">
<h4 class="text-primary mb-2">ورود به سیستم</h4>
</div>
<div class="login-form">
<div class="text-center mb-4">
<span class="badge bg-info p-2 rounded-pill">نیاز برای ارتباط با کارشناسان وارد شود</span>
@@ -70,11 +81,11 @@
}
</div>
</div>
</div>
</div>
@code {
private bool visible = false;
[Parameter] public EventCallback OnMultipleOfThree { get; set; }
public string Username { get; set; }
public int ID { get; set; } = 0;
private string _code = string.Empty;
@@ -144,7 +155,34 @@
{
visible = true;
if (await AuthService.Verificationlogin(ID, Code))
await OnMultipleOfThree.InvokeAsync();
{
int CompanyID = await localStorageService.GetItem<int>("CompanyID");
int GroupID = await localStorageService.GetItem<int>("GroupID");
int ChatID = await localStorageService.GetItem<int>("ChatID");
if (CompanyID==null || CompanyID == 0)
{
var response= await chatService.GetLastChat();
CompanyID = response.Value.Item2;
ChatID = response.Value.Item1;
//----------------------------------------
if (CompanyID!=null && CompanyID!=0) await localStorageService.SetItem("CompanyID", CompanyID);
if (ChatID!=null && ChatID!=0)
{
await localStorageService.RemoveItem("ChatID");
await localStorageService.SetItem("ChatID", ChatID);
}
}
string route = $"UserCP/{CompanyID}";
if (ChatID!=null && ChatID!=0) route += $"?ChatID={ChatID}";
if (GroupID!=null && GroupID!=0 && !(ChatID!=null && ChatID!=0)) route += $"?GroupID={GroupID}";
navigationManager.NavigateTo(route);
}
visible = false;
}
// private async Task MoveNext(ChangeEventArgs e)