提交 0a10ab5d authored 作者: pengxiaohui's avatar pengxiaohui

feat: 课后习题成绩报告修改

上级 845c6c01
......@@ -122,33 +122,33 @@ export default {
}
api.getCourseQuestion(param).then(response => {
const data = JSON.parse(response.data)
let rightNum = 0
let totalNum = 0
data.sheet.questions.question_items.forEach(list => {
list.question_list = list.question_list.reduce((a, b) => {
return a.concat(b)
}, [])
list.question_list.forEach(item => {
const currentItem = data.sheet.score_items[list.question_item_id][item.id]
if (currentItem.checked_flag) {
totalNum++
if (currentItem.is_right) rightNum++
} else {
if (item.question_options) {
totalNum++
if (currentItem.is_right) rightNum++
}
}
})
})
this.accuracy = parseInt(rightNum)
if (parseInt(rightNum) === 0 && parseInt(totalNum) === 0) {
this.accuracText = '-'
} else {
this.accuracText = parseInt((rightNum / totalNum) * 100)
}
// let rightNum = 0
// let totalNum = 0
// data.sheet.questions.question_items.forEach(list => {
// list.question_list = list.question_list.reduce((a, b) => {
// return a.concat(b)
// }, [])
// list.question_list.forEach(item => {
// const currentItem = data.sheet.score_items[list.question_item_id][item.id]
// if (currentItem.checked_flag) {
// totalNum++
// if (currentItem.is_right) rightNum++
// } else {
// if (item.question_options) {
// totalNum++
// if (currentItem.is_right) rightNum++
// }
// }
// })
// })
// this.accuracy = parseInt(rightNum)
// if (parseInt(rightNum) === 0 && parseInt(totalNum) === 0) {
// this.accuracText = '-'
// } else {
// this.accuracText = parseInt((rightNum / totalNum) * 100)
// }
this.data = data
this.accuracScore = parseInt(totalNum)
// this.accuracScore = parseInt(totalNum)
let subjectQuestionTotal = 0
let subjectQuestionScore = 0
let objectQuestionTotal = 0
......@@ -172,12 +172,10 @@ export default {
})
this.subjectQuestionTotal = subjectQuestionTotal
this.subjectQuestionScore = subjectQuestionScore
console.log(subjectQuestionTotal)
this.subjectQuestionScore = 7
// this.subjectQuestionScore = 7
this.objectQuestionTotal = objectQuestionTotal
console.log(objectQuestionTotal)
this.objectQuestionScore = objectQuestionScore
this.objectQuestionScore = 29
// this.objectQuestionScore = 29
})
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论