Finishddd

This commit is contained in:
SpecialX
2025-06-24 19:05:13 +08:00
parent 0ee411bf50
commit f9ff57ff72
15 changed files with 385 additions and 1173 deletions

View File

@@ -1,4 +1,5 @@
@page "/exam/create"
@using AutoMapper
@using TechHelper.Client.Services
@using Blazored.TextEditor
@using Entities.DTO
@@ -72,6 +73,16 @@
</MudPaper>
</MudPaper>
<MudPaper MaxWidth="300">
@if (_parsedExam.Errors.Any())
{
foreach (var item in _parsedExam.Errors)
{
<MudText> @item.Message </MudText>
}
}
</MudPaper>
<MudButtonGroup Vertical="true" Color="Color.Primary" Variant="Variant.Filled">
<MudIconButton Icon="@Icons.Material.Filled.Settings" OnClick="@ToggleDrawer" Color="Color.Secondary" />
<MudIconButton Icon="@Icons.Material.Filled.TransitEnterexit" OnClick="@ParseExam" Color="Color.Secondary" />
@@ -98,11 +109,15 @@
_edit = false;
}
private BlazoredTextEditor _textEditor = new BlazoredTextEditor();
private ExamPaper _parsedExam = new ExamPaper();
private AssignmentEx _parsedExam = new AssignmentEx();
private AssignmentDto ExamContent = new AssignmentDto();
private ExamParserConfig _examParserConfig { get; set; } = new ExamParserConfig();
[Inject]
public IMapper Mapper { get; set; }
private void HandleClickedStruct(AssignmentQuestionDto dto)
{
_open = true;
@@ -125,8 +140,9 @@
_parsedExam = exampar.ParseExamPaper(plainText);
Snackbar.Add("试卷解析成功。", Severity.Success);
Snackbar.Add($"{_parsedExam.Errors}。", Severity.Success);
ExamContent = _parsedExam.ConvertToExamDTO();
// ExamContent.SeqIndex();
StateHasChanged();
ExamContent = Mapper.Map<AssignmentDto>(_parsedExam);
ExamContent.SeqIndex();
}
catch (Exception ex)
{