feat(course): 导入课/集体课/领域课核心资源改为可选,取消必填校验
Made-with: Cursor
This commit is contained in:
parent
4d97e1cbf9
commit
607b0896bd
@ -14,7 +14,7 @@
|
|||||||
<template #description>
|
<template #description>
|
||||||
<div>导入课用于激发幼儿兴趣,引入课程主题。建议时长 5-15 分钟,重点在于吸引注意力、建立学习期待。</div>
|
<div>导入课用于激发幼儿兴趣,引入课程主题。建议时长 5-15 分钟,重点在于吸引注意力、建立学习期待。</div>
|
||||||
<div class="form-hints">
|
<div class="form-hints">
|
||||||
<strong>必填项:</strong>课程名称、教学目标、教学准备、核心资源(至少 1 个)、教学环节(至少 1 个,含环节名称、内容、目标);<strong>时长:</strong>5-15 分钟。
|
<strong>必填项:</strong>课程名称、教学目标、教学准备、教学环节(至少 1 个,含环节名称、内容、目标);核心资源为可选。<strong>时长:</strong>5-15 分钟。
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</a-alert>
|
</a-alert>
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
<template #description>
|
<template #description>
|
||||||
<div>集体课是课程包的核心教学活动,全班幼儿共同参与。建议时长 20-30 分钟,包含绘本动画、教学课件、电子绘本等核心资源。</div>
|
<div>集体课是课程包的核心教学活动,全班幼儿共同参与。建议时长 20-30 分钟,包含绘本动画、教学课件、电子绘本等核心资源。</div>
|
||||||
<div class="form-hints">
|
<div class="form-hints">
|
||||||
<strong>必填项:</strong>课程名称、教学目标、教学准备、核心资源(至少 1 个)、教学环节(至少 1 个)、教学延伸;<strong>时长:</strong>15-45 分钟。
|
<strong>必填项:</strong>课程名称、教学目标、教学准备、教学环节(至少 1 个)、教学延伸;核心资源为可选。<strong>时长:</strong>15-45 分钟。
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</a-alert>
|
</a-alert>
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
<template #description>
|
<template #description>
|
||||||
<div>五大领域课为可选配置,根据课程内容选择配置相关领域课程。每个领域课独立配置,包含教学目标、准备、环节等内容。</div>
|
<div>五大领域课为可选配置,根据课程内容选择配置相关领域课程。每个领域课独立配置,包含教学目标、准备、环节等内容。</div>
|
||||||
<div class="form-hints">
|
<div class="form-hints">
|
||||||
<strong>已启用领域必填:</strong>课程名称、教学目标、教学准备、核心资源(至少 1 个)、教学环节(至少 1 个)、教学延伸;<strong>时长:</strong>15-45 分钟。
|
<strong>已启用领域必填:</strong>课程名称、教学目标、教学准备、教学环节(至少 1 个)、教学延伸;核心资源为可选。<strong>时长:</strong>15-45 分钟。
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</a-alert>
|
</a-alert>
|
||||||
|
|||||||
@ -46,18 +46,10 @@
|
|||||||
<!-- 核心资源(导入课/集体课/领域课显示) -->
|
<!-- 核心资源(导入课/集体课/领域课显示) -->
|
||||||
<a-card v-if="showResources" size="small" class="section-card">
|
<a-card v-if="showResources" size="small" class="section-card">
|
||||||
<template #title>
|
<template #title>
|
||||||
<span>
|
<span>核心资源</span>
|
||||||
核心资源 <span class="required-mark">*</span>
|
|
||||||
</span>
|
|
||||||
</template>
|
</template>
|
||||||
<div class="field-hint">至少上传一个(动画/课件/电子绘本)</div>
|
<div class="field-hint">按需上传(动画/课件/电子绘本,可选)</div>
|
||||||
<a-form-item
|
<div class="resource-upload-row">
|
||||||
name="resourceCheck"
|
|
||||||
label=" "
|
|
||||||
:colon="false"
|
|
||||||
:label-col="{ span: 0 }"
|
|
||||||
:wrapper-col="{ span: 24 }"
|
|
||||||
>
|
|
||||||
<a-row :gutter="16">
|
<a-row :gutter="16">
|
||||||
<a-col :span="8">
|
<a-col :span="8">
|
||||||
<a-form-item label="绘本动画" :name="undefined">
|
<a-form-item label="绘本动画" :name="undefined">
|
||||||
@ -93,7 +85,7 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form-item>
|
</div>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<!-- 教学目标 & 教学准备 -->
|
<!-- 教学目标 & 教学准备 -->
|
||||||
@ -228,8 +220,6 @@ export interface LessonData {
|
|||||||
useTemplate: boolean;
|
useTemplate: boolean;
|
||||||
steps: StepData[];
|
steps: StepData[];
|
||||||
isNew?: boolean;
|
isNew?: boolean;
|
||||||
/** 仅用于表单校验,不持久化 */
|
|
||||||
resourceCheck?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -276,7 +266,6 @@ const defaultLessonData: LessonData = {
|
|||||||
assessmentData: '',
|
assessmentData: '',
|
||||||
useTemplate: false,
|
useTemplate: false,
|
||||||
steps: [],
|
steps: [],
|
||||||
resourceCheck: '',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const lessonData = reactive<LessonData>({
|
const lessonData = reactive<LessonData>({
|
||||||
@ -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) {
|
if (extensionRequired.value) {
|
||||||
rules.extension = [
|
rules.extension = [
|
||||||
{ required: true, whitespace: true, message: '请输入教学延伸活动建议' },
|
{ required: true, whitespace: true, message: '请输入教学延伸活动建议' },
|
||||||
@ -353,29 +329,17 @@ const formRules = computed(() => {
|
|||||||
return rules;
|
return rules;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 同步 resourceCheck 用于校验触发
|
|
||||||
watch(
|
|
||||||
() => [lessonData.videoPath, lessonData.pptPath, lessonData.pdfPath],
|
|
||||||
() => {
|
|
||||||
lessonData.resourceCheck = lessonData.videoPath || lessonData.pptPath || lessonData.pdfPath || '';
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
// 监听外部值变化
|
// 监听外部值变化
|
||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => props.modelValue,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
Object.assign(lessonData, defaultLessonData, newVal);
|
Object.assign(lessonData, defaultLessonData, newVal);
|
||||||
lessonData.resourceCheck = lessonData.videoPath || lessonData.pptPath || lessonData.pdfPath || '';
|
|
||||||
},
|
},
|
||||||
{ deep: true }
|
{ deep: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
// 处理变化(排除校验用字段,不传给父组件)
|
|
||||||
const handleChange = () => {
|
const handleChange = () => {
|
||||||
const { resourceCheck, ...toEmit } = lessonData;
|
emit('update:modelValue', { ...lessonData } as LessonData);
|
||||||
emit('update:modelValue', toEmit as LessonData);
|
|
||||||
emit('change');
|
emit('change');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user