重构作业结构:优化实体模型、DTO映射和前端界面
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 13s
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 13s
- 重构AppMainStruct、AssignmentQuestion、Question等实体模型 - 更新相关DTO以匹配新的数据结构 - 优化前端页面布局和组件 - 添加全局信息和笔记功能相关代码 - 更新数据库迁移和程序配置
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
@page "/exam/create"
|
||||
@using AutoMapper
|
||||
@using Entities.Contracts
|
||||
@using Newtonsoft.Json
|
||||
@using TechHelper.Client.Pages.Common
|
||||
@using TechHelper.Client.Pages.Exam.ExamView
|
||||
@using TechHelper.Client.Services
|
||||
@@ -39,10 +41,12 @@
|
||||
<MudStack Class="flex-grow-1 h-100">
|
||||
|
||||
<MudPaper Class="rounded-xl ma-1 pa-2" Style="background-color:#fefefefe">
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="rounded-xl" Size="Size.Small" OnClick="OpenEditor">文本编辑器</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="rounded-xl" Size="Size.Small" OnClick="ParseExam">载入</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="rounded-xl" Size="Size.Small" OnClick="OpenPublish">发布</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="rounded-xl" Size="Size.Small" OnClick="OpenPublish">指派</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="rounded-xl" Size="Size.Small" OnClick="OpenEditor">文本编辑器</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="rounded-xl" Size="Size.Small" OnClick="ParseExam">载入</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="rounded-xl" Size="Size.Small" OnClick="OpenPublish">发布</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="rounded-xl" Size="Size.Small" OnClick="OpenPublish">指派</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="rounded-xl" Size="Size.Small" OnClick="OpenTest">Test</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Secondary" Class="rounded-xl" Size="Size.Small" OnClick="HandleGlobalInfo">GlobalExamInfo</MudButton>
|
||||
</MudPaper>
|
||||
|
||||
|
||||
@@ -84,11 +88,32 @@
|
||||
private ExamParserConfig _examParserConfig { get; set; } = new ExamParserConfig();
|
||||
private string EditorText = "";
|
||||
|
||||
[Inject]
|
||||
private ILocalStorageService LocalStorageService { get; set; }
|
||||
|
||||
[Inject]
|
||||
public IMapper Mapper { get; set; }
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
|
||||
var response = await NoteService.GetNote((byte)SubjectAreaEnum.Literature);
|
||||
|
||||
if (response.Status)
|
||||
{
|
||||
try
|
||||
{
|
||||
LocalStorageService.SetItem("GlobalInfo", response.Result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void OpenEditor()
|
||||
{
|
||||
var parameters = new DialogParameters<TextEditorDialog> { { x => x.TextEditor, _textEditor } };
|
||||
@@ -169,13 +194,43 @@
|
||||
[Inject]
|
||||
public IExamService examService { get; set; }
|
||||
|
||||
[Inject]
|
||||
public INoteService NoteService { get; set; }
|
||||
|
||||
|
||||
public async Task Publish()
|
||||
{
|
||||
var apiRespon = await examService.SaveParsedExam(ExamContent);
|
||||
Snackbar.Add(apiRespon.Message);
|
||||
}
|
||||
public async Task OpenTest()
|
||||
{
|
||||
Dictionary<string, (Color, string)> Note = new Dictionary<string, (Color, string)> { { "Hello", (Color.Surface, "World") }, { "My", (Color.Surface, "App") }, };
|
||||
var json = JsonConvert.SerializeObject(Note);
|
||||
var result = await NoteService.AddNote(new GlobalDto { SubjectArea = Entities.Contracts.SubjectAreaEnum.Physics, Data = json });
|
||||
|
||||
|
||||
|
||||
Console.WriteLine(json);
|
||||
var res = JsonConvert.DeserializeObject<Dictionary<string, (Color, string)>>(json);
|
||||
|
||||
}
|
||||
|
||||
private async void HandleGlobalInfo()
|
||||
{
|
||||
// _open = true;
|
||||
// _edit = true;
|
||||
// StateHasChanged();
|
||||
|
||||
var parameters = new DialogParameters<ExamGlobalInfoDialog> { { x => x.Assignment, ExamContent } };
|
||||
|
||||
var dialog = await DialogService.ShowAsync<ExamGlobalInfoDialog>("Exam_GlobalInfo", parameters);
|
||||
var result = await dialog.Result;
|
||||
if (!result.Canceled)
|
||||
{
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user