From 4066992aa20e0989999649621712dfebee24ceeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Czouyf=E2=80=9D?= <80906036@qq.com> Date: Thu, 26 Sep 2024 14:10:27 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BD=9C=E4=B8=9A=E6=89=B9=E6=94=B9]=20-=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/classTask/classTask.vue | 148 +++++++++--------- .../views/classTask/container/quizStats.vue | 129 +++++++++++++-- .../views/classTask/container/task-item.vue | 5 +- .../views/desktop/container/work-trend.vue | 3 +- 4 files changed, 195 insertions(+), 90 deletions(-) diff --git a/src/renderer/src/views/classTask/classTask.vue b/src/renderer/src/views/classTask/classTask.vue index 5f43349..8568c6b 100644 --- a/src/renderer/src/views/classTask/classTask.vue +++ b/src/renderer/src/views/classTask/classTask.vue @@ -109,13 +109,13 @@ const changeEndDate = (val) => { } // 获取数据 -const getData = () => { +const getData = async () => { classWorkList.value = [] loading.value = true // 1、班级列表 getClassList() // 2、班级作业 - getClassWorkList() + await getClassWorkList() // 3、班级学生作业 包含多个班级 getStudentClassWorkData() loading.value = false @@ -133,10 +133,10 @@ const getClassList = () => { /** * 2、获取班级作业 */ -const getClassWorkList = () => { +const getClassWorkList = async () => { if(classTaskStore.classListIds.length>0){ // 班级作业数据,包含多个班级 homeworklist - listByDeadDate({ + const response = await listByDeadDate({ classidarray: classTaskStore.classListIds.join(','), edituserid: userStore.userId, // 老师的id edustage: userStore.edustage, // 学段 @@ -146,63 +146,63 @@ const getClassWorkList = () => { // orderby: 'concat(deaddate,uniquekey) DESC', orderby: 'deaddate DESC', pageSize: 100, - }).then((response) => { - for (var i = 0; i < response.rows.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 // 平均用时 - - // ---------------------------------------------- - // 处理任务类型的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' - } else { - response.rows[i].workclass = '' - } - // 如果是习题训练任务,则检查一共有多少道 - if (response.rows[i].entpcourseworklist != '') { - response.rows[i].entpcourseworklistarray = JSON.parse( - '[' + response.rows[i].entpcourseworklist + ']' - ) - } else { - response.rows[i].entpcourseworklistarray = [] - } - // 根据 classworkdatastudentids 初始化判断分配的人数 - if ( - response.rows[i].classworkdatastudentids != '' && - response.rows[i].classworkdatastudentids != null && - response.rows[i].classworkdatastudentids != 'null' - ) { - const stuList = JSON.parse('[' + response.rows[i].classworkdatastudentids + ']') - response.rows[i].workdatacount = stuList.length - } - } - // 显示分配人数(workdatacount)>0 的 - if (response.rows && response.rows.length > 0) { - classWorkList.value = response.rows && response.rows.filter((item) => item.workdatacount > 0) - //TODO: 这里没分页,貌似这个 total 不重要,后续看 - total.value = response.total - }else{ - classWorkList.value = [] - total.value = 0 - } - loading.value = false }) + + for (var i = 0; i < response.rows.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 // 平均用时 + + // ---------------------------------------------- + // 处理任务类型的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' + } else { + response.rows[i].workclass = '' + } + // 如果是习题训练任务,则检查一共有多少道 + if (response.rows[i].entpcourseworklist != '') { + response.rows[i].entpcourseworklistarray = JSON.parse( + '[' + response.rows[i].entpcourseworklist + ']' + ) + } else { + response.rows[i].entpcourseworklistarray = [] + } + // 根据 classworkdatastudentids 初始化判断分配的人数 + if ( + response.rows[i].classworkdatastudentids != '' && + response.rows[i].classworkdatastudentids != null && + response.rows[i].classworkdatastudentids != 'null' + ) { + const stuList = JSON.parse('[' + response.rows[i].classworkdatastudentids + ']') + response.rows[i].workdatacount = stuList.length + } + } + // 显示分配人数(workdatacount)>0 的 + if (response.rows && response.rows.length > 0) { + classWorkList.value = response.rows && response.rows.filter((item) => item.workdatacount > 0) + //TODO: 这里没分页,貌似这个 total 不重要,后续看 + total.value = response.total + }else{ + classWorkList.value = [] + total.value = 0 + } + loading.value = false } } @@ -211,15 +211,18 @@ const getClassWorkList = () => { */ const getStudentClassWorkData = () => { if(classTaskStore.classListIds.length>0){ - //listClassworkdata({ - listClassworkdataByDeadDate({ - edituserid: userStore.userId, // 老师的id - classids: classTaskStore.classListIds.join(','), - edusubject: userStore.edusubject,//学科 - deaddate: tabActive.value === '进行中'? getTomorrow() : EndDate.value,// 进行中:明天,已结束:选择的日期 - //status: '1', // 作业状态:1-已发布 - orderby: "deaddate DESC",// TODO: 这里是否加 deaddate 的排序,后续看 - //entpcourseid: 8945, + // listClassworkdataByDeadDate({ + // edituserid: userStore.userId, // 老师的id + // classids: classTaskStore.classListIds.join(','), + // edusubject: userStore.edusubject,//学科 + // deaddate: tabActive.value === '进行中'? getTomorrow() : EndDate.value,// 进行中:明天,已结束:选择的日期 + // //status: '1', // 作业状态:1-已发布 + // orderby: "deaddate DESC",// TODO: 这里是否加 deaddate 的排序,后续看 + // pageSize: 1000, + // }) + const ids = classWorkList.value.map((item) => item.id).join(','); + listClassworkdata({ + classworkids: ids, pageSize: 1000, }).then((res) => { for (var t = 0; t < classWorkList.value.length; t++) { @@ -287,10 +290,10 @@ const getStudentClassWorkData = () => { // 以下四个参数,都要计算 // 2024-04-12,酉阳,by jackyshen - + // 计算参与学习任务的平均用时 if (classWorkList.value[t].workdatafeedbackcount > 0) { - classWorkList.value[t].averagetime = (classWorkList.value[t].feedtimelength / classWorkList.value[t].workdatafeedbackcount).toFixed(0) + classWorkList.value[t].averagetime = Math.ceil(classWorkList.value[t].feedtimelength / classWorkList.value[t].workdatafeedbackcount / 60).toFixed(0) } else { classWorkList.value[t].averagetime = 0 } @@ -372,6 +375,7 @@ const getStudentVisible = async () => { // 班级作业数据,多个班级 const response = await listByDeadDate({ classidarray: classTaskStore.classListIds.join(','), + edituserid: userStore.userId, // 老师的id edustage: userStore.edustage,// 学段 edusubject: userStore.edusubject,//学科 deaddate: tabActive.value === '进行中'? getTomorrow() : EndDate.value,// 进行中:明天,已结束:选择的日期 @@ -402,7 +406,7 @@ const getStudentVisible = async () => { ) // 计算参与学习任务的平均用时 if (classWorkList.value[t].workdatafeedbackcount > 0) { - classWorkList.value[t].averagetime = (classWorkList.value[t].feedtimelength / classWorkList.value[t].workdatafeedbackcount).toFixed(0) + classWorkList.value[t].averagetime = Math.ceil(classWorkList.value[t].feedtimelength / classWorkList.value[t].workdatafeedbackcount / 60).toFixed(0) } else { classWorkList.value[t].averagetime = 0 } diff --git a/src/renderer/src/views/classTask/container/quizStats.vue b/src/renderer/src/views/classTask/container/quizStats.vue index d04f275..3079ebd 100644 --- a/src/renderer/src/views/classTask/container/quizStats.vue +++ b/src/renderer/src/views/classTask/container/quizStats.vue @@ -17,7 +17,13 @@