diff --git a/src/pages/index/trueTest.vue b/src/pages/index/trueTest.vue index 9dd1b0f..129963b 100644 --- a/src/pages/index/trueTest.vue +++ b/src/pages/index/trueTest.vue @@ -216,14 +216,12 @@ }, toSubmit() { const restTime = this.time.hours * 60 * 60 + this.time.minutes * 60 + this.time.seconds - const score = this.list.reduce((pre, cur) => { - const isTrue = cur.trueAnswer == cur.yourAnswer.replace(/,-g/, '') - let s = 0 - if (isTrue) { - s = this.subject == 1 ? 1 : 2 - } - return pre + s + const trueCount = this.list.reduce((pre, cur) => { + const ya = cur.trueAnswer.replace('A', '1').replace('B', '2').replace('C', '3').replace('D', '4').replace('E', '5').replace('F', '6').replace('G', '7') + const isTrue = ya == cur.yourAnswer.replace(/,/g, '') + return pre + 1 * (isTrue ? 1 : 0) }, 0) + const score = (trueCount / this.list.length * 100).toFixed(0) submitTest({ "carTypeId": storage.get('carType') || '1001', "score": score,