`共 ${t} 条`,
current: Number(query.current) || 1,
pageSize: Number(query.size) || 10,
onChange: (page, pageSize) =>
handleSearch({
current: page,
size: pageSize,
paperName: query.paperName,
}),
}}
/>
>
) : (
value?.length >= 1
? Promise.resolve()
: Promise.reject(
new Error(
"请至少配置一条题型规则",
),
),
},
]}
>
{(fields, { add, remove }, { errors }) => (
<>
{fields.map((field) => (
))}
}
onClick={() =>
add({
questionType: "single",
num: 1,
score: 1,
})
}
>
添加规则
>
)}
)}
);
}
/** 试卷考试信息预览弹窗:基本信息 + 试题列表(试卷详情/查看/预览共用) */
function PaperExamPreviewModal({
open,
paperId,
title,
loading,
fetchExamInfo,
resetModelState,
onClose,
}) {
const [info, setInfo] = useState(null);
useEffect(() => {
if (!open) {
resetModelState?.(NS_PAPER, { paperExamLoading: false });
return;
}
if (!paperId) return;
setInfo(null);
fetchExamInfo({ paperId }).then((res) => {
if (res?.success !== false) setInfo(res?.data || null);
});
}, [open, paperId]);
const basic = info?.paperBasicInfoVO || {};
const columns = [
{
title: "序号",
width: 60,
render: (_, __, index) => index + 1,
},
{
title: "题型",
dataIndex: "questionType",
width: 70,
render: (v) => QUESTION_TYPE_MAP[v] ?? (v || "-"),
},
{
title: "题干",
dataIndex: "title",
render: (v, record) => (
<>
{v || "-"}
{(record.questionOptionVOList || []).map((o) => (
{o.optionKey}. {o.optionText}
))}
>
),
},
{ title: "分值", dataIndex: "score", width: 70 },
{ title: "答案", dataIndex: "answer", width: 90 },
];
return (
{basic.paperName || "-"}
{CLASS_PAPER_TYPE_MAP[basic.paperType] ??
(basic.paperType || "-")}
{basic.paperTotalScore ?? "-"}
{basic.paperPassScore ?? "-"}
{basic.examTime ?? "-"}
);
}
export default Connect([NS_COURSEWARE, NS_PAPER], true)(ClassPaperConfig);