添加项目文件。
This commit is contained in:
81
TechHelper.Client/Pages/Components/AssignmentView.razor
Normal file
81
TechHelper.Client/Pages/Components/AssignmentView.razor
Normal file
@@ -0,0 +1,81 @@
|
||||
@rendermode InteractiveAuto
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
|
||||
<MudPaper Class="pa-10 ma-5">
|
||||
<MudText Typo="Typo.h1"> @user.Username</MudText>
|
||||
<MudText Typo="Typo.h6"> Role :@user.Role</MudText>
|
||||
<MudText Typo="Typo.h6"> Email : @user.Email</MudText>
|
||||
|
||||
|
||||
|
||||
<MudDataGrid T="Submission" Items="@Submissions" SortMode="@_sortMode">
|
||||
<Columns>
|
||||
<PropertyColumn Property="x => x.Assignment.Title" />
|
||||
<PropertyColumn Property="x => x.Assignment.Description" />
|
||||
<PropertyColumn Property="x => x.AttemptNumber" />
|
||||
<PropertyColumn Property="x => x.GradedAt" />
|
||||
<TemplateColumn CellClass="d-flex justify-end">
|
||||
<CellTemplate>
|
||||
<MudStack Row>
|
||||
<MudButton Size="@Size.Small" Variant="@Variant.Filled" Color="@Color.Primary" OnClick="@(() => DetailsButtonClicked(context.Item))">详情</MudButton>
|
||||
</MudStack>
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
</Columns>
|
||||
<PagerContent>
|
||||
<MudDataGridPager T="Submission" />
|
||||
</PagerContent>
|
||||
</MudDataGrid>
|
||||
@*
|
||||
<MudDataGrid T="SubmissionDetail" Items="@questions" SortMode="@_sortMode">
|
||||
<Columns>
|
||||
<PropertyColumn Property="x => x.AssignmentQuestion.QuestionNumber" />
|
||||
<PropertyColumn Property="x => x.AssignmentQuestion.Question.QuestionText" />
|
||||
<PropertyColumn Property="x => x.AssignmentQuestion.Question.DifficultyLevel" />
|
||||
<PropertyColumn Property="x => x.AssignmentQuestion.Question.CorrectAnswer" />
|
||||
<PropertyColumn Property="x => x.IsCorrect" />
|
||||
</Columns>
|
||||
<PagerContent>
|
||||
<MudDataGridPager T="SubmissionDetail" />
|
||||
</PagerContent>
|
||||
</MudDataGrid>
|
||||
*@
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
|
||||
[Inject]
|
||||
ISubmissionService submissionService { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int UserId { get; set; } = 0;
|
||||
private SortMode _sortMode = SortMode.Multiple;
|
||||
|
||||
private User user = new User();
|
||||
private User student = new User();
|
||||
private IEnumerable<Submission> Submissions = new List<Submission>();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var result = await submissionService.GetByUserId(14);
|
||||
if (result.Successed)
|
||||
{
|
||||
Submissions = result.Data.Items;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void DetailsButtonClicked(Submission submission)
|
||||
{
|
||||
|
||||
if (submission != null)
|
||||
{
|
||||
NavigationManager.NavigateTo($"/submissiondetails/{submission.Id}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user