From 68f0a69cb7221c95a5e9eb2f690c69248d3a5cb3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=99=88=E6=B2=85?= <907037276@qq.com>
Date: Tue, 29 Sep 2026 09:12:16 +0800
Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AD=A5=E9=80=89=E6=8B=A9?=
=?UTF-8?q?=E9=A2=98=E7=BC=96=E8=BE=91=E6=8C=89=E9=92=AE=E6=8C=AA=E8=87=B3?=
=?UTF-8?q?=E7=AC=AC=E4=B8=80=E4=B8=AA=E6=AD=A5=E9=AA=A4=E8=A1=8C=E6=97=81?=
=?UTF-8?q?(=E7=99=BD=E5=90=8D=E5=8D=95=E4=BB=BB=E5=8A=A1)=EF=BC=9A?=
=?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=A1=8C=E7=A7=BB=E9=99=A4=EF=BC=8C=E4=BB=8E?=
=?UTF-8?q?=E9=A2=98=E5=BA=93=E9=80=89=E9=A2=98=E5=85=A5=E5=8F=A3=E6=94=B6?=
=?UTF-8?q?=E8=BF=9B=E7=BC=96=E8=BE=91=E5=BC=B9=E7=AA=97=EF=BC=9B=E6=9F=A5?=
=?UTF-8?q?=E7=9C=8B=E6=A8=A1=E5=BC=8F=E6=AD=A5=E9=AA=A41=E6=97=81?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=B7=B2=E9=85=8D=E7=BD=AE=E9=A2=98=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../StepOneChoiceQuestionEditor.vue | 19 +++++++-
src/views/schoolAdmin/trainingTask/index.vue | 44 +++++++++--------
src/views/teacherEnd/trainingTask/index.vue | 47 +++++++++----------
3 files changed, 62 insertions(+), 48 deletions(-)
diff --git a/src/views/components/StepOneChoiceQuestionEditor.vue b/src/views/components/StepOneChoiceQuestionEditor.vue
index 9c398b7..b625bd0 100644
--- a/src/views/components/StepOneChoiceQuestionEditor.vue
+++ b/src/views/components/StepOneChoiceQuestionEditor.vue
@@ -12,9 +12,14 @@
STEP 01 · KNOWLEDGE CHECK
每次新增一题;填写题干、至少两个选项,并标记正确答案。
- 新增题目
+
+ 从题库选题
+ 新增题目
+
+
+
@@ -49,15 +54,19 @@
import { ref, watch } from "vue";
import { ElMessage } from "element-plus";
import { QUESTION_OPTION_KEYS, createStepOneChoiceQuestion, parseStepOneChoiceQuestions } from "@/utils/stepOneChoiceQuestions";
+import StepOneQuestionBankPicker from "@/views/components/StepOneQuestionBankPicker.vue";
const props = defineProps({
visible: { type: Boolean, default: false },
modelValue: { type: Array, default: () => [] },
taskName: { type: String, default: "" },
+ // 传入则在弹窗内提供"从题库选题"入口(教师端/平台端各自注入接口)
+ loadQuestions: { type: Function, default: null },
});
const emit = defineEmits(["update:visible", "update:modelValue"]);
const draft = ref([]);
const optionKeys = QUESTION_OPTION_KEYS;
+const bankPickerVisible = ref(false);
watch(() => props.visible, (opened) => {
if (opened) draft.value = structuredClone(parseStepOneChoiceQuestions(props.modelValue));
@@ -67,6 +76,13 @@ function addQuestion() {
draft.value.push(createStepOneChoiceQuestion(draft.value.length));
}
+function mergeFromBank(questions) {
+ const existingTitles = new Set(draft.value.map((question) => String(question.title || "").trim()));
+ const added = questions.filter((question) => !existingTitles.has(question.title));
+ draft.value.push(...added);
+ if (added.length) ElMessage.success(`已从题库添加 ${added.length} 道题`);
+}
+
function addOption(question) {
const key = optionKeys[question.options.length];
if (key) question.options.push({ key, content: "" });
@@ -121,6 +137,7 @@ function close(value = false) {
.el-dialog__footer { padding: 16px 24px; border-top: 1px solid #cfe2f5; }
}
.choice-editor-intro { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:18px; padding:15px 17px; border-left:3px solid #1e88e5; background:linear-gradient(90deg,rgba(187, 222, 251, 0.5),transparent); }
+.choice-editor-actions { display:flex; flex-shrink:0; gap:10px; }
.choice-editor-intro span { color:#1e88e5; font-size:12px; font-weight:800; letter-spacing:.12em; }.choice-editor-intro p { margin:5px 0 0; color:#5a7a9a; line-height:1.6; }
.choice-question-list { display:grid; gap:16px; }.choice-question-card { padding:16px; border:1px solid #cfe2f5; border-radius:10px; background:#f0f6fd; }.choice-question-card header { display:flex; align-items:center; gap:9px; margin-bottom:13px; color:#2c4a6a; }.choice-question-number { display:grid; place-items:center; width:28px; height:28px; border-radius:50%; color:#ffffff; background:#1e88e5; font-size:12px; font-weight:900; }.choice-question-remove { margin-left:auto; color:#ff92a5; cursor:pointer; border:0; background:transparent; }.choice-options { display:grid; gap:9px; margin:13px 0 7px; }.choice-option-row { display:grid; grid-template-columns:94px 28px minmax(0,1fr) 52px; align-items:center; gap:8px; }.choice-option-row .el-radio { margin-right:0; color:#2c4a6a; }.choice-option-key { display:grid; place-items:center; width:25px; height:25px; color:#1e88e5; font-weight:900; border:1px solid #cfe2f5; border-radius:5px; }
@media (max-width:640px) { .choice-editor-intro { align-items:flex-start; flex-direction:column; }.choice-option-row { grid-template-columns:78px 25px minmax(0,1fr); }.choice-option-row > .el-button { grid-column:3; justify-self:end; } }
diff --git a/src/views/schoolAdmin/trainingTask/index.vue b/src/views/schoolAdmin/trainingTask/index.vue
index a8e03f2..4116475 100644
--- a/src/views/schoolAdmin/trainingTask/index.vue
+++ b/src/views/schoolAdmin/trainingTask/index.vue
@@ -394,30 +394,9 @@
-
-
-
-
-
- 第一步选择题
- 已配置 {{ stepOneQuestionCount }} 道题
- 暂未配置,学生端第一步将不显示选择题
-
-
-
-
- 从题库选题
-
-
- 设置选择题
-
-
-
+
-
+
@@ -430,6 +409,12 @@
{{ index + 1 }}
+
+
+ 编辑题目{{ stepOneQuestionCount ? `(${stepOneQuestionCount}题)` : "" }}
+
+ 已配置 {{ stepOneQuestionCount }} 道题
+
-
-
-
-
-
- 第一步选择题
- 已配置 {{ stepOneQuestionCount }} 道题
- 暂未配置,学生端第一步将不显示选择题
-
-
-
-
- 从题库选题
-
-
- 设置选择题
-
-
-
+
-
+
@@ -383,6 +361,13 @@
{{ index + 1 }}
+
+
+ 编辑题目{{ stepOneQuestionCount ? `(${stepOneQuestionCount}题)` : "" }}
+
+ 已配置 {{ stepOneQuestionCount }} 道题
+
@@ -1632,6 +1617,20 @@ function buildPayload() {
.el-input {
flex: 1;
}
+
+ .step-question-btn {
+ flex-shrink: 0;
+ height: 32px;
+ font-size: var(--fs-body);
+ font-weight: 600;
+ }
+
+ .step-question-tag {
+ flex-shrink: 0;
+ color: var(--text-muted);
+ font-size: var(--fs-tag);
+ white-space: nowrap;
+ }
}
.drawer-footer {