Ver código fonte

refactor: 更改做题数据结构

ChenYangfan 6 anos atrás
pai
commit
0710ae12b6

+ 2 - 2
src/components/PDF/PointerCanvas.vue

@@ -138,13 +138,13 @@ export default {
       }
 
       // 线条
-      this._ctx.strokeStyle = `rgba(211, 47, 47, .1)`
+      this._ctx.strokeStyle = `rgba(211, 47, 47, .2)`
       this._ctx.beginPath()
       const length = this.points.length
       this.points.forEach((point, index) => {
         if (index % this.overrate) {
           this._ctx.lineTo(point.x, point.y)
-          this._ctx.lineWidth = (length - index + 8) / (2 * this.overrate)
+          this._ctx.lineWidth = (length - index + 4) / (2 * this.overrate)
           this._ctx.stroke()
         }
       })

+ 5 - 4
src/views/quiz/StudentDoQuiz.vue

@@ -117,11 +117,11 @@ export default {
         startAt: this.lastDate,
         endAt: this.choiceDate
       })
-      const answers = {}
+      const records = {}
       let uncompleted = false
       this.questions.map(question => {
         if (question.studentAnswer) {
-          answers[question.id] = question.studentAnswer.answer
+          records[question.id] = { answer: question.studentAnswer.answer }
         } else {
           this.$setErrorMessage('题目:"' + question.stem + '"尚未填写')
           uncompleted = true
@@ -129,14 +129,15 @@ export default {
       })
       if (uncompleted) return
 
-      const records = {}
       Object.keys(this.records).forEach(key => {
         records[key] = {
+          ...records[key],
           startAt: new Date(this.records[key].startAt),
           endAt: new Date(this.records[key].endAt)
         }
       })
-      submitQuizStudentAnswer({ quizId, answers, records }).then(res => {
+      console.log(records)
+      submitQuizStudentAnswer({ quizId, records }).then(res => {
         this.hasSubmit = true
         this.$setSuccessMessage('提交成功')
         this.$router.go(-1)