diff --git a/src/components/Question.vue b/src/components/Question.vue index fb974cc..0c6dfce 100644 --- a/src/components/Question.vue +++ b/src/components/Question.vue @@ -13,7 +13,7 @@ - + @@ -40,11 +40,19 @@ const answerFn = (item, event) => { activeId.value = item.aid debounceTap(e, () => { let cid = questionList.value[currentId.value].id - answerList.value.push({ - qid: cid, - answer: item.secore, - text: item.text - }) + let has = answerList.value.findIndex(obj => obj.qid === cid); + if (has == -1) { + answerList.value.push({ + qid: cid, + answer: item.secore, + text: item.text + }) + } else { + answerList.value[has].answer = item.secore + answerList.value[has].text = item.text + } + + // 更新下一题信息 if (currentId.value >= 11) { Toast('答题结束') console.log('答题结束'); @@ -56,7 +64,7 @@ const answerFn = (item, event) => { currentId.value++ } - // console.log('答案库', answerList.value); + console.log('答案库', answerList.value); }) } @@ -80,10 +88,17 @@ const showResult = (event) => { }) } -const nextPage = () => { - +// 上一页函数 +const prevePage = (event) => { + let e = event.target + debounceTap(e, () => { + activeId.value = '' + currentId.value-- + }) } + +