56 lines
1022 B
Plaintext
56 lines
1022 B
Plaintext
@using Entities.DTO
|
|
@using Microsoft.AspNetCore.Authorization
|
|
@using TechHelper.Client.Exam
|
|
|
|
|
|
@page "/exam/manage"
|
|
@attribute [Authorize]
|
|
|
|
|
|
@if (isloding)
|
|
{
|
|
<MudText> 正在加载 </MudText>
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
|
|
@foreach (var item in examDtos)
|
|
{
|
|
<ExamPreview examDto="item"> </ExamPreview>
|
|
}
|
|
|
|
|
|
@code {
|
|
[Inject]
|
|
public IExamService ExamService { get; set; }
|
|
|
|
[Inject]
|
|
public ISnackbar Snackbar { get; set; }
|
|
|
|
[CascadingParameter]
|
|
private Task<AuthenticationState> authenticationStateTask { get; set; }
|
|
|
|
private List<ExamDto> examDtos = new List<ExamDto>();
|
|
|
|
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<ExamDto> ?? new List<ExamDto>();
|
|
isloding = false;
|
|
Snackbar.Add("加载成功", Severity.Info);
|
|
StateHasChanged();
|
|
}
|
|
}
|