提交 d3dd8fc4 authored 作者: 王鹏飞's avatar 王鹏飞

bug fixes

上级 62b32841
......@@ -16,6 +16,7 @@
:index="currentQuestionIndex"
:disabled="disabled"
:hasResult="hasResult"
@change="handleChange"
>
<template #index>{{ currentGroupPage }}/{{ currentGroupCount }}</template>
<template v-slot:default="data">
......@@ -209,11 +210,26 @@ export default {
this.currentGroupPage++
this.handlePageChange(this.currentGroupPage)
},
// 答案改变
handleChange(data) {
if (this.numberGroups.length) {
this.updateNumberGroupsAnswer(data)
}
},
// 翻页
handlePageChange(index) {
this.currentGroupPage = index
this.$emit('page-change', this.currentGroupPage, this.currentQuestionGroup, this.questionGroups)
},
// 是否正确
updateNumberGroupsAnswer(data) {
this.numberGroups.forEach(group => {
const found = group.question_list.find(item => item.question_id === data.question_id)
if (found) {
found.answer = 3
}
})
},
// 收藏
toggleCollect() {
const ids = []
......
......@@ -7,7 +7,7 @@
<div class="question-list-item-bd">
<!-- 单选 -->
<template v-if="[1, 6].includes(questionType)">
<el-radio-group v-model="data.user_answer[0]" :disabled="disabled">
<el-radio-group v-model="data.user_answer[0]" :disabled="disabled" @change="handleChange">
<div class="question-option-item" v-for="item in currentOptions" :key="item.id">
<el-radio :label="item.id">
<div class="question-option-item__text" v-html="item.abc_option"></div>
......@@ -17,7 +17,7 @@
</template>
<!-- 多选 -->
<template v-if="questionType === 2">
<el-checkbox-group v-model="data.user_answer" :disabled="disabled">
<el-checkbox-group v-model="data.user_answer" :disabled="disabled" @change="handleChange">
<div class="question-option-item" v-for="item in currentOptions" :key="item.id">
<el-checkbox :label="item.id">
<div class="question-option-item__text" v-html="item.abc_option"></div>
......@@ -33,6 +33,7 @@
placeholder="请输入答案内容"
:autosize="{ minRows: 4, maxRows: 6 }"
:disabled="disabled"
@blur="handleChange"
></el-input>
</template>
<template v-if="questionType === 3">
......@@ -135,6 +136,11 @@ export default {
}, [])
return result.join('、')
}
},
methods: {
handleChange() {
this.$emit('change', this.data)
}
}
}
</script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论