From ca1c5d5886a2dc35fcb9112fb3b38f8800a64e64 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:46:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E4=BB=BB=E5=8A=A1=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=8E=A5=E5=85=A5=E7=AC=AC=E4=B8=80=E6=AD=A5=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E9=A2=98=E9=85=8D=E7=BD=AE=EF=BC=9A=E6=95=99=E5=B8=88?= =?UTF-8?q?=E7=AB=AF=E4=B8=8E=E5=B9=B3=E5=8F=B0=E7=AB=AF=E6=8A=BD=E5=B1=89?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=80=89=E6=8B=A9=E9=A2=98=E5=85=A5=E5=8F=A3?= =?UTF-8?q?(=E4=BB=85=E6=96=B0=E4=BA=A7=E5=93=81=E8=B0=83=E6=9F=A5/?= =?UTF-8?q?=E8=A1=8C=E4=B8=9A=E9=9C=80=E6=B1=82/=E7=AB=9E=E4=BA=89?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E4=B8=89=E4=B8=AA=E7=99=BD=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1)=EF=BC=8C=E5=A4=8D=E7=94=A8StepOneChoiceQues?= =?UTF-8?q?tionEditor=EF=BC=8C=E4=BF=9D=E5=AD=98=E9=9A=8F=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E9=85=8D=E7=BD=AE=E6=8C=81=E4=B9=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/schoolAdmin/trainingTask/index.vue | 32 +++++++++++++++++++ src/views/teacherEnd/trainingTask/index.vue | 33 ++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/src/views/schoolAdmin/trainingTask/index.vue b/src/views/schoolAdmin/trainingTask/index.vue index dae2a16..8aff34b 100644 --- a/src/views/schoolAdmin/trainingTask/index.vue +++ b/src/views/schoolAdmin/trainingTask/index.vue @@ -394,6 +394,27 @@ + +
+
+ + + + +
+ 第一步选择题 + 已配置 {{ stepOneQuestionCount }} 道题 + 暂未配置,学生端第一步将不显示选择题 +
+
+
+ + 设置选择题 + +
+
+ +
@@ -456,6 +477,8 @@ import { updateTrainingTask, uploadTrainingTaskMaterial, } from "@/api/trainingTask"; +import StepOneChoiceQuestionEditor from "@/views/components/StepOneChoiceQuestionEditor.vue"; +import { parseStepOneChoiceQuestions, supportsStepOneChoiceQuestions } from "@/utils/stepOneChoiceQuestions"; const { proxy } = getCurrentInstance(); @@ -464,6 +487,7 @@ const keyword = ref(""); const loading = ref(false); const saving = ref(false); const uploadingField = ref(""); +const choiceEditorVisible = ref(false); // 四类资料槽位:key 对应 taskForm 的 `${key}Name` / `${key}Url` 字段 const materialSlots = [ { key: "material", label: "案例资料" }, @@ -477,6 +501,7 @@ const dialogMode = ref("view"); const currentTaskId = ref(""); const taskForm = reactive(createEmptyTask()); const isReadonly = computed(() => dialogMode.value === "view"); +const stepOneQuestionCount = computed(() => taskForm.stepOneQuestions?.length || 0); const enabledCount = computed(() => tasks.value.filter(t => t.enabled).length); @@ -564,12 +589,17 @@ function createEmptyTask() { guideManualUrl: "", aiManualName: "", aiManualUrl: "", + stepOneQuestions: [], steps: createBuiltinSteps(), sort: 0, enabled: true, }; } +function supportsStepOneChoice(taskKey) { + return supportsStepOneChoiceQuestions(taskKey); +} + function hasMaterial(slotKey) { return isRealMaterial(taskForm[`${slotKey}Name`], taskForm[`${slotKey}Url`]); } @@ -599,6 +629,7 @@ function normalizeTask(task) { guideManualUrl: guideManual.url, aiManualName: aiManual.name, aiManualUrl: aiManual.url, + stepOneQuestions: parseStepOneChoiceQuestions(task.stepOneQuestions), steps: normalizeSteps(parseArray(task.steps, createBuiltinSteps())), sort: task.sort || 0, enabled: task.enabled !== false, @@ -771,6 +802,7 @@ function buildPayload() { guideManualUrl: taskForm.guideManualUrl, aiManualName: taskForm.aiManualName, aiManualUrl: taskForm.aiManualUrl, + stepOneQuestions: JSON.stringify(taskForm.stepOneQuestions || []), sort: taskForm.sort, enabled: taskForm.enabled, }; diff --git a/src/views/teacherEnd/trainingTask/index.vue b/src/views/teacherEnd/trainingTask/index.vue index 484db09..5a53891 100644 --- a/src/views/teacherEnd/trainingTask/index.vue +++ b/src/views/teacherEnd/trainingTask/index.vue @@ -344,6 +344,28 @@
+ +
+
+ + + + +
+ 第一步选择题 + 已配置 {{ stepOneQuestionCount }} 道题 + 暂未配置,学生端第一步将不显示选择题 +
+
+
+ + 设置选择题 + +
+
+ +
@@ -397,6 +419,8 @@ import { listTrainingTasks, listClassTrainingTasks, saveClassTrainingTask, resto 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 { parseStepOneChoiceQuestions, supportsStepOneChoiceQuestions } from "@/utils/stepOneChoiceQuestions" const { proxy } = getCurrentInstance() const userStore = useUserStore() @@ -408,6 +432,7 @@ const classesLoading = ref(false) const saving = ref(false) const restoring = ref(false) const uploadingField = ref("") +const choiceEditorVisible = ref(false) // 四类资料槽位:key 对应 taskForm 的 `${key}Name` / `${key}Url` 字段 const materialSlots = [ { key: "material", label: "案例资料" }, @@ -423,6 +448,7 @@ const dialogMode = ref("view") const taskForm = reactive(createEmptyTask()) const currentUserId = computed(() => userStore.userInfo.userId) const isReadonly = computed(() => dialogMode.value === "view") +const stepOneQuestionCount = computed(() => taskForm.stepOneQuestions?.length || 0) const projects = computed(() => [...new Set(tasks.value.map((task) => task.project).filter(Boolean))]) const projectOptions = computed(() => { return projects.value.map((project) => ({ @@ -566,12 +592,17 @@ function createEmptyTask() { guideManualUrl: "", aiManualName: "", aiManualUrl: "", + stepOneQuestions: [], steps: createBuiltinSteps(), sort: 0, enabled: true, } } +function supportsStepOneChoice(taskKey) { + return supportsStepOneChoiceQuestions(taskKey) +} + function hasMaterial(slotKey) { return isRealMaterial(taskForm[`${slotKey}Name`], taskForm[`${slotKey}Url`]) } @@ -601,6 +632,7 @@ function normalizeTask(task) { guideManualUrl: guideManual.url, aiManualName: aiManual.name, aiManualUrl: aiManual.url, + stepOneQuestions: parseStepOneChoiceQuestions(task.stepOneQuestions), steps: normalizeSteps(parseArray(task.steps, createBuiltinSteps())), sort: task.sort || 0, enabled: task.enabled !== false, @@ -833,6 +865,7 @@ function buildPayload() { guideManualUrl: taskForm.guideManualUrl, aiManualName: taskForm.aiManualName, aiManualUrl: taskForm.aiManualUrl, + stepOneQuestions: JSON.stringify(taskForm.stepOneQuestions || []), sort: taskForm.sort, enabled: taskForm.enabled, }