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`]) }