From f18d0c0e5e34c164dd01b1d9efd217a9ee136172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E4=BA=86=E4=B8=AA=E7=99=BD?= <543593352@qq.com> Date: Thu, 17 Oct 2024 10:42:10 +0800 Subject: [PATCH] 1 --- .../src/views/classTask/classTaskAssign.vue | 207 +++++++++--------- 1 file changed, 100 insertions(+), 107 deletions(-) diff --git a/src/renderer/src/views/classTask/classTaskAssign.vue b/src/renderer/src/views/classTask/classTaskAssign.vue index 184eb2a..3e91c71 100644 --- a/src/renderer/src/views/classTask/classTaskAssign.vue +++ b/src/renderer/src/views/classTask/classTaskAssign.vue @@ -402,15 +402,16 @@ const getData = (data) => { } /** - * 获取 entpcourseid + * 获取 entpcourseid 获取作业列表 */ const initHomeWork = async()=> { + loading.value = true; const { res, chapterId } = await useGetHomework(courseObj.node); console.log('entpcourseid', chapterId); console.log('res', res); entpcourseid.value = chapterId; taskList.value = res; - + loading.value = false; } /** * 查看推送历史 @@ -494,7 +495,7 @@ const handleDelete =() => { return delClasswork(ids.join(',')); }).then(() => { setTimeout(() => { - getTaskList(); + initHomeWork(); }, 1500); proxy.$modal.msgSuccess("删除成功"); }).catch(() => {}) @@ -507,105 +508,105 @@ const handleDelete =() => { /** * 1.获取作业列表 */ -const getTaskList = async () => { - // 新版查询方式 - taskList.value = []; - loading.value = true; - homeworklist({entpcourseid: entpcourseid.value, orderby: "deaddate DESC" , edituserid: userStore.userId, pageSize: 500}).then(res => { - let model = []; - let mission = []; +// const getTaskList = async () => { +// // 新版查询方式 +// taskList.value = []; +// loading.value = true; +// homeworklist({entpcourseid: entpcourseid.value, orderby: "deaddate DESC" , edituserid: userStore.userId, pageSize: 500}).then(res => { +// let model = []; +// let mission = []; - if(res.rows&&res.rows.length > 0){ - // 根据创建时间 倒序排列一下 - res.rows.sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp)); - } - for (let item of res.rows){ - item.taskconfig = []; +// if(res.rows&&res.rows.length > 0){ +// // 根据创建时间 倒序排列一下 +// res.rows.sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp)); +// } +// for (let item of res.rows){ +// item.taskconfig = []; - // 赋值默认值 - if (item.timelength == null) { - item.timelength = 1; - } - if (item.weights == null) { - item.weights = 1; - } +// // 赋值默认值 +// if (item.timelength == null) { +// item.timelength = 1; +// } +// if (item.weights == null) { +// item.weights = 1; +// } - // 处理任务类型的UI - if (item.worktype == '学习目标定位') { - item.workclass = 'success'; - item.workcodesList = JSON.parse(item.workcodes); - } else if (item.worktype == '教材研读') { - item.workclass = 'primary'; - } else if (item.worktype == '框架梳理') { - item.workclass = 'warning'; - } else if (item.worktype == '学科定位') { - item.workclass = 'info'; - } else if (item.worktype == '习题训练') { - item.workclass = 'danger'; - } else { - item.workclass = 'primary'; - } - // 如果是习题训练任务,则检查一共有多少道 - if (item.entpcourseworklist != '') { - item.entpcourseworklistarray = JSON.parse('['+item.entpcourseworklist+']'); - } else { - item.entpcourseworklistarray = []; - } +// // 处理任务类型的UI +// if (item.worktype == '学习目标定位') { +// item.workclass = 'success'; +// item.workcodesList = JSON.parse(item.workcodes); +// } else if (item.worktype == '教材研读') { +// item.workclass = 'primary'; +// } else if (item.worktype == '框架梳理') { +// item.workclass = 'warning'; +// } else if (item.worktype == '学科定位') { +// item.workclass = 'info'; +// } else if (item.worktype == '习题训练') { +// item.workclass = 'danger'; +// } else { +// item.workclass = 'primary'; +// } +// // 如果是习题训练任务,则检查一共有多少道 +// if (item.entpcourseworklist != '') { +// item.entpcourseworklistarray = JSON.parse('['+item.entpcourseworklist+']'); +// } else { +// item.entpcourseworklistarray = []; +// } - // 根据状态,过滤之前的旧任务 - if (item.status == '10') { - // 任务状态为模板, 直接添加 - model.push(item); - continue; - } - else if (item.status == '1') { - // 任务状态为已推送的任务, 则格式化推送学生数据 - let ss = []; - if (item.classworkdatastudentids != null) { - ss = JSON.parse('['+ item.classworkdatastudentids+']'); - } - const js = { - id: item.id, - classid: item.classid, - classcaption: item.classcaption, - parentid: 0, - worktype: '', - workkey: item.workkey, - worktag: '', - entpcourseid: 0, - evalid: 0, - edusubject: '', - edudegree: '', - workdate: '', - title: '', - workcodes: '', - studentlist: ss, - deaddate: item.deaddate, - timelength: item.timelength, - weights: item.weights, - feedtype: item.feedtype - } - item.taskconfig.push(js); - mission.push(item); - } - } +// // 根据状态,过滤之前的旧任务 +// if (item.status == '10') { +// // 任务状态为模板, 直接添加 +// model.push(item); +// continue; +// } +// else if (item.status == '1') { +// // 任务状态为已推送的任务, 则格式化推送学生数据 +// let ss = []; +// if (item.classworkdatastudentids != null) { +// ss = JSON.parse('['+ item.classworkdatastudentids+']'); +// } +// const js = { +// id: item.id, +// classid: item.classid, +// classcaption: item.classcaption, +// parentid: 0, +// worktype: '', +// workkey: item.workkey, +// worktag: '', +// entpcourseid: 0, +// evalid: 0, +// edusubject: '', +// edudegree: '', +// workdate: '', +// title: '', +// workcodes: '', +// studentlist: ss, +// deaddate: item.deaddate, +// timelength: item.timelength, +// weights: item.weights, +// feedtype: item.feedtype +// } +// item.taskconfig.push(js); +// mission.push(item); +// } +// } - // 再根据父子关系重新排序 - let list = []; - for (let item of model){ - item.children = []; - for (let child of mission) { - if (item.id == child.parentid) { - item.children.push(child); - } - } - list.push(item); - } - // 根据 父项、子项 创建时间倒序排列一下 - taskList.value = list; - loading.value = false; - }) -} +// // 再根据父子关系重新排序 +// let list = []; +// for (let item of model){ +// item.children = []; +// for (let child of mission) { +// if (item.id == child.parentid) { +// item.children.push(child); +// } +// } +// list.push(item); +// } +// // 根据 父项、子项 创建时间倒序排列一下 +// taskList.value = list; +// loading.value = false; +// }) +// } // 【编辑/查看】作业说明 @@ -753,7 +754,7 @@ const successHomework = () => { setDialog.value = false; // 刷新布置列表 nextTick(() => { - getTaskList(); + initHomeWork(); }) } @@ -811,7 +812,7 @@ const submitWorkTitle = () => { proxy.$modal.msgSuccess("修改成功"); currentWorkEdit.workTitleEdit = false; // 刷新列表,重新获取数据 - getTaskList(); + initHomeWork(); }); }; @@ -869,14 +870,6 @@ onMounted(() => { watch(() => courseObj.node, (newVal,oldVal) => { console.log(courseObj,'课程选择') - if(newVal&&oldVal){ - console.log(newVal.id,'newVal') - console.log(oldVal.id,'oldVal') - if(newVal.id != oldVal.id){ - // 习题资源 - // getTaskList(); - } - } })