提交 d4b1be8d authored 作者: lihuihui's avatar lihuihui

修改答题卡跳转问题

上级 81fef50b
......@@ -26,7 +26,7 @@
<div class="title" >{{ answerData['1'].title }}</div>
<ul>
<template v-for="(item, index) in answerData['1'].data">
<li @click="go(item.id)" :data-id="item.id" :key="index" :class="item.sign == true ? 'active2' : item.answer == undefined ? 'active3' : item.answer.length == 0 ? 'acitve3' : 'active1'">{{ item.num }}</li>
<li @click="go(item.id)" :data-id="item.id" :key="index" :class="item.sign == true ? 'active2' : item.answer == undefined ? 'active3' : item.answer.length == 0 ? 'active3' : 'active1'">{{ item.num }}</li>
</template>
</ul>
</template>
......@@ -34,7 +34,7 @@
<div class="title" >{{ answerData['2'].title }}</div>
<ul>
<template v-for="(item, index) in answerData['2'].data">
<li @click="go(item.id)" :data-id="item.id" :key="index" :class="item.sign == true ? 'active2' : item.answer == undefined ? 'active3' : item.answer.length == 0 ? 'acitve3' : 'active1'">{{ item.num }}</li>
<li @click="go(item.id)" :data-id="item.id" :key="index" :class="item.sign == true ? 'active2' : item.answer == undefined ? 'active3' : item.answer.length == 0 ? 'active3' : 'active1'">{{ item.num }}</li>
</template>
</ul>
</template>
......@@ -42,7 +42,7 @@
<div class="title" >{{ answerData['6'].title }}</div>
<ul>
<template v-for="(item, index) in answerData['6'].data">
<li @click="go(item.id)" :data-id="item.id" :key="index" :class="item.sign == true ? 'active2' : item.answer == undefined ? 'active3' : item.answer.length == 0 ? 'acitve3' : 'active1'">{{ item.num }}</li>
<li @click="go(item.id)" :data-id="item.id" :key="index" :class="item.sign == true ? 'active2' : item.answer == undefined ? 'active3' : item.answer.length == 0 ? 'active3' : 'active1'">{{ item.num }}</li>
</template>
</ul>
</template>
......@@ -50,7 +50,7 @@
<div class="title" >{{ answerData['5'].title }}</div>
<ul>
<template v-for="(item, index) in answerData['5'].data">
<li @click="go(item.id)" :data-id="item.id" :key="index" :class="item.sign == true ? 'active2' : item.answer == undefined ? 'active3' : item.answer.length == 0 ? 'acitve3' : 'active1'">{{ item.num }}</li>
<li @click="go(item.id)" :data-id="item.id" :key="index" :class="item.sign == true ? 'active2' : item.answer == undefined ? 'active3' : item.answer.length == 0 ? 'active3' : 'active1'">{{ item.num }}</li>
</template>
</ul>
</template>
......@@ -114,19 +114,8 @@ export default {
}
},
methods: {
duplicates(data) {
const hash = {}
const newArr = data.reduce((item, next) => {
hash[next.type] ? item.forEach((l) => {
if (l.type === next.type) {
l.question_list = [...l.question_list, ...next.question_list]
}
}) : hash[next.type] = true && item.push(next)
return item
}, [])
return newArr
},
go(id) {
console.log(id)
setTimeout(() => {
this.$emit('showCard')
}, 200)
......@@ -184,12 +173,13 @@ export default {
let num = 1
this.clone(this.questionsData).questions.map(item => {
item.question_list.map((c, index) => {
c.num = num + index
if (Object.prototype.hasOwnProperty.call(this.requestData, item.id)) {
if (Object.prototype.hasOwnProperty.call(this.requestData[item.id], c.id)) {
c = this.requestData[item.id][c.id]
c = Object.assign(this.requestData[item.id][c.id], c)
// console.log(c)
}
}
c.num = num + index
this.answerData[item.type].data.push(c)
})
num += item.question_list.length
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论