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 {