| | |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue'; |
| | | import {storeToRefs} from 'pinia'; |
| | | import { storeToRefs } from 'pinia'; |
| | | import ExamInfo from '@/components/ExamInfo/index.vue'; |
| | | import {useExamStore} from '@/store/index.js'; |
| | | import { useExamStore } from '@/store/index.js'; |
| | | const examStore = useExamStore(); |
| | | |
| | | const {currentType,currentIndex} = storeToRefs(examStore); |
| | | const { currentType, currentIndex } = storeToRefs(examStore); |
| | | |
| | | const activeQuestion = ref(examStore.getActiveQuestion); |
| | | |
| | | const answerClick = (item) => { |
| | | if(item) { |
| | | resetAnswer(); |
| | | item.isActive = true; |
| | | examStore.setQuestionAnswer(currentType.value, currentIndex.value, item.prefix); |
| | | if (item) { |
| | | if (item.isActive) { |
| | | item.isActive = !item.isActive; |
| | | } else { |
| | | resetAnswer(); |
| | | item.isActive = true; |
| | | } |
| | | const answerList = filterAnswer(); |
| | | examStore.setQuestionAnswer(currentType.value, currentIndex.value, answerList.join(',')); |
| | | } |
| | | }; |
| | | |
| | |
| | | return { |
| | | active: item.isActive |
| | | }; |
| | | } |
| | | }; |
| | | |
| | | const resetAnswer = () => { |
| | | activeQuestion.value.items.forEach(item => item.isActive = false); |
| | | }; |
| | | |
| | | const filterAnswer = () => { |
| | | return activeQuestion.value.items.filter(item => item.isActive); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | .active { |
| | | border-color: #409EFF !important; |
| | | |
| | | .answer-icon { |
| | | color: #ffffff !important; |
| | | border-color: #409EFF !important; |