From 0de7a7356e04833d75fa7267ac563e9c3f5e9478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=9D=A8?= <666> Date: Wed, 23 Oct 2024 15:50:03 +0800 Subject: [PATCH] =?UTF-8?q?add:=E4=BD=9C=E4=B8=9A=E6=89=B9=E9=98=85?= =?UTF-8?q?=E5=AE=A2=E8=A7=82=E9=A2=98=E8=87=AA=E5=8A=A8=E8=AF=84=E5=88=86?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../container/classTask/item-dialog-score.vue | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/views/classTask/container/classTask/item-dialog-score.vue b/src/renderer/src/views/classTask/container/classTask/item-dialog-score.vue index 79b5d0a..d075f61 100644 --- a/src/renderer/src/views/classTask/container/classTask/item-dialog-score.vue +++ b/src/renderer/src/views/classTask/container/classTask/item-dialog-score.vue @@ -610,7 +610,33 @@ const selectScore = (score) => { console.log(score, 'score----') classWorkFormScore.rating = score.ratingKey } - +const checkWorkType = (params) => { + //这里判断题目类型 + const subType = params.quizlist.map(item => item.worktype) + const objectiveQuestion = ['单选题','多选题','判断题'] + //判断题目是不是客观题 + if(subType.every(item => objectiveQuestion.includes(item))){ + // 获取学生答题列表 + + const score = extractedNumber(params.studentObj.scoingRate) + if(0<=score<=59){ + classWorkFormScore.rating = 5 + }else if(60<=score<=69){ + classWorkFormScore.rating = 4 + }else if(70<=score<=79){ + classWorkFormScore.rating = 3 + }else if(80<=score<=99){ + classWorkFormScore.rating = 2 + }else{ + classWorkFormScore.rating = 1 + } + } +} +// 获取百分比的数字 +const extractedNumber = (score) => { + const match = score.match(/\d+/); + return match ? parseInt(match[0], 10) : null; +} // 接收父组件传过来的参数 const acceptParams = async (params) => { console.log(params) @@ -631,7 +657,7 @@ const acceptParams = async (params) => { teacherFeedContentList.value = [] teachImageList.value = [] teachFileList.value = [] - + checkWorkType(params) // ----------------- dialogProps.value = params classWorkFormScore.name = params.studentObj.studentname @@ -769,7 +795,7 @@ const acceptParams = async (params) => { console.log(params.studentQuizAllList[0].rating, '----------------------------') // 为null 或0 则默认为0 classWorkFormScore.rating = - params.studentQuizAllList[0].rating == 0 ? 0 : params.studentQuizAllList[0].rating + params.studentQuizAllList[0].rating == 0 ? classWorkFormScore.rating : params.studentQuizAllList[0].rating } analysisScoreOpen.value = true -- 2.44.0.windows.1