diff --git a/src/renderer/src/utils/comm.js b/src/renderer/src/utils/comm.js index a0d457f..81dd001 100644 --- a/src/renderer/src/utils/comm.js +++ b/src/renderer/src/utils/comm.js @@ -127,7 +127,10 @@ export const removePropertyOf = function(obj){ export function removeTree(list) { var this_ = this for (var i in list) { - if (list[i].children.length == 0) { + if (list[i].children == null) { + delete list[i].children; + } + else if (list[i].children.length == 0) { list[i].children = undefined } else { this_.removeTree(list[i].children) diff --git a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue index de215d4..f2b3d1b 100644 --- a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue +++ b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue @@ -286,6 +286,7 @@ import { updateClasswork, listEvaluationclue, listClassworkeval,delClassworkeval import { listEvaluation } from '@/api/subject' import { listEntpcoursefile } from '@/api/education/entpcoursefile' import { listKnowledgePoint } from "@/api/knowledge/knowledgePoint"; +import { isJson } from "@/utils/comm"; import { useGetHomework } from '@/hooks/useGetHomework' @@ -483,12 +484,13 @@ function Apis(key) { */ const t = function(name, time) { return new Promise(resolve => { + const evalId = props.bookobj.levelSecondId=='' ? props.bookobj.levelFirstId : props.bookobj.levelSecondId; const queryForm = { // 分页参数 currentPage: paginationParams.pageNum, pageSize: paginationParams.pageSize, // 课程相关参数 - eid: props.bookobj.levelSecondId, + eid: evalId, sectionName: props.bookobj.coursetitle, edusubject: userStore.edusubject, edustage: userStore.edustage, @@ -583,10 +585,14 @@ const getQueryFromEvaluationclue = () => { } if (clueres.rows[i].childlist != '') { - clueres.rows[i].childArray = JSON.parse('['+clueres.rows[i].childlist+']'); - for (var j=0; j]+)>)/ig, ''); + const tmpJson = '['+clueres.rows[i].childlist+']'; + if (isJson(tmpJson)){ + clueres.rows[i].childArray = JSON.parse(tmpJson); + for (var j=0; j]+)>)/ig, ''); + } } + } else { clueres.rows[i].childArray = {}; } @@ -1062,9 +1068,27 @@ watch(() => props.propsformobj.uniquekey, (newVal) => { classWorkForm.uniquekey = props.propsformobj.uniquekey?cloneDeep(props.propsformobj.uniquekey):''; // 作业唯一标识 作业名称 } }) -watch(() => props.bookobj.levelSecondId, (newVal, oldVal) => { - console.log(props.bookobj,'课程选择') - debounceQueryData(); +watch( + [ + () => props.bookobj.levelSecondId, + () => props.bookobj.levelFirstId + ], + ([newLevelSecondId, newLevelFirstId], [oldLevelSecondId, oldLevelFirstId]) => { + if(props.bookobj.node.edusubject == '英语' && props.bookobj.node.edustage == '高中'){ + if(newLevelFirstId != oldLevelFirstId){ + console.log(props.bookobj,'高中英语-课程选择') + debounceQueryData(); + } + else{ + // 习题清空 + workResource.entpCourseWorkList = []; + return; + } + } + else{ + console.log(props.bookobj,'课程选择') + debounceQueryData(); + } })