diff --git a/src/renderer/src/views/tool/components/homework.vue b/src/renderer/src/views/tool/components/homework.vue index 9f4d59b..1ecbcf8 100644 --- a/src/renderer/src/views/tool/components/homework.vue +++ b/src/renderer/src/views/tool/components/homework.vue @@ -73,7 +73,6 @@ import { ref, onMounted, toRaw } from 'vue'; import { useRoute } from 'vue-router'; import useUserStore from '@/store/modules/user' -import { homeworklist } from '@/api/teaching/classwork' import { getSmarttalkPage, getPrepareById } from '@/api/file' import SetHomework from '@/views/prepare/container/set-homework.vue' import FileImage from '@/components/file-image/index.vue' @@ -145,7 +144,7 @@ const openFileLink = (item) =>{ // 获取资源数据 const getResource = () => { let querySearch = toRaw(toolStore.curSubjectNode).querySearch - + querySearch.orderByColumn = 'uploadTime' querySearch.isAsc = 'desc' querySearch.pageSize = 500 @@ -156,71 +155,13 @@ const getResource = () => { } -// 获取作业数据 -const getHomework = () => { +//获取作业数据 +const getHomework = async () => { + const data = toRaw(toolStore.curSubjectNode).data.node loading.value = true try { - homeworklist({ - entpcourseid: entpcourseid.value, - edituserid: usertore.userId, - pageSize: 100 - }).then(res => { - //以下代码 参照AIx web端 作业布置 - let list = [] - for (var i = 0; i < res.rows.length; i++) { - res.rows[i].taskconfig = [] - - // 找child - for (var j = 0; j < res.rows.length; j++) { - if (res.rows[j].parentid == res.rows[i].id) { - var ss = [] - if (res.rows[j].classworkdatastudentids != null) { - ss = JSON.parse('[' + res.rows[j].classworkdatastudentids + ']') - } - var js = { - id: res.rows[j].id, - classid: res.rows[j].classid, - classcaption: res.rows[j].classcaption, - parentid: 0, - worktype: '', - workkey: res.rows[j].workkey, - worktag: '', - entpcourseid: 0, - evalid: 0, - edusubject: '', - edudegree: '', - workdate: '', - title: '', - workcodes: '', - studentlist: ss, - deaddate: res.rows[j].deaddate, - timelength: res.rows[j].timelength, - weights: res.rows[j].weights, - feedtype: res.rows[j].feedtype - } - res.rows[i].taskconfig.push(js) - } - } - res.rows[i].fileShowName = res.rows[i].uniquekey - - // 注意slideid>0的,这一些作业是添加到PPT页面的,所以在作业管理中不能出现 - // 2024-05-15,酉阳,jackyshen - if (res.rows[i].classid == 0 && res.rows[i].slideid == 0) { - list.push(res.rows[i]) - } - - // 如果是习题训练任务,则检查一共有多少道 - if (res.rows[i].entpcourseworklist != '') { - res.rows[i].entpcourseworklistarray = JSON.parse( - '[' + res.rows[i].entpcourseworklist + ']' - ) - } else { - res.rows[i].entpcourseworklistarray = [] - } - } - - dataList.value = list - }) + const { res } = await useGetHomework(data) + dataList.value = res } finally { loading.value = false } @@ -245,10 +186,10 @@ function leave(el, done) { onMounted(() => { entpcourseid.value = route.query.entpcourseid lesson.value = route.query.label - getHomework() setTimeout(()=>{ + getHomework() getResource() - },1000) + },200) })