Files
TechHelper/TechHelper.Client/Pages/Exam/QuestionCard/QuestionEdit.razor
SpecialX ac900159ba
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 12s
重构项目结构,移除Assignment相关功能,优化Submission模块
2025-10-09 18:57:28 +08:00

65 lines
2.1 KiB
Plaintext

@using Entities.Contracts
@using Entities.DTO
@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;
<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" />
</MudPaper>
@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)
// {
// }
}
private void HandleSelectedValueChanged(QuestionType type)
{
}
private void HandleSelected(int num)
{
// Question.DifficultyLevel = (DifficultyLevel)num;
}
private void HandleQTSelectedValueChanged(string type)
{
StateHasChanged();
}
}