作业设计:科学实验

This commit is contained in:
白了个白 2024-12-20 15:23:34 +08:00
parent 4ad59a8b4e
commit 622a71253f
5 changed files with 94 additions and 71 deletions

View File

@ -117,6 +117,8 @@ export const editListItem = (row, courseObj) => {
classtaskObj.fileHomeworkList = JSON.parse(row.workcodes);
//
// console.log('科学实验', classtaskObj);
// 更新默认的科学实验( 学段 学科 以及实验科目)
console.log('科学实验', classtaskObj);
return resolve(classtaskObj);
}
}

View File

@ -5,6 +5,11 @@ import { JYApiListCT, JYApiListOriginYear, JYApiListSO} from "@/utils/examQuesti
const useClassTaskStore = defineStore('classTask',{
state: () => ({
experimentObj:{
edustage: '小学', // 教育阶段
edusubject: '', // 学科
experimentList: [], // 实验科目列表
},
isOpenQuestUploadView: false, // 是否打开习题上传的页面
classListIds: [],
entpCourseWorkTypeList: [

View File

@ -8,7 +8,7 @@
@change="onSelectOption"
>
<el-option
v-for="item in props.list"
v-for="item in classTaskStore.experimentList"
:key="item.value"
:label="item.label"
:value="item.label"
@ -21,8 +21,10 @@
import useUserStore from '@/store/modules/user'
import {ArrowDown} from '@element-plus/icons-vue'
import { onMounted,ref } from 'vue';
import useClassTaskStore from '@/store/modules/classTask'
const userStore = useUserStore().user
const subjectList = ref([])
const classTaskStore = useClassTaskStore().experimentObj
// emit
let emit = defineEmits(['selectItem'])
@ -42,7 +44,7 @@ onMounted(() => {
const onSelectOption = (option) => {
console.log(option,'选择的实验课-------')
emit('selectItem', props.list.filter(item => item.label === option)[0])
emit('selectItem', classTaskStore.experimentList.filter(item => item.label === option)[0])
}
</script>

View File

@ -3,7 +3,7 @@
<div style="margin-left: 15px">
<el-dropdown @command="handleUserEduStage">
<span class="el-dropdown-link">
<el-button class="custom-button" type="default" round >{{ userStore.edustage }}
<el-button class="custom-button" type="default" round >{{ useClassTaskStore().experimentObj.edustage }}
<el-icon><ArrowDown /></el-icon>
</el-button>
</span>
@ -20,14 +20,14 @@
<div style="margin-left: 15px">
<el-dropdown @command="handleUserEduSubject">
<span class="el-dropdown-link">
<el-button class="custom-button" type="default" round>{{ userStore.edusubject }}
<el-button class="custom-button" type="default" round>{{ useClassTaskStore().experimentObj.edusubject }}
<el-icon><ArrowDown /></el-icon>
</el-button>
</span>
<template #dropdown>
<el-dropdown-menu>
<template v-for="(item, index) in subjectList">
<el-dropdown-item v-if="item.edustage == userStore.edustage" :command="item.itemtitle">{{
<el-dropdown-item v-if="item.edustage == useClassTaskStore().experimentObj.edustage && isExpList(item.itemtitle)" :command="item.itemtitle">{{
item.itemtitle }}</el-dropdown-item>
</template>
</el-dropdown-menu>
@ -43,11 +43,15 @@ import {ArrowDown} from '@element-plus/icons-vue'
import { onMounted,ref } from 'vue';
import { listEvaluation } from '@/api/subject/index'
import jsonData from "@/utils/phetData.json";
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,
// })
const subjectList = ref([])
const chooseGrade= ref({})
const expList = ref([]) //
@ -62,63 +66,82 @@ const getSubject = () => {
const arr = userStore.subject.split(',')
subjectList.value = res.rows.filter(item => arr.includes(String(item.id))).map(items => items)
console.log(subjectList,'subjectList');
})
//
handleUserEduStage(useClassTaskStore().experimentObj.edustage)
}
//
const isExpList = (edusubject) => {
let list = [];
switch (edusubject){
case '数学':
list = expList.value.filter(item => item.subject === 'math')
break;
case '物理':
list = expList.value.filter(item => item.subject === 'physics')
break;
case '化学':
checkList.value = expList.value.filter(item => item.subject === 'chemistry')
break;
case '生物':
list = expList.value.filter(item => item.subject === 'biology')
break;
case '科学':
list = expList.value.filter(item => item.subject === 'sciences')
break;
}
return list.length > 0
}
//
const handleUserEduStage = (item) => {
userStore.edustage = item
// sessionStore.set('edustageSelf',item)
// if(item === ''){
// //
// userStore.edusubject = ''
// // sessionStore.set('edusubjectSelf','')
// }
// else
if(item === '高中' && userStore.edusubject === "道德与法治"){
//
userStore.edusubject = '政治'
// sessionStore.set('edusubjectSelf','')
}
else if(item != '高中' && userStore.edusubject === "政治"){
//
userStore.edusubject = '道德与法治'
// sessionStore.set('edusubjectSelf','')
}
//
// userStore.edustage = item
useClassTaskStore().experimentObj.edustage = item
//
expList.value = []
if(item === '小学'){
chooseGrade.value = jsonData.data.primary
expList.value = chooseGrade.value
const newSubjectList = subjectList.value.filter(item => item.edustage === '小学');
for(let i in newSubjectList){
const name = newSubjectList[i].itemtitle
if(isExpList(name)){
useClassTaskStore().experimentObj.edusubject = name;
//
handleUserEduSubject(name)
}
}
}else if(item === '初中'){
chooseGrade.value = jsonData.data.junior
expList.value = chooseGrade.value
const newSubjectList = subjectList.value.filter(item => item.edustage === '初中');
for(let i in newSubjectList){
const name = newSubjectList[i].itemtitle
if(isExpList(name)){
useClassTaskStore().experimentObj.edusubject = name;
//
handleUserEduSubject(name)
}
}
}else if(item === '高中'){
chooseGrade.value = jsonData.data.senior
expList.value = chooseGrade.value
const newSubjectList = subjectList.value.filter(item => item.edustage === '高中');
for(let i in newSubjectList){
const name = newSubjectList[i].itemtitle
if(isExpList(name)){
useClassTaskStore().experimentObj.edusubject = name;
//
handleUserEduSubject(name)
}
}
}
for(let i in chooseGrade.value){
expList.value.push(chooseGrade.value[i])
}
console.log(expList.value,'expList.value')
// const queryGrages = this.subjectList.filter(itemSubject => itemSubject.edustage === item)
// selectSubject(item, subjectList.value)
}
//
const handleUserEduSubject = (item) => {
userStore.edusubject = item;
// sessionStore.set('edusubjectSelf',item)
// userStore.edusubject = item;
useClassTaskStore().experimentObj.edusubject = item;
console.log(item,'选择的学科-------')
//
// this.chooseSubject = item
checkList.value = []
// const queryGrages = expList.value.filter(itemSubject => itemSubject.edustage === item) || []
//
// const subjectNameList = queryGrages.map(itemSubName => {
// return itemSubName.edusubject
// })
// if(!subjectNameList.includes(item)) return
switch (item){
case '数学':
checkList.value = expList.value.filter(item => item.subject === 'math')
@ -137,7 +160,8 @@ const handleUserEduSubject = (item) => {
break;
}
console.log(checkList.value,'checkList')
emit('experlist',checkList.value)
useClassTaskStore().experimentObj.experimentList = checkList.value;
// emit('experlist',checkList.value)
}

View File

@ -2,14 +2,16 @@
<div class="experiment-page">
<div class="activeExp-header">
<div class="infomation" v-if="isStadium() !== true" >
<selectClass v-if="!isSubject" @experlist="getExperimentList" />
<!-- <selectClass v-if="!isSubject" @experlist="getExperimentList" /> -->
<selectClass v-if="!isSubject" />
</div>
<div>
<selectExperiment :list="experimentList" @selectItem="getExperimentListItem" />
<selectExperiment @selectItem="getExperimentListItem" />
</div>
</div>
<div ref="mainDiv" class="activeExp-main" style="overflow: auto">
<iframe :src="activeExp.fileurl" ref="myuunity" width="100%" height="100%" scrolling="no" frameborder="0"></iframe>
<div v-if="!activeExp.fileurl"><el-empty description="暂无学科实验"></el-empty></div>
<iframe v-else :src="activeExp.fileurl" ref="myuunity" width="100%" height="100%" scrolling="no" frameborder="0"></iframe>
<!-- <phet/>-->
</div>
</div>
@ -18,21 +20,10 @@
import { Search } from '@element-plus/icons-vue'
//import html2canvas from 'html2canvas';
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
import { getBindlist } from '@/api/education/knowledgePoint'
import examDetailsDrawer from '@/components/exam-question/examDetailsDrawer.vue'
import { processList } from '@/hooks/useProcessList'
import { useGetHomework } from '@/hooks/useGetHomework'
import { sessionStore } from '@/utils/store'
import {throttle,debounce } from '@/utils/comm'
import useUserStore from '@/store/modules/user'
import useClassTaskStore from '@/store/modules/classTask'
//
import selectClass from './components/selectClass.vue'
//
import selectExperiment from './components/experimentList.vue'
import selectClass from './components/selectClass.vue' //
import selectExperiment from './components/experimentList.vue' //
// emit
@ -51,7 +42,7 @@ const props = defineProps({
}
})
//
const experimentList = ref([]);
// const experimentList = ref([]);
const activeExp = ref({});
const isStadium = () => {
@ -77,20 +68,19 @@ onMounted(() => {
// }
//
const getExperimentList = (val) => {
console.log(val,'选择的学科获取实验课程list信息')
experimentList.value = val;
}
// const getExperimentList = (val) => {
// console.log(val,'list')
// // experimentList.value = val;
// }
//
const getExperimentListItem = (val) => {
console.log(val,'选择的实验课程信息')
activeExp.value = val;
emit('clickExpObj', val)
}
console.log(props.expObj,'科学props.expObj实验科目')
//
watch(() => props.expObj.fileurl, (newVal, oldVal) => {
console.log(newVal,'科学实验科目')
console.log(props.expObj,'科学实验科目')
activeExp.value = props.expObj;
})