exam_service
This commit is contained in:
55
TechHelper.Client/Pages/Exam/ExamManager.razor
Normal file
55
TechHelper.Client/Pages/Exam/ExamManager.razor
Normal file
@@ -0,0 +1,55 @@
|
||||
@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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user