diff --git a/reading-platform-frontend/src/components/course-edit/Step4IntroLesson.vue b/reading-platform-frontend/src/components/course-edit/Step4IntroLesson.vue index 09dd546..c2a8a3f 100644 --- a/reading-platform-frontend/src/components/course-edit/Step4IntroLesson.vue +++ b/reading-platform-frontend/src/components/course-edit/Step4IntroLesson.vue @@ -14,7 +14,7 @@ diff --git a/reading-platform-frontend/src/components/course-edit/Step5CollectiveLesson.vue b/reading-platform-frontend/src/components/course-edit/Step5CollectiveLesson.vue index 484a7fd..f3a0406 100644 --- a/reading-platform-frontend/src/components/course-edit/Step5CollectiveLesson.vue +++ b/reading-platform-frontend/src/components/course-edit/Step5CollectiveLesson.vue @@ -14,7 +14,7 @@ diff --git a/reading-platform-frontend/src/components/course-edit/Step6DomainLessons.vue b/reading-platform-frontend/src/components/course-edit/Step6DomainLessons.vue index 22ede33..51461db 100644 --- a/reading-platform-frontend/src/components/course-edit/Step6DomainLessons.vue +++ b/reading-platform-frontend/src/components/course-edit/Step6DomainLessons.vue @@ -14,7 +14,7 @@ diff --git a/reading-platform-frontend/src/components/course/LessonConfigPanel.vue b/reading-platform-frontend/src/components/course/LessonConfigPanel.vue index b606050..02ca34b 100644 --- a/reading-platform-frontend/src/components/course/LessonConfigPanel.vue +++ b/reading-platform-frontend/src/components/course/LessonConfigPanel.vue @@ -46,18 +46,10 @@ -
至少上传一个(动画/课件/电子绘本)
- +
按需上传(动画/课件/电子绘本,可选)
+
@@ -93,7 +85,7 @@ - +
@@ -228,8 +220,6 @@ export interface LessonData { useTemplate: boolean; steps: StepData[]; isNew?: boolean; - /** 仅用于表单校验,不持久化 */ - resourceCheck?: string; } interface Props { @@ -276,7 +266,6 @@ const defaultLessonData: LessonData = { assessmentData: '', useTemplate: false, steps: [], - resourceCheck: '', }; const lessonData = reactive({ @@ -332,19 +321,6 @@ const formRules = computed(() => { }, ], }; - if (props.showResources) { - rules.resourceCheck = [ - { - validator: (_: unknown, _val: string) => { - const has = lessonData.videoPath || lessonData.pptPath || lessonData.pdfPath; - if (!has) { - return Promise.reject(new Error('请至少上传一个核心资源(动画/课件/电子绘本)')); - } - return Promise.resolve(); - }, - }, - ]; - } if (extensionRequired.value) { rules.extension = [ { required: true, whitespace: true, message: '请输入教学延伸活动建议' }, @@ -353,29 +329,17 @@ const formRules = computed(() => { return rules; }); -// 同步 resourceCheck 用于校验触发 -watch( - () => [lessonData.videoPath, lessonData.pptPath, lessonData.pdfPath], - () => { - lessonData.resourceCheck = lessonData.videoPath || lessonData.pptPath || lessonData.pdfPath || ''; - }, - { immediate: true } -); - // 监听外部值变化 watch( () => props.modelValue, (newVal) => { Object.assign(lessonData, defaultLessonData, newVal); - lessonData.resourceCheck = lessonData.videoPath || lessonData.pptPath || lessonData.pdfPath || ''; }, { deep: true } ); -// 处理变化(排除校验用字段,不传给父组件) const handleChange = () => { - const { resourceCheck, ...toEmit } = lessonData; - emit('update:modelValue', toEmit as LessonData); + emit('update:modelValue', { ...lessonData } as LessonData); emit('change'); };