From d290be9320e894b752b568c0114200fe27552319 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 11:28:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E3=80=81=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=89=B9=E6=94=B9=20=E8=BF=9B=E8=A1=8C=E7=BB=93=E6=9D=9F=20?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/classTask/classTask.vue | 103 ++++++++++++------ .../views/desktop/container/work-trend.vue | 4 +- 2 files changed, 69 insertions(+), 38 deletions(-) diff --git a/src/renderer/src/views/classTask/classTask.vue b/src/renderer/src/views/classTask/classTask.vue index b682c68..2742b43 100644 --- a/src/renderer/src/views/classTask/classTask.vue +++ b/src/renderer/src/views/classTask/classTask.vue @@ -145,63 +145,78 @@ const getClassWorkList = async () => { edituserid: userStore.userId, // 老师的id edustage: userStore.edustage, // 学段 edusubject: userStore.edusubject,//学科 - deaddate: tabActive.value === '进行中'? getTomorrow() : EndDate.value,// 进行中:明天,已结束:选择的日期 + // deaddate: tabActive.value === '进行中'? getTomorrow() : EndDate.value,// 进行中:明天,已结束:选择的日期 弃用 + deaddate: EndDate.value,// 进行中:明天,已结束:选择的日期 status: '1', // 作业状态:1-已发布 // orderby: 'concat(deaddate,uniquekey) DESC', orderby: 'deaddate DESC', pageSize: 100, }) - for (var i = 0; i < response.rows.length; i++) { + /** + * 2024-10-17 由于 后面截止时间加了 时分,特加判断 + * 1、进行中、以前是以明天判断。现改为传当天的日期,并根据当前日期的时分与截止日期进行判断, + * 2、已结束、以前默认是以明天判断。现依然以明天为判断,并根据当前日期时分大于截止日期时分判断。 + */ + let list = []; + if(tabActive.value === '进行中'){ + // 进行中 当前日期时间 小于 截止 日期时间 + list = response.rows&&response.rows.filter(item => item.deaddate && getCurrentTime('YYYY-MM-DD HH:mm') < item.deaddate); // 进行中 + }else{ + list = response.rows&&response.rows.filter(item => item.deaddate && getCurrentTime('YYYY-MM-DD HH:mm') > item.deaddate); // 已结束 + } + + + for (var i = 0; i < list.length; i++) { // 初始化部分新增字段值 - response.rows[i].workdatalist = [] - response.rows[i].workdatacount = 0 // 人数 - response.rows[i].workdatalistVisible = false - response.rows[i].workdatafeedbackcount = 0 // 已交人数 - response.rows[i].feedtimelength = 0 - response.rows[i].rightAnswerCount = 0 - response.rows[i].scoingRate = 0 + '%' // 得分率 - response.rows[i].averagetime = 0 // 平均用时 + list[i].workdatalist = [] + list[i].workdatacount = 0 // 人数 + list[i].workdatalistVisible = false + list[i].workdatafeedbackcount = 0 // 已交人数 + list[i].feedtimelength = 0 + list[i].rightAnswerCount = 0 + list[i].scoingRate = 0 + '%' // 得分率 + list[i].averagetime = 0 // 平均用时 // ---------------------------------------------- // 处理任务类型的UI - if (response.rows[i].worktype == '学习目标定位') { - response.rows[i].workclass = 'success' - response.rows[i].workcodesList = JSON.parse(response.rows[i].workcodes) - } else if (response.rows[i].worktype == '教材研读') { - response.rows[i].workclass = 'primary' - } else if (response.rows[i].worktype == '框架梳理') { - response.rows[i].workclass = 'warning' - } else if (response.rows[i].worktype == '学科定位') { - response.rows[i].workclass = 'info' - } else if (response.rows[i].worktype == '习题训练') { - response.rows[i].workclass = 'danger' + if (list[i].worktype == '学习目标定位') { + list[i].workclass = 'success' + list[i].workcodesList = JSON.parse(response.rows[i].workcodes) + } else if (list[i].worktype == '教材研读') { + list[i].workclass = 'primary' + } else if (list[i].worktype == '框架梳理') { + list[i].workclass = 'warning' + } else if (list[i].worktype == '学科定位') { + list[i].workclass = 'info' + } else if (list[i].worktype == '习题训练') { + list[i].workclass = 'danger' } else { - response.rows[i].workclass = '' + list[i].workclass = '' } // 如果是习题训练任务,则检查一共有多少道 - if (response.rows[i].entpcourseworklist != '') { - response.rows[i].entpcourseworklistarray = JSON.parse( - '[' + response.rows[i].entpcourseworklist + ']' + if (list[i].entpcourseworklist != '') { + list[i].entpcourseworklistarray = JSON.parse( + '[' + list[i].entpcourseworklist + ']' ) } else { - response.rows[i].entpcourseworklistarray = [] + list[i].entpcourseworklistarray = [] } // 根据 classworkdatastudentids 初始化判断分配的人数 if ( - response.rows[i].classworkdatastudentids != '' && - response.rows[i].classworkdatastudentids != null && - response.rows[i].classworkdatastudentids != 'null' + list[i].classworkdatastudentids != '' && + list[i].classworkdatastudentids != null && + list[i].classworkdatastudentids != 'null' ) { - const stuList = JSON.parse('[' + response.rows[i].classworkdatastudentids + ']') - response.rows[i].workdatacount = stuList.length + const stuList = JSON.parse('[' + list[i].classworkdatastudentids + ']') + list[i].workdatacount = stuList.length } } // 显示分配人数(workdatacount)>0 的 - if (response.rows && response.rows.length > 0) { - classWorkList.value = response.rows && response.rows.filter((item) => item.workdatacount > 0) + if (list && list.length > 0) { + classWorkList.value = list && list.filter((item) => item.workdatacount > 0) //TODO: 这里没分页,貌似这个 total 不重要,后续看 - total.value = response.total + total.value = 0 }else{ classWorkList.value = [] total.value = 0 @@ -222,6 +237,7 @@ const getStudentClassWorkData = async() => { // classids: classTaskStore.classListIds.join(','), // edusubject: userStore.edusubject,//学科 // deaddate: tabActive.value === '进行中'? getTomorrow() : EndDate.value,// 进行中:明天,已结束:选择的日期 + // deaddate: EndDate.value,// 进行中:明天,已结束:选择的日期 // //status: '1', // 作业状态:1-已发布 // orderby: "deaddate DESC",// TODO: 这里是否加 deaddate 的排序,后续看 // pageSize: 1000, @@ -407,13 +423,28 @@ const getStudentVisible = async () => { edituserid: userStore.userId, // 老师的id edustage: userStore.edustage,// 学段 edusubject: userStore.edusubject,//学科 - deaddate: tabActive.value === '进行中'? getTomorrow() : EndDate.value,// 进行中:明天,已结束:选择的日期 + // deaddate: tabActive.value === '进行中'? getTomorrow() : EndDate.value,// 进行中:明天,已结束:选择的日期 + deaddate: EndDate.value,// 进行中:明天,已结束:选择的日期 status: '1', // 作业状态:1-已发布 // orderby: 'concat(deaddate,uniquekey) DESC', orderby: 'deaddate DESC', pageSize: 100 }) - const curWorkList = response.rows + + /** + * 2024-10-17 由于 后面截止时间加了 时分,特加判断 + * 1、进行中、以前是以明天判断。现改为传当天的日期,并根据当前日期的时分与截止日期进行判断, + * 2、已结束、以前默认是以明天判断。现依然以明天为判断,并根据当前日期时分大于截止日期时分判断。 + */ + let list = []; + if(tabActive.value === '进行中'){ + // 进行中 当前日期时间 小于 截止 日期时间 + list = response.rows&&response.rows.filter(item => item.deaddate && getCurrentTime('YYYY-MM-DD HH:mm') < item.deaddate); // 进行中 + }else{ + list = response.rows&&response.rows.filter(item => item.deaddate && getCurrentTime('YYYY-MM-DD HH:mm') > item.deaddate); // 已结束 + } + + const curWorkList = list /** * warn: 这里仅更新了finishpercent(进度条), 且当前作业布置推送新任务时, curWorkList中会查到新的任务与当前页面中this.classWorkList长度不一致, diff --git a/src/renderer/src/views/desktop/container/work-trend.vue b/src/renderer/src/views/desktop/container/work-trend.vue index 957c59d..fc49817 100644 --- a/src/renderer/src/views/desktop/container/work-trend.vue +++ b/src/renderer/src/views/desktop/container/work-trend.vue @@ -52,8 +52,8 @@ const getHomework = async () => { try { const { rows } = await homeworklist({ edituserid: user.userId, edustage, edusubject, deaddate: getTomorrow(), status: '1', orderby: 'uniquekey DESC', pageSize: 500 }) // 只展示进行中的 - // homeworkList.value = rows.filter(item => item.deaddate && item.uniquekey && getCurrentTime('YYYY-MM-DD HH:mm') < item.deaddate) - homeworkList.value = rows.filter(item => item.deaddate && item.uniquekey && getTomorrow() <= item.deaddate) //大于今天的才算进行中 + homeworkList.value = rows.filter(item => item.deaddate && item.uniquekey && getCurrentTime('YYYY-MM-DD HH:mm') < item.deaddate) // 当前日期的时分与截止日期进行判断 + // homeworkList.value = rows.filter(item => item.deaddate && item.uniquekey && getTomorrow() <= item.deaddate) //大于今天的才算进行中 弃用 homeworkList.value.forEach((item) => { item.workdatacount = JSON.parse('[' + item.classworkdatastudentids + ']').length // 如果是习题训练任务,则检查一共有多少道