Files
secondary-school-grade-archive/frontend/src/components/WrongQuestionList.tsx
T
dekun 43483bf56f 移动端拍照上传、奥数区、学段约束解题与 AI 模型配置。
- 手机/平板响应式布局,支持拍照与相册上传

- 学生详情新增奥数区,按初/高中学段生成解法并禁止超纲

- 系统设置可配置 Ollama 或 OpenAI 兼容 API

- 更新 frontend/dist 与使用说明
2026-06-28 13:39:54 +08:00

62 lines
1.9 KiB
TypeScript

import { Tag, Typography } from 'antd'
import { wrongQuestionApi } from '../api/client'
import type { WrongQuestion } from '../types'
import { STATUS_LABELS } from '../types'
import WrongQuestionDetail from '../pages/WrongQuestionDetail'
interface Props {
items: WrongQuestion[]
selectedId: string | null
onSelect: (id: string | null) => void
onRefresh: () => void
emptyText?: string
}
export default function WrongQuestionList({
items,
selectedId,
onSelect,
onRefresh,
emptyText = '暂无记录',
}: Props) {
return (
<>
<div className="wq-grid">
{items.map((wq) => (
<div key={wq.id} className="wq-card" onClick={() => onSelect(wq.id)}>
<img
src={wrongQuestionApi.imageUrl(wq.id)}
alt="题目"
className="wq-card-img"
loading="lazy"
/>
<div className="wq-card-body">
<Typography.Text strong>{wq.subject_name}</Typography.Text>
{wq.category === 'olympiad' && (
<Tag color="gold" style={{ marginLeft: 4 }}>
</Tag>
)}
<Typography.Text type="secondary" style={{ fontSize: 12, marginLeft: 8 }}>
{STATUS_LABELS[wq.status]}
</Typography.Text>
<Typography.Paragraph ellipsis={{ rows: 2 }} style={{ margin: '8px 0 0', fontSize: 13 }}>
{wq.question_text || wq.ocr_raw_text || '处理中…'}
</Typography.Paragraph>
</div>
</div>
))}
</div>
{items.length === 0 && <Typography.Text type="secondary">{emptyText}</Typography.Text>}
{selectedId && (
<WrongQuestionDetail
questionId={selectedId}
open={!!selectedId}
onClose={() => onSelect(null)}
onUpdated={onRefresh}
/>
)}
</>
)
}