Files
TechHelper/TechHelper.Client/Pages/Exam/ExamPreview.razor
SpecialX ac900159ba
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 12s
重构项目结构,移除Assignment相关功能,优化Submission模块
2025-10-09 18:57:28 +08:00

72 lines
1.7 KiB
Plaintext

@using Entities.DTO
<MudPaper Class="overflow-hidden " Style="background-color:pink" Width="@Width" Height="@Height" MaxHeight="@MaxHeight" MaxWidth="@MaxWidth">
<MudPaper Class="d-flex flex-column flex-grow-1 justify-content-between" Height="100%" Style="background-color:green">
<MudText Typo="Typo.body2"> @ExamDto.Title </MudText>
<MudPaper>
<MudButtonGroup Size="Size.Small" Color="Color.Primary" Variant="Variant.Filled">
<MudButton OnClick="ExamClick"> 详情 </MudButton>
<MudIconButton Icon="@Icons.Material.Filled.Delete" aria-label="delete" />
@if (bteacher)
{
<MudIconButton Icon="@Icons.Material.Filled.Check" OnClick="CheckExam" Color="Color.Primary" aria-label="github" />
}
<MudIconButton Icon="@Icons.Material.Filled.Favorite" Color="Color.Secondary" aria-label="add to favorite" />
</MudButtonGroup>
</MudPaper>
</MudPaper>
</MudPaper>
@code {
[CascadingParameter]
private Task<AuthenticationState> authenticationStateTask { get; set; }
private bool bteacher = false;
[Inject]
public NavigationManager navigationManager { get; set; }
[Parameter]
public ExamDto ExamDto { get; set; }
[Parameter]
public string? Width { get; set; } = "256";
[Parameter]
public string? Height { get; set; } = "64";
[Parameter]
public string? MaxWidth { get; set; } = "256";
[Parameter]
public string? MaxHeight { get; set; } = "64";
protected override Task OnInitializedAsync()
{
bteacher = authenticationStateTask.Result.User.IsInRole("Teacher");
return base.OnInitializedAsync();
}
private void ExamClick()
{
navigationManager.NavigateTo($"exam/edit/{ExamDto.Id}");
}
private void CheckExam()
{
navigationManager.NavigateTo($"exam/check/{ExamDto.Id}");
}
}