From b07a4e07b9dd4932a7ce6dddbf426bed76616949 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: Mon, 4 Nov 2024 15:36:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=89=B9=E6=94=B9=EF=BC=9A?= =?UTF-8?q?=E9=9C=80=E6=B1=82=E6=9B=B4=E6=96=B0=EF=BC=8C=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/classTask/classTask.vue | 73 +++++++++---------- .../container/classTask/task-item.vue | 49 ++++++++----- .../views/desktop/container/work-trend.vue | 3 +- src/renderer/src/views/tool/createHomework.js | 24 ++---- 4 files changed, 73 insertions(+), 76 deletions(-) diff --git a/src/renderer/src/views/classTask/classTask.vue b/src/renderer/src/views/classTask/classTask.vue index b05159b..e034d45 100644 --- a/src/renderer/src/views/classTask/classTask.vue +++ b/src/renderer/src/views/classTask/classTask.vue @@ -168,7 +168,6 @@ const getClassWorkList = async () => { for (var i = 0; i < list.length; i++) { // 初始化部分新增字段值 list[i].workdatalist = [] - list[i].workdatacount = 0 // 人数 list[i].workdatalistVisible = false list[i].workdatafeedbackcount = 0 // 已交人数 list[i].feedtimelength = 0 @@ -200,19 +199,10 @@ const getClassWorkList = async () => { } else { list[i].entpcourseworklistarray = [] } - // 根据 classworkdatastudentids 初始化判断分配的人数 - if ( - list[i].classworkdatastudentids != '' && - list[i].classworkdatastudentids != null && - list[i].classworkdatastudentids != 'null' - ) { - const stuList = JSON.parse('[' + list[i].classworkdatastudentids + ']') - list[i].workdatacount = stuList.length - } } - // 显示分配人数(workdatacount)>0 的 + // 显示分配人数(workdataresultsum)>0 的 if (list && list.length > 0) { - classWorkList.value = list && list.filter((item) => item.workdatacount > 0) + classWorkList.value = list && list.filter((item) => item.workdataresultsum > 0) //TODO: 这里没分页,貌似这个 total 不重要,后续看 total.value = 0 }else{ @@ -305,29 +295,32 @@ const getStudentClassWorkData = async() => { } } } - // 当前这个学习任务,共推送给了几个学生,workdatacount + // 当前这个学习任务,共推送给了几个学生,workdataresultsum if (res.rows[i].classworkid == classWorkList.value[t].id) { classWorkList.value[t].workdatalist.push(res.rows[i]) } } - // 计算完成进度 workdatacount人数要大于0 + // 计算完成进度 workdataresultsum人数要大于0 if ( classWorkList.value[t].workdataresultcount > 0 && - classWorkList.value[t].workdatacount > 0 + classWorkList.value[t].workdataresultsum > 0 ) { classWorkList.value[t].finishpercent = parseInt( - (classWorkList.value[t].workdataresultcount / classWorkList.value[t].workdatacount) * 100 - ) - // 计算-已完成批阅数 : 人数-已批阅数 - // teacherCorrectionProgress 老师已批阅进度条: - // workdataresultcount 完成人数 - // teacherrationgcount 已批阅人数 - // 已批阅百分比: (人数-已批阅数) / 人数 * 100 - classWorkList.value[t].teacherCorrectionProgress = parseInt( - ((classWorkList.value[t].teacherrationgcount) / classWorkList.value[t].workdataresultcount) * 100 + (classWorkList.value[t].workdataresultcount / classWorkList.value[t].workdataresultsum) * 100 ) } else { classWorkList.value[t].finishpercent = 0 + } + + /** 计算 已批阅进度 */ + // workdataresultsum 人数 teacherrationgcount 已批阅人数 + // 已批阅百分比: (人数-已批阅数) / 人数 * 100 + if (classWorkList.value[t].workdataresultsum > 0) { + // teacherCorrectionProgress 老师已批阅进度条: + classWorkList.value[t].teacherCorrectionProgress = parseInt( + ((classWorkList.value[t].teacherrationgcount) / classWorkList.value[t].workdataresultsum) * 100 + ) + } else { classWorkList.value[t].teacherCorrectionProgress = 0 } @@ -352,7 +345,7 @@ const getStudentClassWorkData = async() => { var dd = (classWorkList.value[t].rightAnswerCount / (classWorkList.value[t].entpcourseworklistarray.length * - classWorkList.value[t].workdatacount)) * + classWorkList.value[t].workdataresultsum)) * 100 classWorkList.value[t].scoingRate = dd.toFixed(0) + '%' } else { @@ -466,12 +459,12 @@ const getStudentVisible = async () => { // } // 确保当前拿到的任务与页面中存在的任务能一对一(避免因删除其他操作而删除作业任务导致两个数组的index不统一而越界) let curWork = curWorkList.find((work) => work.id === classWorkList.value[t].id) - // workdataresultcount 完成人数 workdatacount人数要大于0 - if (curWork && curWork.workdataresultcount > 0 && classWorkList.value[t].workdatacount > 0) { + // workdataresultcount 完成人数 workdataresultsum人数要大于0 + if (curWork && curWork.workdataresultcount > 0 && classWorkList.value[t].workdataresultsum > 0) { classWorkList.value[t].workdataresultcount = curWork.workdataresultcount // 桌面端貌似不需要进度条了? classWorkList.value[t].finishpercent = parseInt( - (classWorkList.value[t].workdataresultcount / classWorkList.value[t].workdatacount) * 100 + (classWorkList.value[t].workdataresultcount / classWorkList.value[t].workdataresultsum) * 100 ) // 计算参与学习任务的平均用时 if (classWorkList.value[t].workdatafeedbackcount > 0) { @@ -479,17 +472,7 @@ const getStudentVisible = async () => { } else { classWorkList.value[t].averagetime = 0 } - // 更新批阅数 - classWorkList.value[t].teacherrationgcount = curWork.teacherrationgcount - // 计算-已完成批阅数 : 已批阅数 - // teacherCorrectionProgress 老师已批阅进度条: - // workdataresultcount 完成人数 - // teacherrationgcount 已批阅人数 - // 已批阅百分比: (已批阅数) / 人数 * 100 - classWorkList.value[t].teacherCorrectionProgress = parseInt( - ((curWork.teacherrationgcount) / curWork.workdataresultcount) * 100 - ) } else { // 学生未完成,但是老师批改了? if(curWork && curWork.workdataresultcount == 0){ @@ -497,6 +480,20 @@ const getStudentVisible = async () => { classWorkList.value[t].teacherrationgcount = curWork.teacherrationgcount } classWorkList.value[t].finishpercent = 0 + } + + /** 计算 已批阅进度 */ + // workdataresultsum 人数 teacherrationgcount 已批阅人数 + // 已批阅百分比: (人数-已批阅数) / 人数 * 100 + if (curWork && curWork.workdataresultsum > 0) { + // 更新批阅数 + classWorkList.value[t].teacherrationgcount = curWork.teacherrationgcount + + // teacherCorrectionProgress 老师已批阅进度条: + classWorkList.value[t].teacherCorrectionProgress = parseInt( + ((curWork.teacherrationgcount) / curWork.workdataresultsum) * 100 + ) + } else { classWorkList.value[t].teacherCorrectionProgress = 0 } } diff --git a/src/renderer/src/views/classTask/container/classTask/task-item.vue b/src/renderer/src/views/classTask/container/classTask/task-item.vue index 965e394..f5625f6 100644 --- a/src/renderer/src/views/classTask/container/classTask/task-item.vue +++ b/src/renderer/src/views/classTask/container/classTask/task-item.vue @@ -15,27 +15,37 @@ -