<template>
|
<div class="answer-container w-full h-full flex">
|
<el-scrollbar class="w-1/2">
|
<ExamInfo class="mb-5" :questionIndex="currentIndex" :activeQuestion="activeQuestion"></ExamInfo>
|
|
<div class="answer-content">
|
<div class="answer-item flex" v-for="item, index in activeQuestion.items" :class="answerState(item)">
|
<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>
|
</el-scrollbar>
|
|
<el-scrollbar class="w-1/2">
|
|
</el-scrollbar>
|
</div>
|
</template>
|
|
<script setup>
|
import { ref } from 'vue';
|
import { storeToRefs } from 'pinia';
|
import ExamInfo from '@/components/ExamInfo/index.vue';
|
import { useExamStore } from '@/store/index.js';
|
const examStore = useExamStore();
|
|
const { currentIndex } = storeToRefs(examStore);
|
|
const activeQuestion = ref(examStore.getActiveQuestion);
|
|
|
const answerState = (item) => {
|
if (item.prefix === activeQuestion.value.correct) {
|
const flag = checkRight(activeQuestion.value.correct, activeQuestion.value.right);
|
return {
|
right: flag,
|
wrong: !flag
|
};
|
}
|
if (item.prefix === activeQuestion.value.right) {
|
return {
|
right: true
|
};
|
}
|
};
|
|
const checkRight = (currentAnswer, rightAnswer) => {
|
return currentAnswer === rightAnswer;
|
}
|
|
|
|
</script>
|
|
<style lang="scss" scoped>
|
.answer-item {
|
max-width: 500px;
|
border-radius: 10px;
|
border: 1px solid #DCDFE6;
|
overflow: hidden;
|
margin-bottom: 20px;
|
|
&:last-of-type {
|
margin-bottom: 0;
|
}
|
|
.answer-icon {
|
width: 50px;
|
background-color: #F0F2F5;
|
border-right: 1px solid #ffffff;
|
}
|
|
.answer-text {
|
min-height: 50px;
|
padding: 15px 0;
|
margin: 0 10px;
|
}
|
}
|
|
.right {
|
border-color: #67C23A !important;
|
background-color: rgba($color: #67C23A, $alpha: 0.2) !important;
|
|
.answer-icon {
|
color: #ffffff !important;
|
border-color: #67C23A !important;
|
background-color: #67C23A !important;
|
}
|
|
.answer-text {
|
color: #67C23A !important;
|
}
|
}
|
|
.wrong {
|
border-color: #F56C6C !important;
|
background-color: rgba($color: #F56C6C, $alpha: 0.2) !important;
|
|
.answer-icon {
|
color: #ffffff !important;
|
border-color: #F56C6C !important;
|
background-color: #F56C6C !important;
|
}
|
|
.answer-text {
|
color: #F56C6C !important;
|
}
|
}
|
</style>
|