重构作业结构:优化实体模型、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,10 +1,29 @@
|
||||
@using Entities.DTO
|
||||
@using Entities.Contracts
|
||||
@using Newtonsoft.Json
|
||||
@using TechHelper.Client.Exam
|
||||
|
||||
|
||||
<MudPaper Elevation="1" Class="ma-4 pa-5 rounded-xl">
|
||||
@* <MudText>@Question.Id</MudText> *@
|
||||
<MudText Class="mt-3" Typo="Typo.button"><b>问题属性</b></MudText>
|
||||
|
||||
<MudChipSet T="string" SelectedValue="@Question.QType" CheckMark SelectionMode="SelectionMode.SingleSelection" SelectedValueChanged="HandleQTSelectedValueChanged">
|
||||
|
||||
@foreach (var item in QuestionTypes)
|
||||
{
|
||||
var qt = item;
|
||||
@* Style = "@($"background - color:{ item.Value.Color} ")"*@
|
||||
|
||||
<MudChip Style="@(qt.Key == Question.QType ?
|
||||
$"background-color:#ffffff; color:{item.Value.Color}" :
|
||||
$"background-color:{item.Value.Color}; color:#ffffff")"
|
||||
Value="@item.Key">
|
||||
@item.Value.DisplayName
|
||||
</MudChip>
|
||||
}
|
||||
</MudChipSet>
|
||||
<MudRating SelectedValue="@(diffi)" SelectedValueChanged="HandleSelected" Size="Size.Small" />
|
||||
<MudTextField @bind-Value="Question.Title" Label="Title" Variant="Variant.Text" Margin="Margin.Dense" AutoGrow="true" />
|
||||
<MudTextField @bind-Value="Question.Answer" Label="Answer" Variant="Variant.Text" Adornment="Adornment.End" AdornmentText="." Margin="Margin.Dense" AutoGrow="true" />
|
||||
<MudTextField @bind-Value="Question.Options" Label="Options" Variant="Variant.Text" Adornment="Adornment.End" AdornmentText="." Margin="Margin.Dense" AutoGrow="true" />
|
||||
@@ -15,4 +34,35 @@
|
||||
@code {
|
||||
[Parameter]
|
||||
public QuestionDto Question { get; set; } = new QuestionDto();
|
||||
public int diffi = 0;
|
||||
Dictionary<string, QuestionDisplayTypeData> QuestionTypes = new Dictionary<string, QuestionDisplayTypeData>();
|
||||
|
||||
[Inject]
|
||||
private ILocalStorageService LocalStorageService { get; set; }
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
|
||||
var cs = LocalStorageService.GetItem<string>("GlobalInfo");
|
||||
var GlobalInfo = JsonConvert.DeserializeObject<Dictionary<string, QuestionDisplayTypeData>>(cs);
|
||||
if (GlobalInfo != null)
|
||||
{
|
||||
QuestionTypes = GlobalInfo;
|
||||
}
|
||||
}
|
||||
private void HandleSelectedValueChanged(QuestionType type)
|
||||
{
|
||||
Question.Type = type;
|
||||
}
|
||||
|
||||
private void HandleSelected(int num)
|
||||
{
|
||||
Question.DifficultyLevel = (DifficultyLevel)num;
|
||||
}
|
||||
|
||||
private void HandleQTSelectedValueChanged(string type)
|
||||
{
|
||||
Question.QType = type;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user