AsiignmentStruct
This commit is contained in:
17
TechHelper.Client/Pages/Exam/AssignmentQuestionEdit.razor
Normal file
17
TechHelper.Client/Pages/Exam/AssignmentQuestionEdit.razor
Normal file
@@ -0,0 +1,17 @@
|
||||
@using Entities.DTO
|
||||
@using TechHelper.Client.Exam
|
||||
|
||||
|
||||
<MudPaper>
|
||||
<MudText>@AssignmentQuestion.Id</MudText>
|
||||
<MudTextField @bind-Value="AssignmentQuestion.Title" Label="Title" Variant="Variant.Outlined" Margin="Margin.Dense" AutoFocus="true" />
|
||||
<MudTextField @bind-Value="AssignmentQuestion.Index" Label="Index" Variant="Variant.Outlined" Adornment="Adornment.End" AdornmentText="." Margin="Margin.Dense" AutoFocus="true" />
|
||||
<MudTextField @bind-Value="AssignmentQuestion.Score" Label="Score" Variant="Variant.Outlined" Adornment="Adornment.End" AdornmentText="." Margin="Margin.Dense" AutoFocus="true" />
|
||||
<QuestionEdit Question="AssignmentQuestion.Question"/>
|
||||
</MudPaper>
|
||||
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public AssignmentQuestionDto AssignmentQuestion { get; set; } = new AssignmentQuestionDto();
|
||||
}
|
@@ -9,20 +9,32 @@
|
||||
@using System.Globalization;
|
||||
@using TechHelper.Client.Pages.Editor
|
||||
|
||||
|
||||
<MudPaper Elevation="5" Class="d-flex overflow-hidden flex-grow-1" Style="overflow:hidden; position:relative;height:100%">
|
||||
<MudDrawerContainer Class="mud-height-full flex-grow-1" Style="height:100%">
|
||||
<MudDrawer @bind-Open="@_open" Elevation="0" Variant="@DrawerVariant.Persistent" Color="Color.Primary" Anchor="Anchor.End" OverlayAutoClose="true">
|
||||
<MudDrawerHeader>
|
||||
<MudText Typo="Typo.h6"> 配置 </MudText>
|
||||
</MudDrawerHeader>
|
||||
|
||||
<MudStack Class="overflow-auto">
|
||||
<ParseRoleConfig />
|
||||
<MudButton Color="Color.Success"> ParseExam </MudButton>
|
||||
</MudStack>
|
||||
@if (_edit)
|
||||
{
|
||||
<AssignmentQuestionEdit AssignmentQuestion="selectedAssignmentQuestion" />
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
<MudDrawerHeader>
|
||||
<MudText Typo="Typo.h6"> 配置 </MudText>
|
||||
</MudDrawerHeader>
|
||||
|
||||
<MudStack Class="overflow-auto">
|
||||
<ParseRoleConfig />
|
||||
<MudButton Color="Color.Success"> ParseExam </MudButton>
|
||||
</MudStack>
|
||||
}
|
||||
|
||||
|
||||
</MudDrawer>
|
||||
<MudStack Row="true" Class="flex-grow-1" Style="height:100%">
|
||||
<ExamView Class="overflow-auto" ParsedExam="ExamContent"></ExamView>
|
||||
<ExamView Class="overflow-auto" ClickedStruct="HandleClickedStruct" ParsedExam="ExamContent"></ExamView>
|
||||
|
||||
<MudPaper Class="ma-2">
|
||||
<MudPaper Elevation="0" Style="height:calc(100% - 80px)">
|
||||
@@ -75,11 +87,15 @@
|
||||
[CascadingParameter]
|
||||
private Task<AuthenticationState> authenticationStateTask { get; set; }
|
||||
|
||||
private AssignmentQuestionDto selectedAssignmentQuestion = new AssignmentQuestionDto();
|
||||
|
||||
private bool _open = false;
|
||||
private bool _edit = false;
|
||||
|
||||
private void ToggleDrawer()
|
||||
{
|
||||
_open = !_open;
|
||||
_edit = false;
|
||||
}
|
||||
private BlazoredTextEditor _textEditor = new BlazoredTextEditor();
|
||||
private ExamPaper _parsedExam = new ExamPaper();
|
||||
@@ -87,6 +103,14 @@
|
||||
|
||||
private ExamParserConfig _examParserConfig { get; set; } = new ExamParserConfig();
|
||||
|
||||
private void HandleClickedStruct(AssignmentQuestionDto dto)
|
||||
{
|
||||
_open = true;
|
||||
_edit = true;
|
||||
selectedAssignmentQuestion = dto;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task ParseExam()
|
||||
{
|
||||
|
||||
|
@@ -1,36 +0,0 @@
|
||||
@using Entities.DTO
|
||||
@using TechHelper.Client.Exam
|
||||
|
||||
|
||||
<MudPaper Elevation=@Elevation Class=@Class>
|
||||
|
||||
<MudStack Row="true">
|
||||
<MudText Typo="Typo.h6">@ExamStruct.Title</MudText>
|
||||
@if (ExamStruct.Score > 0)
|
||||
{
|
||||
<MudText Typo="Typo.body2"><b>总分:</b> @ExamStruct.Score 分</MudText>
|
||||
}
|
||||
</MudStack>
|
||||
|
||||
@foreach (var childStruct in ExamStruct.ChildrenGroups)
|
||||
{
|
||||
<ExamGroupView ExamStruct="childStruct"/>
|
||||
}
|
||||
|
||||
@foreach (var question in ExamStruct.AssignmentQuestions)
|
||||
{
|
||||
<QuestionCard Question="question.Question" Elevation=@Elevation Class="my-2 pa-1" />
|
||||
}
|
||||
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public AssignmentStructDto ExamStruct { get; set; } = new AssignmentStructDto();
|
||||
|
||||
[Parameter]
|
||||
public string Class { get; set; } = "my-2 pa-1";
|
||||
|
||||
[Parameter]
|
||||
public int Elevation { get; set; } = 0;
|
||||
}
|
51
TechHelper.Client/Pages/Exam/ExamStructView.razor
Normal file
51
TechHelper.Client/Pages/Exam/ExamStructView.razor
Normal file
@@ -0,0 +1,51 @@
|
||||
@using Entities.DTO
|
||||
@using TechHelper.Client.Exam
|
||||
|
||||
<MudPaper @onclick:stopPropagation>
|
||||
<MudPaper Elevation=@Elevation Class=@Class @onclick="HandleClick">
|
||||
|
||||
<MudStack Row="true">
|
||||
<MudText Typo="Typo.h6">@ExamStruct.Title</MudText>
|
||||
@if (ExamStruct.Score > 0)
|
||||
{
|
||||
<MudText Typo="Typo.body2"><b>总分:</b> @ExamStruct.Score 分</MudText>
|
||||
}
|
||||
</MudStack>
|
||||
|
||||
@if (ExamStruct.Question != null)
|
||||
{
|
||||
<QuestionCard Question="ExamStruct.Question" Index="ExamStruct.Index" Elevation=@Elevation Class="my-2 pa-1" />
|
||||
}
|
||||
|
||||
@foreach (var examStruct in ExamStruct.ChildrenAssignmentQuestion)
|
||||
{
|
||||
<ExamStructView ExamStruct="examStruct" ClickedStruct="HandleChildStructClick" Elevation=@Elevation Class="my-2 pa-1" />
|
||||
}
|
||||
|
||||
</MudPaper>
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public AssignmentQuestionDto ExamStruct { get; set; } = new AssignmentQuestionDto();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<AssignmentQuestionDto> ClickedStruct { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string Class { get; set; } = "my-2 pa-1";
|
||||
|
||||
[Parameter]
|
||||
public int Elevation { get; set; } = 0;
|
||||
|
||||
|
||||
private async void HandleClick()
|
||||
{
|
||||
await ClickedStruct.InvokeAsync(ExamStruct);
|
||||
}
|
||||
|
||||
private async void HandleChildStructClick(AssignmentQuestionDto clickedChildExamStruct)
|
||||
{
|
||||
await ClickedStruct.InvokeAsync(clickedChildExamStruct);
|
||||
}
|
||||
}
|
@@ -8,7 +8,7 @@
|
||||
<MudText Class="d-flex justify-content-center" Typo="Typo.h6"> @ParsedExam.Title </MudText>
|
||||
<MudText Typo="Typo.body1"> @ParsedExam.Description </MudText>
|
||||
|
||||
<ExamGroupView ExamStruct="@ParsedExam.ExamStruct" Elevation="1" Class="ma-0 pa-2" />
|
||||
<ExamStructView ExamStruct="@ParsedExam.ExamStruct" Elevation="1" ClickedStruct="HandleClickedStruct" Class="ma-0 pa-2" />
|
||||
</MudPaper>
|
||||
|
||||
}
|
||||
@@ -25,6 +25,10 @@ else
|
||||
|
||||
[Parameter]
|
||||
public AssignmentDto ParsedExam { get; set; } = new AssignmentDto();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<AssignmentQuestionDto> ClickedStruct { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string Height { get; set; } = "100%";
|
||||
[Parameter]
|
||||
@@ -33,4 +37,10 @@ else
|
||||
public string Class { get; set; } = "";
|
||||
[Parameter]
|
||||
public string Style { get; set; } = "";
|
||||
|
||||
|
||||
private void HandleClickedStruct(AssignmentQuestionDto dto)
|
||||
{
|
||||
ClickedStruct.InvokeAsync(dto);
|
||||
}
|
||||
}
|
@@ -4,14 +4,14 @@
|
||||
<MudPaper Class=@Class Elevation=@Elevation Outlined="false">
|
||||
|
||||
<MudText Typo="Typo.subtitle1">
|
||||
<b>@Question.Index</b> @((MarkupString)Question.Title.Replace("\n", "<br />"))
|
||||
@if (Question.Score > 0)
|
||||
<b>@Index</b> @((MarkupString)Question.Title.Replace("\n", "<br />"))
|
||||
@if (Score > 0)
|
||||
{
|
||||
<MudText Typo="Typo.body2" Class="d-inline ml-2">(@Question.Score 分)</MudText>
|
||||
<MudText Typo="Typo.body2" Class="d-inline ml-2">(@Score 分)</MudText>
|
||||
}
|
||||
</MudText>
|
||||
|
||||
@if (Question.Options != null)
|
||||
@if (!string.IsNullOrEmpty(Question.Options))
|
||||
{
|
||||
<div class="mt-2">
|
||||
@foreach (var option in Question.Options.ParseOptionsFromText())
|
||||
@@ -22,12 +22,6 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@foreach(var item in Question.ChildrenQuestion)
|
||||
{
|
||||
<QuestionCard Question="item"/>
|
||||
|
||||
}
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
@@ -35,7 +29,13 @@
|
||||
public QuestionDto Question { get; set; } = new QuestionDto();
|
||||
|
||||
[Parameter]
|
||||
public string Class { get; set; }
|
||||
public byte Index { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public byte Score { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public string Class { get; set; } = string.Empty;
|
||||
|
||||
[Parameter]
|
||||
public int Elevation { get; set; }
|
||||
|
17
TechHelper.Client/Pages/Exam/QuestionEdit.razor
Normal file
17
TechHelper.Client/Pages/Exam/QuestionEdit.razor
Normal file
@@ -0,0 +1,17 @@
|
||||
@using Entities.DTO
|
||||
@using TechHelper.Client.Exam
|
||||
|
||||
|
||||
<MudPaper>
|
||||
<MudText>@Question.Id</MudText>
|
||||
<MudTextField @bind-Value="Question.Title" Label="Title" Variant="Variant.Outlined" Margin="Margin.Dense" AutoGrow="true" />
|
||||
<MudTextField @bind-Value="Question.Answer" Label="Answer" Variant="Variant.Outlined" Adornment="Adornment.End" AdornmentText="." Margin="Margin.Dense" AutoGrow="true" />
|
||||
<MudTextField @bind-Value="Question.Options" Label="Options" Variant="Variant.Outlined" Adornment="Adornment.End" AdornmentText="." Margin="Margin.Dense" AutoGrow="true" />
|
||||
|
||||
</MudPaper>
|
||||
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public QuestionDto Question { get; set; } = new QuestionDto();
|
||||
}
|
Reference in New Issue
Block a user