From 6c1a8149ae7cda673545b84873a7880d18d1048a Mon Sep 17 00:00:00 2001 From: qinzhenpen Date: Wed, 30 Sep 2026 10:55:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=80=83=E8=AF=95=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8):=20=E6=96=B0=E5=A2=9E=E9=A2=98=E5=9E=8B=E6=AF=8F?= =?UTF-8?q?=E9=A2=98=E5=88=86=E5=80=BC=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增每题分值列到分数表格,添加分值输入组件及联动更新逻辑,调整表格最小宽度适配新增列 --- src/views/teacherEnd/exam/editor.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/views/teacherEnd/exam/editor.vue b/src/views/teacherEnd/exam/editor.vue index 577e50d..d409a3f 100644 --- a/src/views/teacherEnd/exam/editor.vue +++ b/src/views/teacherEnd/exam/editor.vue @@ -26,12 +26,13 @@
- + + @@ -229,6 +230,7 @@ function selectedByType(type) { const ids = new Set(bank.value.filter((item) => function questionCount(type) { return bank.value.filter((item) => item.type === type).length; } function scoreByType(type) { return selectedQuestions(type).reduce((sum, item) => sum + Number(selectedScore(item.id)), 0); } function scorePerQuestion(type) { return Number(typeScores[type] || 1); } +function onTypeScoreChange(type) { const score = Number(typeScores[type] || 0); for (const item of form.questions) { const bankItem = bank.value.find((q) => q.id === item.questionId); if (bankItem && bankItem.type === type) item.score = score; } } function selectedQuestions(type) { const selected = new Set(form.questions.map((item) => item.questionId)); return bank.value.filter((item) => item.type === type && selected.has(item.id)); } async function nextStep() { if (activeStep.value === 0) { try { await formRef.value.validate(); const start = new Date(form.startTime.replace(" ", "T")); const end = new Date(form.endTime.replace(" ", "T")); if (end <= start) return ElMessage.warning("结束时间必须晚于开始时间"); duration.value = Math.round((end - start) / 60000); } catch { return; } } if (activeStep.value === 1 && !form.questions.length) return ElMessage.warning("至少选择一道试题"); activeStep.value++; } async function save(publish) { if (inProgress.value) { await examApi.updateExam(id.value, form); ElMessage.success("结束时间已更新"); return router.push("/exam/index"); } try { await formRef.value?.validate(); } catch { activeStep.value = 0; return; } if (!form.questions.length) { activeStep.value = 1; return ElMessage.warning("至少选择一道试题"); } const result = isNew.value ? await examApi.createExam(form) : await examApi.updateExam(id.value, form); const examId = result.data.id; if (publish) await examApi.publishExam(examId); ElMessage.success(publish ? "考试已保存并发布" : "考试已保存"); router.push("/exam/index"); } @@ -351,7 +353,7 @@ function toBoolean(value, fallback) { if (value === undefined || value === null .score-table { width: 100%; - min-width: 720px; + min-width: 860px; border-collapse: collapse; table-layout: fixed; background: #ffffff; @@ -378,6 +380,9 @@ function toBoolean(value, fallback) { if (value === undefined || value === null td:last-child { border-right: 0; } tbody tr:last-child td { border-bottom: 0; } tbody tr:hover td { background: #fafcff; } + + :deep(.el-input-number) { width: 100px; } + :deep(.el-input-number .el-input__wrapper) { padding: 0 8px; } } .fixed-step-actions {
题型题库题目数量选题数量小计
题型题库题目数量选题数量每题分值小计
{{ item.label }} {{ questionCount(item.value) }} {{ selectedByType(item.value) }} {{ scoreByType(item.value) }}