struct&&assiQues
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
@using Entities.DTO
|
||||
@using TechHelper.Client.Exam
|
||||
@using TechHelper.Client.Services
|
||||
@page "/exam/check/{ExamID}"
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
@page "/exam/create"
|
||||
@using TechHelper.Client.Services
|
||||
@using Blazored.TextEditor
|
||||
@using Entities.DTO
|
||||
@using TechHelper.Client.Exam
|
||||
@@ -82,7 +83,7 @@
|
||||
}
|
||||
private BlazoredTextEditor _textEditor = new BlazoredTextEditor();
|
||||
private ExamPaper _parsedExam = new ExamPaper();
|
||||
private ExamDto ExamContent = new ExamDto();
|
||||
private AssignmentDto ExamContent = new AssignmentDto();
|
||||
|
||||
private ExamParserConfig _examParserConfig { get; set; } = new ExamParserConfig();
|
||||
|
||||
@@ -101,7 +102,7 @@
|
||||
Snackbar.Add("试卷解析成功。", Severity.Success);
|
||||
Snackbar.Add($"{_parsedExam.Errors}。", Severity.Success);
|
||||
ExamContent = _parsedExam.ConvertToExamDTO();
|
||||
ExamContent.SeqIndex();
|
||||
// ExamContent.SeqIndex();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -125,7 +126,6 @@
|
||||
|
||||
public async Task Publish()
|
||||
{
|
||||
ExamContent.CreaterEmail = authenticationStateTask.Result.User.Identity.Name;
|
||||
var apiRespon = await examService.SaveParsedExam(ExamContent);
|
||||
Snackbar.Add(apiRespon.Message);
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
@page "/exam/edit/{ExamId}"
|
||||
@using Entities.DTO
|
||||
@using TechHelper.Client.Services
|
||||
@using Entities.DTO
|
||||
@using TechHelper.Client.Exam
|
||||
|
||||
<ExamView ParsedExam="@ExamDto"/>
|
||||
@@ -17,7 +19,7 @@
|
||||
[Inject]
|
||||
private ISnackbar Snackbar { get; set; }
|
||||
|
||||
private ExamDto ExamDto { get; set; }
|
||||
private AssignmentDto ExamDto { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
@@ -27,8 +29,8 @@
|
||||
Console.WriteLine($"ExamId 字符串成功解析为 Guid: {parsedExamId}");
|
||||
try
|
||||
{
|
||||
var result = await ExamService.GetExam(parsedExamId);
|
||||
if (result.Status) ExamDto = result.Result as ExamDto ?? new ExamDto();
|
||||
// var result = await ExamService.GetExam(parsedExamId);
|
||||
// if (result.Status) ExamDto = result.Result as ExamDto ?? new ExamDto();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@@ -4,41 +4,29 @@
|
||||
|
||||
<MudPaper Elevation=@Elevation Class=@Class>
|
||||
|
||||
@foreach (var majorQG in MajorQGList)
|
||||
{
|
||||
<MudStack Row="true">
|
||||
<MudText Typo="Typo.h6">@majorQG.Title</MudText>
|
||||
@if (majorQG.Score > 0)
|
||||
<MudStack Row="true">
|
||||
<MudText Typo="Typo.h6">@ExamStruct.Title</MudText>
|
||||
@if (ExamStruct.Score > 0)
|
||||
{
|
||||
<MudText Typo="Typo.body2"><b>总分:</b> @majorQG.Score 分</MudText>
|
||||
<MudText Typo="Typo.body2"><b>总分:</b> @ExamStruct.Score 分</MudText>
|
||||
}
|
||||
</MudStack>
|
||||
|
||||
@foreach (var childStruct in ExamStruct.ChildrenGroups)
|
||||
{
|
||||
<ExamGroupView ExamStruct="childStruct"/>
|
||||
}
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(majorQG.Descript))
|
||||
{
|
||||
<MudText Typo="Typo.body2">@((MarkupString)majorQG.Descript.Replace("\n", "<br />"))</MudText>
|
||||
}
|
||||
|
||||
@if (majorQG.SubQuestions.Any())
|
||||
{
|
||||
@foreach (var question in majorQG.SubQuestions)
|
||||
{
|
||||
<QuestionCard Question="question" Elevation=@Elevation Class="my-2 pa-1" />
|
||||
}
|
||||
}
|
||||
|
||||
@if (majorQG.SubQuestionGroups.Any())
|
||||
{
|
||||
<ExamGroupView MajorQGList="majorQG.SubQuestionGroups" Elevation="1" />
|
||||
}
|
||||
@foreach (var question in ExamStruct.AssignmentQuestions)
|
||||
{
|
||||
<QuestionCard Question="question.Question" Elevation=@Elevation Class="my-2 pa-1" />
|
||||
}
|
||||
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public List<QuestionGroupDto> MajorQGList { get; set; } = new List<QuestionGroupDto>();
|
||||
public AssignmentStructDto ExamStruct { get; set; } = new AssignmentStructDto();
|
||||
|
||||
[Parameter]
|
||||
public string Class { get; set; } = "my-2 pa-1";
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
|
||||
@page "/exam/manage"
|
||||
@using Entities.DTO
|
||||
@using TechHelper.Client.Services
|
||||
@attribute [Authorize]
|
||||
|
||||
|
||||
|
@@ -5,10 +5,10 @@
|
||||
{
|
||||
|
||||
<MudPaper Height="@Height" Class="@Class" Style="@Style" Width="@Width">
|
||||
<MudText Class="d-flex justify-content-center" Typo="Typo.h6"> @ParsedExam.AssignmentTitle </MudText>
|
||||
<MudText Class="d-flex justify-content-center" Typo="Typo.h6"> @ParsedExam.Title </MudText>
|
||||
<MudText Typo="Typo.body1"> @ParsedExam.Description </MudText>
|
||||
|
||||
<ExamGroupView MajorQGList="@ParsedExam.QuestionGroups.SubQuestionGroups" Elevation="1" Class="ma-0 pa-2" />
|
||||
<ExamGroupView ExamStruct="@ParsedExam.ExamStruct" Elevation="1" Class="ma-0 pa-2" />
|
||||
</MudPaper>
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ else
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public ExamDto ParsedExam { get; set; } = new ExamDto();
|
||||
public AssignmentDto ParsedExam { get; set; } = new AssignmentDto();
|
||||
[Parameter]
|
||||
public string Height { get; set; } = "100%";
|
||||
[Parameter]
|
||||
|
@@ -4,29 +4,35 @@
|
||||
<MudPaper Class=@Class Elevation=@Elevation Outlined="false">
|
||||
|
||||
<MudText Typo="Typo.subtitle1">
|
||||
<b>@Question.Index</b> @((MarkupString)Question.Stem.Replace("\n", "<br />"))
|
||||
<b>@Question.Index</b> @((MarkupString)Question.Title.Replace("\n", "<br />"))
|
||||
@if (Question.Score > 0)
|
||||
{
|
||||
<MudText Typo="Typo.body2" Class="d-inline ml-2">(@Question.Score 分)</MudText>
|
||||
}
|
||||
</MudText>
|
||||
|
||||
@if (Question.Options.Any())
|
||||
@if (Question.Options != null)
|
||||
{
|
||||
<div class="mt-2">
|
||||
@foreach (var option in Question.Options)
|
||||
@foreach (var option in Question.Options.ParseOptionsFromText())
|
||||
{
|
||||
var tempOption = option;
|
||||
<p>@((MarkupString)(tempOption.Value.Replace("\n", "<br />")))</p>
|
||||
<p>@((MarkupString)(tempOption.Replace("\n", "<br />")))</p>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@foreach(var item in Question.ChildrenQuestion)
|
||||
{
|
||||
<QuestionCard Question="item"/>
|
||||
|
||||
}
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public SubQuestionDto Question { get; set; } = new SubQuestionDto();
|
||||
public QuestionDto Question { get; set; } = new QuestionDto();
|
||||
|
||||
[Parameter]
|
||||
public string Class { get; set; }
|
||||
|
Reference in New Issue
Block a user