qsh 4 days ago
parent 70fe0f0c42
commit a684d255d2
  1. 12
      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,

Loading…
Cancel
Save