65 lines
1.7 KiB
C#
65 lines
1.7 KiB
C#
using AntDesign.Extensions.Localization;
|
|
using AntDesign.ProLayout;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.Identity.Client.Extensions.Msal;
|
|
using System.Globalization;
|
|
using System.Net.Http.Json;
|
|
|
|
namespace VideoAnalysisRazor.Layouts
|
|
{
|
|
public partial class BasicLayout : LayoutComponentBase, IDisposable
|
|
{
|
|
private MenuDataItem[] _menuData;
|
|
[Inject] private NavigationManager NavigationManager { get; set; } = default!;
|
|
|
|
[Inject] IHttpContextAccessor HttpContextAccessor { get; set; } = default!;
|
|
[Inject] private ReuseTabsService TabService { get; set; }
|
|
|
|
bool collapsed;
|
|
void Toggle()
|
|
{
|
|
collapsed = !collapsed;
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
if (!CheckLogin())
|
|
{
|
|
NavigationManager.NavigateTo("/Login");
|
|
return;
|
|
}
|
|
_menuData = [
|
|
new MenuDataItem
|
|
{
|
|
Path = "/Project",
|
|
Name = "课堂指标",
|
|
Key = "EvaluationProject",
|
|
Icon = "question-circle",
|
|
},
|
|
new MenuDataItem
|
|
{
|
|
Path = "/",
|
|
Name = "任务队列",
|
|
Key = "VideoTaskPage",
|
|
Icon = "unordered-list",
|
|
}
|
|
];
|
|
}
|
|
|
|
public bool CheckLogin()
|
|
{
|
|
return HttpContextAccessor.HttpContext?.Session.GetInt32("Login") == 1;
|
|
}
|
|
void Reload()
|
|
{
|
|
TabService.ReloadPage();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
}
|