{/* 顶部固定:倒计时 + 在线状态 */}
{/* 题目区域 */}
{exam.questions.map((q, index) => (
updateAnswer(q.id, answer)}
/>
))}
{/* 底部固定:提交按钮 */}
{/* 提交确认弹窗 */}
{/* 草稿恢复弹窗由 useExamTaking 内部触发 */}
);
}
```
### 15.2 CountdownTimer 组件
```typescript
// apps/student-portal/src/components/CountdownTimer.tsx
interface CountdownTimerProps {
remaining: number; // 秒
formatted: string; // HH:mm:ss
isExpired: boolean;
}
export function CountdownTimer({ remaining, formatted, isExpired }: CountdownTimerProps) {
const isUrgent = remaining <= 300 && remaining > 0; // 最后 5 分钟
const isCritical = remaining <= 60 && remaining > 0; // 最后 1 分钟
return (