试卷评分

{{-- 评分列表 --}} @if(!empty($questions))
@foreach($questions as $index => $question)
{{-- 题目顶部信息 --}}
第 {{ $question['question_number'] ?? ($index + 1) }} 题 {{ ($question['question_type'] ?? '未知') }} ({{ $question['score'] ?? 0 }} 分)
{{-- 当前评分状态(实时更新,放在左上角) --}}
@if($question['question_type'] === 'choice') {{ ($gradingData[$index]['is_correct'] ?? null) === true ? '正确' : (($gradingData[$index]['is_correct'] ?? null) === false ? '错误' : '未评分') }} @if(($gradingData[$index]['is_correct'] ?? null) !== null) ({{ ($gradingData[$index]['is_correct'] ?? false) ? ($question['score'] ?? 0) : 0 }} 分) @endif @else @php $score = floatval($gradingData[$index]['score'] ?? 0); $maxScore = floatval($question['score'] ?? 0); $isCorrect = $maxScore > 0 ? ($score >= $maxScore && $score > 0) : false; $isEmpty = ($gradingData[$index]['score'] ?? null) === null; @endphp {{ $isEmpty ? '未评分' : ($isCorrect ? '完全正确' : '部分得分') }} @if(!$isEmpty) ({{ $score }} / {{ $maxScore }} 分) @endif @endif
{{-- 左右布局:题目内容 | 评分操作 --}}
{{-- 左侧:题目内容 --}}
{{-- 题目内容 --}}

{{ $question['content'] ?? $question['question_text'] ?? '' }}

{{-- 选择题选项 --}} @if(($question['question_type'] ?? '') === 'choice' && !empty($question['options']))
@foreach($question['options'] as $option)
{{ $option['key'] ?? '' }}. {{ $option['value'] ?? '' }}
@endforeach
@endif
{{-- 参考答案 --}}

参考答案

@if(!empty($question['answer']))

{{ $question['answer'] }}

@else

⚠️ 未找到参考答案

@endif
{{-- 右侧:评分操作区 --}}
@if($question['question_type'] === 'choice') {{-- 选择题评分 --}}
评分
@else {{-- 填空题/解答题评分 --}}
评分
满分:{{ $question['score'] ?? 0 }} 分
@endif
@endforeach
{{-- 提交按钮 --}}
@else

暂无题目数据

@endif