diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/experimentQuestion/components/experimentList.vue b/src/renderer/src/views/classTask/newClassTaskAssign/experimentQuestion/components/experimentList.vue index a7ff24a..0a6fbe6 100644 --- a/src/renderer/src/views/classTask/newClassTaskAssign/experimentQuestion/components/experimentList.vue +++ b/src/renderer/src/views/classTask/newClassTaskAssign/experimentQuestion/components/experimentList.vue @@ -51,7 +51,8 @@ onMounted(() => { }) defineExpose({ - updateLabel + updateLabel, + onSelectOption }) diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/experimentQuestion/components/selectClass.vue b/src/renderer/src/views/classTask/newClassTaskAssign/experimentQuestion/components/selectClass.vue index b076850..103ca5a 100644 --- a/src/renderer/src/views/classTask/newClassTaskAssign/experimentQuestion/components/selectClass.vue +++ b/src/renderer/src/views/classTask/newClassTaskAssign/experimentQuestion/components/selectClass.vue @@ -49,7 +49,7 @@ import useClassTaskStore from '@/store/modules/classTask' const userStore = useUserStore().user // 定义要发送的emit事件 -// let emit = defineEmits(['experlist']) +let emit = defineEmits(['experlist']) // const expObj = ref({ // edustage: useClassTaskStore().experimentObj.edustage, // edusubject: useClassTaskStore().experimentObj.edusubject, @@ -268,7 +268,7 @@ const handleUserEduStage = (item) => { } } // 选择学科 -const handleUserEduSubject = (item) => { +const handleUserEduSubject = (item, isEmit=true) => { // userStore.edusubject = item; useClassTaskStore().experimentObj.edusubject = item; console.log(item,'选择的学科-------') @@ -292,7 +292,9 @@ const handleUserEduSubject = (item) => { } console.log(checkList.value,'checkList') useClassTaskStore().experimentObj.experimentList = checkList.value; - // emit('experlist',checkList.value) + if (isEmit) { + emit('experlist',checkList.value) + } } const updateCheckList = async () => { @@ -313,7 +315,7 @@ const updateCheckList = async () => { expList.value = chooseGrade.value const edusubject = useClassTaskStore().experimentObj.edusubject; bindSubject.value = [edustage, edusubject]; - handleUserEduSubject(edusubject); + handleUserEduSubject(edusubject, false); } catch (error) { console.error(error); } diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/experimentQuestion/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/experimentQuestion/index.vue index 711f49e..c8f7dc2 100644 --- a/src/renderer/src/views/classTask/newClassTaskAssign/experimentQuestion/index.vue +++ b/src/renderer/src/views/classTask/newClassTaskAssign/experimentQuestion/index.vue @@ -3,7 +3,7 @@
- +
@@ -69,11 +69,13 @@ onMounted(() => { // // mainDiv 为需控制高度自适应盒子,通过 ref="mainDiv" 绑定 // } -// 选择的学科 获取实验课程信息 -// const getExperimentList = (val) => { -// console.log(val,'选择的学科,获取实验课程list信息') -// // experimentList.value = val; -// } +// 根据选择的学科 自动选中实验课程的第一个 +const initExperimentFirst = (val) => { + // 默认选中第一个实验 + if (val[0].label && val[0].label !='') { + selectExperimentRef.value.onSelectOption(val[0].label); + } +} // 选择的实验课 const getExperimentListItem = (val) => { console.log(val,'选择的实验课程信息') @@ -82,7 +84,7 @@ const getExperimentListItem = (val) => { } // 监听实验课程信息 watch(() => props.expObj.fileurl, (newVal, oldVal) => { - console.log(props.expObj,'科学实验科目') + console.log(props.expObj,'监听-科学实验科目') activeExp.value = props.expObj; //