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

bug fixes

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