| | |
| | | ElCol: typeof import('element-plus/es')['ElCol'] |
| | | ElCollapse: typeof import('element-plus/es')['ElCollapse'] |
| | | ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] |
| | | ElCountdown: typeof import('element-plus/es')['ElCountdown'] |
| | | ElIcon: typeof import('element-plus/es')['ElIcon'] |
| | | ElInput: typeof import('element-plus/es')['ElInput'] |
| | | ElPagination: typeof import('element-plus/es')['ElPagination'] |
| | |
| | | |
| | | <style lang="scss" scoped> |
| | | .img-item { |
| | | max-width: 500px; |
| | | max-width: 400px; |
| | | } |
| | | </style> |
| | |
| | | const pinia = createPinia(); |
| | | export default pinia; |
| | | |
| | | export * from './modules/user'; |
| | | export * from './modules/user.js'; |
| | | export * from './modules/exam.js'; |
New file |
| | |
| | | import { ref } from 'vue'; |
| | | import { defineStore } from 'pinia'; |
| | | const useExamStore = defineStore('exam', () => { |
| | | const examInfo = ref(null); |
| | | |
| | | return { |
| | | examInfo |
| | | } |
| | | }); |
| | | |
| | | export default useExamStore; |
New file |
| | |
| | | <template> |
| | | <div class="answer-container w-full h-full"> |
| | | <el-scrollbar> |
| | | <ExamInfo class="mb-5"></ExamInfo> |
| | | |
| | | <div class="answer-content"> |
| | | <div class="answer-item flex" v-for="item, index in examInfo.answerList" @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> |
| | | </div> |
| | | |
| | | </el-scrollbar> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue'; |
| | | import ExamInfo from '@/components/ExamInfo/index.vue'; |
| | | |
| | | 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 activeIndex = ref(null); |
| | | |
| | | const answerClick = (item) => { |
| | | if(item) { |
| | | resetAnswer(); |
| | | item.isActive = true |
| | | } |
| | | }; |
| | | |
| | | const answerState = (item) => { |
| | | return { |
| | | active: item.isActive |
| | | }; |
| | | } |
| | | |
| | | const resetAnswer = () => { |
| | | examInfo.value.answerList.forEach(item => item.isActive = false); |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .answer-item { |
| | | max-width: 500px; |
| | | border-radius: 10px; |
| | | border: 1px solid #DCDFE6; |
| | | overflow: hidden; |
| | | margin-bottom: 20px; |
| | | cursor: pointer; |
| | | |
| | | &:last-of-type { |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | &:hover { |
| | | border-color: #3680fa; |
| | | |
| | | .answer-icon { |
| | | color: #3680fa; |
| | | border-color: #3680fa; |
| | | } |
| | | } |
| | | |
| | | |
| | | .answer-icon { |
| | | width: 50px; |
| | | background-color: #F0F2F5; |
| | | border-right: 1px solid #ffffff; |
| | | } |
| | | |
| | | .answer-text { |
| | | min-height: 50px; |
| | | padding: 15px 0; |
| | | margin: 0 10px; |
| | | } |
| | | } |
| | | |
| | | .active { |
| | | border-color: #409EFF !important; |
| | | .answer-icon { |
| | | color: #ffffff !important; |
| | | border-color: #409EFF !important; |
| | | background-color: #409EFF !important; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="answer-container w-full h-full"> |
| | | <el-scrollbar> |
| | | <ExamInfo></ExamInfo> |
| | | <ExamInfo class="mb-5"></ExamInfo> |
| | | |
| | | <div class="answer-content"> |
| | | <div class="answer-item flex"> |
| | | <div class="answer-icon flex justify-center items-center">A</div> |
| | | <div class="answer-text"></div> |
| | | <div class="answer-item flex" v-for="item, index in examInfo.answerList" @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> |
| | | </div> |
| | | |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from 'vue'; |
| | | import ExamInfo from '@/components/ExamInfo/index.vue'; |
| | | |
| | | 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 |
| | | }, |
| | | ] |
| | | }); |
| | | |
| | | const activeIndex = ref(null); |
| | | |
| | | const answerClick = (item) => { |
| | | if(item) { |
| | | resetAnswer(); |
| | | item.isActive = true |
| | | } |
| | | }; |
| | | |
| | | const answerState = (item) => { |
| | | return { |
| | | active: item.isActive |
| | | }; |
| | | } |
| | | |
| | | const resetAnswer = () => { |
| | | examInfo.value.answerList.forEach(item => item.isActive = false); |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .answer-item { |
| | | max-width: 400px; |
| | | max-width: 500px; |
| | | border-radius: 10px; |
| | | padding: 10px 0; |
| | | border: 1px solid #EBEEF5; |
| | | border: 1px solid #DCDFE6; |
| | | overflow: hidden; |
| | | margin-bottom: 20px; |
| | | cursor: pointer; |
| | | |
| | | &:last-of-type { |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | &:hover { |
| | | border-color: #3680fa; |
| | | |
| | | .answer-icon { |
| | | color: #3680fa; |
| | | border-color: #3680fa; |
| | | } |
| | | } |
| | | |
| | | |
| | | .answer-icon { |
| | | width: 50px; |
| | | height: 100%; |
| | | background-color: #F0F2F5; |
| | | border-right: 1px solid #ffffff; |
| | | } |
| | | |
| | | .answer-text { |
| | | min-height: 50px; |
| | | padding: 15px 0; |
| | | margin: 0 10px; |
| | | } |
| | | } |
| | | |
| | | .active { |
| | | border-color: #409EFF !important; |
| | | .answer-icon { |
| | | color: #ffffff !important; |
| | | border-color: #409EFF !important; |
| | | background-color: #409EFF !important; |
| | | } |
| | | } |
| | | </style> |
New file |
| | |
| | | <template> |
| | | <div class="time-container flex justify-center text-white items-center shadow-md"> |
| | | <el-icon class="mr-1 text-xl" size="24"><Timer /></el-icon> |
| | | <div class="label mr-1">剩余时间:</div> |
| | | <el-countdown :value="time" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref} from 'vue'; |
| | | import { Timer } from '@element-plus/icons-vue'; |
| | | |
| | | const time = ref(1000); |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .time-container { |
| | | width: 220px; |
| | | border-radius: 100px; |
| | | padding: 10px 0; |
| | | background-color: rgba($color: #86d7f7, $alpha: 0.3); |
| | | |
| | | } |
| | | |
| | | :deep(.el-statistic__number) { |
| | | color: #ffffff; |
| | | } |
| | | </style> |
| | |
| | | <div class="exam-content"> |
| | | <div class="exam-wrapper container mx-auto h-full flex flex-col"> |
| | | <div class="exam-header flex items-center mt-12 mb-10"> |
| | | <div class="title-container text-3xl font-semibold text-white"> |
| | | <div class="title-container text-3xl font-semibold text-white mr-8"> |
| | | 测试测试测试 |
| | | </div> |
| | | |
| | | <AnswerTime></AnswerTime> |
| | | |
| | | </div> |
| | | |
| | | <div class="exam-main grow flex justify-between"> |
| | |
| | | |
| | | <div class="main-wrapper w-full grow relative my-5"> |
| | | <div class="main-content absolute top-0 bottom-0 w-full"> |
| | | <AnswerSingle></AnswerSingle> |
| | | <Transition appear name="fade-transform" mode="out-in"> |
| | | <component :is="typeComponent[currentType]" :key="questionIndex"></component> |
| | | </Transition> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="tool-wrapper flex justify-end"> |
| | | <div class="button-container flex items-center"> |
| | | <div class="button-item"> |
| | | <el-button class="tool-button">上一题</el-button> |
| | | <el-button class="tool-button" @click="prevQuestion">上一题</el-button> |
| | | </div> |
| | | <div class="button-item"> |
| | | <el-button class="tool-button" type="primary">下一题</el-button> |
| | | <el-button class="tool-button" type="primary" @click="nextQuestion">下一题</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref} from 'vue'; |
| | | import AnswerTag from './components/answer-tag/index.vue'; |
| | | import AnswerProgress from './components/answer-progress/index.vue'; |
| | | import AnswerSheet from './components/answer-sheet/index.vue'; |
| | | import AnswerSingle from './components/answer-main/answer-single/index.vue'; |
| | | import AnswerMultiple from './components/answer-main/answer-multiple/index.vue'; |
| | | import AnswerTime from './components/answer-time/index.vue'; |
| | | |
| | | const typeComponent = { |
| | | 1: AnswerSingle, |
| | | 2: AnswerMultiple, |
| | | } |
| | | |
| | | const currentType = ref(1); |
| | | const questionIndex = ref(0); |
| | | |
| | | const prevQuestion = () => { |
| | | questionIndex.value--; |
| | | } |
| | | |
| | | const nextQuestion = () => { |
| | | questionIndex.value++; |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |