69 lines
2.2 KiB
Plaintext
69 lines
2.2 KiB
Plaintext
@using TechHelper.Client.Exam
|
|
|
|
<MudCard Class="@(IsNested ? "mb-3 pa-2" : "my-4")" Outlined="@IsNested">
|
|
@if (QuestionGroup.Title != string.Empty)
|
|
{
|
|
<MudCardHeader>
|
|
<MudStack>
|
|
|
|
<MudStack Row="true" AlignItems="AlignItems.Center">
|
|
<MudText Typo="@(IsNested ? Typo.h6 : Typo.h5)">@QuestionGroup.Id. </MudText> @* 嵌套时字号稍小 *@
|
|
<MudText Typo="@(IsNested ? Typo.h6 : Typo.h5)">@QuestionGroup.Title</MudText>
|
|
</MudStack>
|
|
@if (!string.IsNullOrEmpty(QuestionGroup.QuestionReference))
|
|
{
|
|
<MudText Class="mt-2" Style="white-space: pre-wrap;">@QuestionGroup.QuestionReference</MudText>
|
|
}
|
|
</MudStack>
|
|
</MudCardHeader>
|
|
}
|
|
<MudCardContent>
|
|
@* 渲染直接子题目 *@
|
|
@if (QuestionGroup.SubQuestions != null && QuestionGroup.SubQuestions.Any())
|
|
{
|
|
@foreach (var qitem in QuestionGroup.SubQuestions)
|
|
{
|
|
<MudStack Row="true" AlignItems="AlignItems.Baseline" Class="mb-2">
|
|
<MudText Typo="Typo.body1">@qitem.SubId. </MudText>
|
|
<MudText Typo="Typo.body1">@qitem.Stem</MudText>
|
|
</MudStack>
|
|
|
|
@if (qitem.Options != null && qitem.Options.Any())
|
|
{
|
|
@foreach (var oitem in qitem.Options)
|
|
{
|
|
<MudText Typo="Typo.body2" Class="ml-6 mb-2">@oitem.Value</MudText>
|
|
}
|
|
}
|
|
|
|
@if (!string.IsNullOrEmpty(qitem.SampleAnswer))
|
|
{
|
|
<MudText Typo="Typo.body2" Color="Color.Tertiary" Class="ml-6 mb-2">示例答案: @qitem.SampleAnswer</MudText>
|
|
}
|
|
}
|
|
}
|
|
|
|
@* 递归渲染子题组 *@
|
|
@if (QuestionGroup.SubQuestionGroups != null && QuestionGroup.SubQuestionGroups.Any())
|
|
{
|
|
<MudDivider Class="my-4" />
|
|
@if (!IsNested) // 只有顶级大题才显示“嵌套题组”标题
|
|
{
|
|
<MudText Typo="Typo.subtitle1" Class="mb-2">相关题组:</MudText>
|
|
}
|
|
@foreach (var subGroup in QuestionGroup.SubQuestionGroups)
|
|
{
|
|
<QuestionGroupDisplay QuestionGroup="subGroup" IsNested="true" /> @* 递归调用自身 *@
|
|
}
|
|
}
|
|
</MudCardContent>
|
|
|
|
</MudCard>
|
|
|
|
@code {
|
|
[Parameter]
|
|
public TechHelper.Client.Exam.QuestionGroup QuestionGroup { get; set; } = new TechHelper.Client.Exam.QuestionGroup();
|
|
|
|
[Parameter]
|
|
public bool IsNested { get; set; } = false; // 判断是否是嵌套的题组,用于调整样式和显示标题
|
|
} |