59 lines
1.2 KiB
Plaintext
59 lines
1.2 KiB
Plaintext
@using Entities.DTO
|
|
@using Microsoft.AspNetCore.Authorization
|
|
@using TechHelper.Client.Exam
|
|
|
|
|
|
@page "/exam/manage"
|
|
@using Entities.DTO
|
|
@using TechHelper.Client.Services
|
|
@attribute [Authorize]
|
|
|
|
|
|
@if (isloding)
|
|
{
|
|
<MudText> 正在加载 </MudText>
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
|
|
<MudPaper Class="d-flex flex-wrap flex-grow-0 gap-4" Height="100%" Width="100%">
|
|
@foreach (var item in examDtos)
|
|
{
|
|
<ExamPreview AssignmentDto="item" Width="256px" Height="256px"> </ExamPreview>
|
|
}
|
|
</MudPaper>
|
|
|
|
@code {
|
|
[Inject]
|
|
public IExamService ExamService { get; set; }
|
|
|
|
[Inject]
|
|
public ISnackbar Snackbar { get; set; }
|
|
|
|
[CascadingParameter]
|
|
private Task<AuthenticationState> authenticationStateTask { get; set; }
|
|
|
|
private List<AssignmentDto> examDtos = new List<AssignmentDto>();
|
|
|
|
private bool isloding = true;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
GetExam();
|
|
}
|
|
|
|
|
|
private async void GetExam()
|
|
{
|
|
isloding = true;
|
|
Snackbar.Add("正在加载", Severity.Info);
|
|
var result = await ExamService.GetAllExam(authenticationStateTask.Result.User.Identity.Name);
|
|
examDtos = result.Result as List<AssignmentDto> ?? new List<AssignmentDto>();
|
|
isloding = false;
|
|
Snackbar.Add("加载成功", Severity.Info);
|
|
StateHasChanged();
|
|
}
|
|
}
|