| | |
| | | <template> |
| | | <div class="answer-container w-full h-full"> |
| | | <el-scrollbar> |
| | | <ExamInfo class="mb-5"></ExamInfo> |
| | | <ExamInfo class="mb-5" :questionIndex="currentIndex" :title="activeQuestion.title"></ExamInfo> |
| | | |
| | | <div class="answer-content"> |
| | | <div class="answer-item flex" v-for="item, index in examInfo.answerList" @click="answerClick(item)" |
| | | <div class="answer-item flex" v-for="item, index in activeQuestion.items" @click="answerClick(item)" |
| | | :class="answerState(item)"> |
| | | <div class="answer-icon flex flex-col justify-center items-center flex-shrink-0">{{ item.type }}</div> |
| | | <div class="answer-text text-gray-700">{{ item.text }}</div> |
| | | <div class="answer-icon flex flex-col justify-center items-center flex-shrink-0">{{ item.prefix }}</div> |
| | | <div class="answer-text text-gray-700">{{ item.content }}</div> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue'; |
| | | import {storeToRefs} from 'pinia'; |
| | | import ExamInfo from '@/components/ExamInfo/index.vue'; |
| | | import {useExamStore} from '@/store/index.js'; |
| | | |
| | | const examInfo = ref({ |
| | | qId: 1, |
| | | answerList: [ |
| | | { |
| | | type: 'A', |
| | | text: '测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试试测试', |
| | | isActive: false |
| | | }, |
| | | { |
| | | type: 'B', |
| | | text: '测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试试测试', |
| | | isActive: false |
| | | }, |
| | | { |
| | | type: 'C', |
| | | text: '测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试试测试', |
| | | isActive: false |
| | | }, |
| | | { |
| | | type: 'D', |
| | | text: '测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试试测试', |
| | | isActive: false |
| | | }, |
| | | { |
| | | type: 'E', |
| | | text: '测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试试测试', |
| | | isActive: false |
| | | }, |
| | | { |
| | | type: 'F', |
| | | text: '测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试试测试', |
| | | isActive: false |
| | | }, |
| | | ] |
| | | }); |
| | | const examStore = useExamStore(); |
| | | |
| | | const activeIndex = ref(null); |
| | | |
| | | const {currentIndex,activeQuestion} = storeToRefs(examStore); |
| | | const answerClick = (item) => { |
| | | if(item) { |
| | | resetAnswer(); |
| | | item.isActive = true |
| | | // resetAnswer(); |
| | | item.isActive = !item.isActive; |
| | | } |
| | | }; |
| | | |
| | |
| | | } |
| | | |
| | | const resetAnswer = () => { |
| | | examInfo.value.answerList.forEach(item => item.isActive = false); |
| | | activeQuestion.value.items.forEach(item => item.isActive = false); |
| | | } |
| | | |
| | | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |