|
|
@@ -102,11 +102,13 @@ export default {
|
|
|
getInteractiveList({
|
|
|
questionIdJoinByComma: this.questions.map(_ => _.id).join(',')
|
|
|
}).then(res => {
|
|
|
- const tempMap = {}
|
|
|
- res.forEach(item => {
|
|
|
- tempMap[item.questionId] = { marked: item.collection, rate: item.rate }
|
|
|
- })
|
|
|
- this.interactiveMap = tempMap
|
|
|
+ if (res) {
|
|
|
+ const tempMap = {}
|
|
|
+ res.forEach(item => {
|
|
|
+ tempMap[item.questionId] = { marked: item.collection, rate: item.rate }
|
|
|
+ })
|
|
|
+ this.interactiveMap = tempMap
|
|
|
+ }
|
|
|
}).catch(err => this.$setErrorMessage(err.response.data.msg))
|
|
|
}).catch(err => this.$setErrorMessage(err.response.data.msg))
|
|
|
},
|
|
|
@@ -117,11 +119,12 @@ export default {
|
|
|
startAt: this.lastDate,
|
|
|
endAt: this.choiceDate
|
|
|
})
|
|
|
- const records = {}
|
|
|
+
|
|
|
+ const answers = {}
|
|
|
let uncompleted = false
|
|
|
this.questions.map(question => {
|
|
|
if (question.studentAnswer) {
|
|
|
- records[question.id] = { answer: question.studentAnswer.answer }
|
|
|
+ answers[question.id] = question.studentAnswer.answer
|
|
|
} else {
|
|
|
this.$setErrorMessage('题目:"' + question.stem + '"尚未填写')
|
|
|
uncompleted = true
|
|
|
@@ -129,9 +132,10 @@ export default {
|
|
|
})
|
|
|
if (uncompleted) return
|
|
|
|
|
|
+ const records = {}
|
|
|
Object.keys(this.records).forEach(key => {
|
|
|
records[key] = {
|
|
|
- ...records[key],
|
|
|
+ answer: answers[key],
|
|
|
startAt: new Date(this.records[key].startAt),
|
|
|
endAt: new Date(this.records[key].endAt)
|
|
|
}
|