From d2de3d3890ee6bf0c15f48a2f5a1de6c71e66c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B2=85?= <907037276@qq.com> Date: Mon, 28 Sep 2026 20:54:21 +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=E6=94=AF=E6=8C=81=E4=BB=8E=E9=A2=98=E5=BA=93=E9=80=89?= =?UTF-8?q?=E9=A2=98=EF=BC=9A=E6=96=B0=E5=A2=9E=E5=85=B1=E7=94=A8=E9=80=89?= =?UTF-8?q?=E9=A2=98=E5=BC=B9=E7=AA=97(=E4=BB=85=E5=8D=95=E9=80=89?= =?UTF-8?q?=E9=A2=98=E3=80=81=E6=8C=89=E9=A2=98=E5=B9=B2=E5=8E=BB=E9=87=8D?= =?UTF-8?q?=E3=80=81=E5=A4=8D=E5=88=B6=E5=BF=AB=E7=85=A7=E8=BD=ACstep=5Fon?= =?UTF-8?q?e=5Fquestions=E6=A0=BC=E5=BC=8F)=EF=BC=8C=E6=95=99=E5=B8=88?= =?UTF-8?q?=E7=AB=AF=E5=8F=96=E6=9C=AC=E6=A0=A1=E9=A2=98=E5=BA=93(scope=3D?= =?UTF-8?q?school)=EF=BC=8C=E5=B9=B3=E5=8F=B0=E7=AB=AF=E5=8F=96=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E9=A2=98=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/StepOneQuestionBankPicker.vue | 135 ++++++++++++++++++ src/views/schoolAdmin/trainingTask/index.vue | 18 +++ src/views/teacherEnd/trainingTask/index.vue | 18 +++ 3 files changed, 171 insertions(+) create mode 100644 src/views/components/StepOneQuestionBankPicker.vue diff --git a/src/views/components/StepOneQuestionBankPicker.vue b/src/views/components/StepOneQuestionBankPicker.vue new file mode 100644 index 0000000..75e80cb --- /dev/null +++ b/src/views/components/StepOneQuestionBankPicker.vue @@ -0,0 +1,135 @@ + + + + + diff --git a/src/views/schoolAdmin/trainingTask/index.vue b/src/views/schoolAdmin/trainingTask/index.vue index 8aff34b..a8e03f2 100644 --- a/src/views/schoolAdmin/trainingTask/index.vue +++ b/src/views/schoolAdmin/trainingTask/index.vue @@ -408,11 +408,15 @@
+ + 从题库选题 + 设置选择题
+ @@ -478,7 +482,9 @@ import { uploadTrainingTaskMaterial, } from "@/api/trainingTask"; import StepOneChoiceQuestionEditor from "@/views/components/StepOneChoiceQuestionEditor.vue"; +import StepOneQuestionBankPicker from "@/views/components/StepOneQuestionBankPicker.vue"; import { parseStepOneChoiceQuestions, supportsStepOneChoiceQuestions } from "@/utils/stepOneChoiceQuestions"; +import { getPlatformQuestions } from "@/api/exam"; const { proxy } = getCurrentInstance(); @@ -488,6 +494,7 @@ const loading = ref(false); const saving = ref(false); const uploadingField = ref(""); const choiceEditorVisible = ref(false); +const bankPickerVisible = ref(false); // 四类资料槽位:key 对应 taskForm 的 `${key}Name` / `${key}Url` 字段 const materialSlots = [ { key: "material", label: "案例资料" }, @@ -600,6 +607,17 @@ function supportsStepOneChoice(taskKey) { return supportsStepOneChoiceQuestions(taskKey); } +// 平台题库单选题(平台管理员维护默认任务,题源为平台题库) +async function loadBankQuestions() { + const res = await getPlatformQuestions({ type: "SINGLE" }); + return res?.data || []; +} + +function handleBankConfirm(questions) { + taskForm.stepOneQuestions = [...(taskForm.stepOneQuestions || []), ...questions]; + proxy?.$modal?.msgSuccess(`已从题库添加 ${questions.length} 道题,点击“保存配置”后生效`); +} + function hasMaterial(slotKey) { return isRealMaterial(taskForm[`${slotKey}Name`], taskForm[`${slotKey}Url`]); } diff --git a/src/views/teacherEnd/trainingTask/index.vue b/src/views/teacherEnd/trainingTask/index.vue index 5a53891..fda1442 100644 --- a/src/views/teacherEnd/trainingTask/index.vue +++ b/src/views/teacherEnd/trainingTask/index.vue @@ -359,11 +359,15 @@
+ + 从题库选题 + 设置选择题
+ @@ -420,7 +424,9 @@ import { createStudentDemoSession } from "@/api/studentDemo" import * as indexApi from "@/api/teacher" import useUserStore from "@/store/modules/user" import StepOneChoiceQuestionEditor from "@/views/components/StepOneChoiceQuestionEditor.vue" +import StepOneQuestionBankPicker from "@/views/components/StepOneQuestionBankPicker.vue" import { parseStepOneChoiceQuestions, supportsStepOneChoiceQuestions } from "@/utils/stepOneChoiceQuestions" +import { getQuestions } from "@/api/exam" const { proxy } = getCurrentInstance() const userStore = useUserStore() @@ -433,6 +439,7 @@ const saving = ref(false) const restoring = ref(false) const uploadingField = ref("") const choiceEditorVisible = ref(false) +const bankPickerVisible = ref(false) // 四类资料槽位:key 对应 taskForm 的 `${key}Name` / `${key}Url` 字段 const materialSlots = [ { key: "material", label: "案例资料" }, @@ -603,6 +610,17 @@ function supportsStepOneChoice(taskKey) { return supportsStepOneChoiceQuestions(taskKey) } +// 本校题库单选题(平台题 + 本校教师题,按学校过滤) +async function loadBankQuestions() { + const res = await getQuestions({ scope: "school", type: "SINGLE" }) + return res?.data || [] +} + +function handleBankConfirm(questions) { + taskForm.stepOneQuestions = [...(taskForm.stepOneQuestions || []), ...questions] + proxy?.$modal?.msgSuccess(`已从题库添加 ${questions.length} 道题,点击“保存配置”后生效`) +} + function hasMaterial(slotKey) { return isRealMaterial(taskForm[`${slotKey}Name`], taskForm[`${slotKey}Url`]) }