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