fix:新增学生的得分以及修改得分率;
This commit is contained in:
parent
6ca1fb0883
commit
531a62ad64
|
@ -4,7 +4,7 @@
|
|||
<el-tab-pane :label="item.label" style="text-align:left" stretch="true">
|
||||
<template v-if="item.stuList.length > 0">
|
||||
<template v-for="(stuItem,stuIndex) in item.stuList" :key="stuIndex">
|
||||
<el-tag style="margin:5px 10px 0 0" type="primary">{{stuItem.studentname}}</el-tag>
|
||||
<el-tag style="margin:5px 10px 0 0" type="primary">{{ stuItem.studentname }}:{{ stuItem.getScore }}分</el-tag>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
|
|
|
@ -87,6 +87,11 @@
|
|||
<span v-if="tableRadio.value==1">{{ scope.row.updatedate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="tableRadio.value==0?'':'得分'" prop="score" width="80" align="center" >
|
||||
<template #default="scope" v-if="tableRadio.value==1">
|
||||
<span style="color: #2196f3">{{scope.row.getScore || 0}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="批阅状态" prop="teacherRating" align="center" width="120" sortable>
|
||||
<template #default="scope">
|
||||
<template v-if="scope.row.teacherRating == 0">
|
||||
|
@ -359,21 +364,27 @@ const getClassWorkStudentList = (rowId) => {
|
|||
const evalarray = JSON.parse('[' + response.rows[i].classworkevallist + ']')
|
||||
var scoingCount = 0
|
||||
var feedcount = 0
|
||||
let score = 0
|
||||
for (var e = 0; e < evalarray.length; e++) {
|
||||
if (evalarray[e].feedcontent != '') {
|
||||
feedcount++
|
||||
// 与答案对比正误。注意注意,这里仅限单选题
|
||||
if (evalarray[e].feedcontent == evalarray[e].rightanswer) {
|
||||
scoingCount++
|
||||
score += evalarray[e].score;
|
||||
evalarray[e].teacherRating = evalarray[e].score
|
||||
}
|
||||
}
|
||||
}
|
||||
const allScore = evalarray.reduce((acc, cur) => acc + cur.score, 0)
|
||||
//console.log(evalarray, 'evalarray------------------------------------')
|
||||
if (feedcount > 0) {
|
||||
// 多个题目的总得分率: 正确题数/(题目数*100)
|
||||
response.rows[i].scoingRate = ((scoingCount / feedcount) * 100).toFixed(0) + '%'
|
||||
response.rows[i].scoingRate = ((score / allScore) * 100).toFixed(0) + '%'
|
||||
response.rows[i].getScore = score
|
||||
} else {
|
||||
response.rows[i].scoingRate = '0%'
|
||||
response.rows[i].getScore = 0
|
||||
}
|
||||
// 批阅状态 优良类 :注意:这里题目中的评价都是一样的,所以取第一个
|
||||
if (evalarray[0].rating != '') {
|
||||
|
@ -381,6 +392,7 @@ const getClassWorkStudentList = (rowId) => {
|
|||
}
|
||||
} else {
|
||||
response.rows[i].scoingRate = '0%'
|
||||
response.rows[i].getScore = 0
|
||||
}
|
||||
}
|
||||
classWorkAnalysis.classworkdata = response.rows
|
||||
|
@ -624,6 +636,7 @@ const handleClassOverviewOpen = (type) =>{
|
|||
response.rows.forEach(item => {
|
||||
let rightAnswer = 0
|
||||
let answers = 0
|
||||
let score = 0
|
||||
if(!item.classworkevallist) return
|
||||
// 使用正则表达式替换字符串值中的双引号为单引号
|
||||
let replacedString = item.classworkevallist.replace(/""/g, "\"");
|
||||
|
@ -642,12 +655,18 @@ const handleClassOverviewOpen = (type) =>{
|
|||
//正确答案,仅限单选题
|
||||
if(itemTopic.feedcontent === itemTopic.rightanswer){
|
||||
rightAnswer ++
|
||||
score += itemTopic.score
|
||||
itemTopic.teacherRating = itemTopic.score
|
||||
}
|
||||
}
|
||||
})
|
||||
rightAnswer > 0?item.scoingRate = (rightAnswer/answers * 100).toFixed(0):item.scoingRate = ''
|
||||
const allScore = allTopic.reduce((acc, cur) => {
|
||||
return acc + cur.score;
|
||||
},0)
|
||||
rightAnswer > 0?item.scoingRate = (score/allScore * 100).toFixed(0):item.scoingRate = ''
|
||||
}else{
|
||||
item.scoingRate = ''
|
||||
item.getScore = 0
|
||||
}
|
||||
//获得总分
|
||||
const point = allTopic.reduce((acc, cur) => {
|
||||
|
|
|
@ -77,6 +77,11 @@
|
|||
<span v-if="tableRadio.value==1">{{ scope.row.updatedate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="tableRadio.value==0?'':'得分'" prop="score" width="80" align="center" >
|
||||
<template #default="scope" v-if="tableRadio.value==1">
|
||||
<span style="color: #2196f3">{{scope.row.getScore || 0}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="批阅状态" prop="teacherRating" align="center" width="120" sortable>
|
||||
<template #default="scope">
|
||||
<template v-if="scope.row.teacherRating == 0">
|
||||
|
@ -356,21 +361,27 @@ const getClassWorkStudentList = (rowId) => {
|
|||
const evalarray = JSON.parse('[' + response.rows[i].classworkevallist + ']')
|
||||
var scoingCount = 0
|
||||
var feedcount = 0
|
||||
let score = 0
|
||||
for (var e = 0; e < evalarray.length; e++) {
|
||||
if (evalarray[e].feedcontent != '') {
|
||||
feedcount++
|
||||
// 与答案对比正误。注意注意,这里仅限单选题
|
||||
if (evalarray[e].feedcontent == evalarray[e].rightanswer) {
|
||||
scoingCount++
|
||||
score += evalarray[e].score;
|
||||
evalarray[e].teacherRating = evalarray[e].score
|
||||
}
|
||||
}
|
||||
}
|
||||
const allScore = evalarray.reduce((acc, cur) => acc + cur.score, 0)
|
||||
//console.log(evalarray, 'evalarray------------------------------------')
|
||||
if (feedcount > 0) {
|
||||
// 多个题目的总得分率: 正确题数/(题目数*100)
|
||||
response.rows[i].scoingRate = ((scoingCount / feedcount) * 100).toFixed(0) + '%'
|
||||
response.rows[i].scoingRate = ((score / allScore) * 100).toFixed(0) + '%'
|
||||
response.rows[i].getScore = score
|
||||
} else {
|
||||
response.rows[i].scoingRate = '0%'
|
||||
response.rows[i].getScore = 0
|
||||
}
|
||||
// 批阅状态 优良类 :注意:这里题目中的评价都是一样的,所以取第一个
|
||||
if (evalarray[0].rating != '') {
|
||||
|
@ -378,6 +389,7 @@ const getClassWorkStudentList = (rowId) => {
|
|||
}
|
||||
} else {
|
||||
response.rows[i].scoingRate = '0%'
|
||||
response.rows[i].getScore = 0
|
||||
}
|
||||
}
|
||||
classWorkAnalysis.classworkdata = response.rows
|
||||
|
@ -639,6 +651,7 @@ const handleClassOverviewOpen = (type) =>{
|
|||
response.rows.forEach(item => {
|
||||
let rightAnswer = 0
|
||||
let answers = 0
|
||||
let score = 0
|
||||
if(!item.classworkevallist) return
|
||||
// 使用正则表达式替换字符串值中的双引号为单引号
|
||||
let replacedString = item.classworkevallist.replace(/""/g, "\"");
|
||||
|
@ -657,12 +670,19 @@ const handleClassOverviewOpen = (type) =>{
|
|||
//正确答案,仅限单选题
|
||||
if(itemTopic.feedcontent === itemTopic.rightanswer){
|
||||
rightAnswer ++
|
||||
score += itemTopic.score
|
||||
itemTopic.teacherRating = itemTopic.score
|
||||
}
|
||||
}
|
||||
})
|
||||
rightAnswer > 0?item.scoingRate = (rightAnswer/answers * 100).toFixed(0):item.scoingRate = ''
|
||||
const allScore = allTopic.reduce((acc, cur) => {
|
||||
return acc + cur.score;
|
||||
},0)
|
||||
rightAnswer > 0?item.scoingRate = (score/allScore * 100).toFixed(0):item.scoingRate = ''
|
||||
item.getScore = score
|
||||
}else{
|
||||
item.scoingRate = ''
|
||||
item.getScore = 0
|
||||
}
|
||||
//获得总分
|
||||
const point = allTopic.reduce((acc, cur) => {
|
||||
|
|
Loading…
Reference in New Issue