style: 调整练习考试页面

This commit is contained in:
QDKF 2025-08-29 22:54:05 +08:00
parent 39fff08a0d
commit 8000bde1b9
7 changed files with 1539 additions and 4210 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -0,0 +1,52 @@
<template>
<div class="custom-checkbox" :class="{ checked: modelValue }" @click="toggle">
<span v-if="modelValue" class="checkmark"></span>
</div>
</template>
<script setup lang="ts">
interface Props {
modelValue: boolean
}
interface Emits {
(e: 'update:modelValue', value: boolean): void
}
const props = defineProps<Props>()
const emit = defineEmits<Emits>()
const toggle = () => {
emit('update:modelValue', !props.modelValue)
}
</script>
<style scoped>
.custom-checkbox {
width: 20px;
height: 20px;
border: 1px solid #0088D1;
border-radius: 3px;
display: flex;
align-items: center;
justify-content: center;
background-color: transparent;
flex-shrink: 0;
cursor: pointer;
transition: all 0.2s ease;
}
.custom-checkbox.checked {
background-color: #0088D1;
border-color: #0088D1;
}
.checkmark {
width: 10px;
height: 5px;
border: solid white;
border-width: 0 0 1.5px 1.5px;
transform: rotate(-45deg);
margin-top: -1px;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -270,7 +270,7 @@ watch(() => props.show, (newVal) => {
} }
.modal-title { .modal-title {
font-size: 8px; font-size: 18px;
padding-bottom: 10px; padding-bottom: 10px;
font-weight: 500; font-weight: 500;
color: #000; color: #000;

1141
src/views/ExamDetail.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -233,7 +233,7 @@
fontSize: '14px' fontSize: '14px'
}"> }">
{{ detailAssignment.status === '未完成' || detailAssignment.status === '待提交' ? '未完成' : {{ detailAssignment.status === '未完成' || detailAssignment.status === '待提交' ? '未完成' :
(detailAssignment.status === '已完成' ? '已完成' : '541人已完成') }} (detailAssignment.status === '已完成' ? '已完成' : '541人已完成') }}
</span> </span>
</span> </span>
</div> </div>
@ -972,9 +972,7 @@
<div class="search-input-container"> <div class="search-input-container">
<input v-model="downloadFilter.keyword" type="text" class="search-input" placeholder="请输入文件名称" /> <input v-model="downloadFilter.keyword" type="text" class="search-input" placeholder="请输入文件名称" />
<button class="search-btn"> <button class="search-btn">
<img <img src="/images/profile/search.png" alt="搜索图标" class="search-icon" />
src="/images/profile/search.png"
alt="搜索图标" class="search-icon" />
</button> </button>
</div> </div>
</div> </div>
@ -1064,8 +1062,7 @@
</div> </div>
<!-- 考试详情页面 --> <!-- 考试详情页面 -->
<ExamDetail v-if="showExamDetail && currentExamDetail" :currentExamDetail="currentExamDetail"
:currentDetailType="currentDetailType" @close="closeExamDetail" />
</template> </template>
@ -1074,12 +1071,13 @@
import { ref, computed, onMounted, onActivated, reactive } from 'vue' import { ref, computed, onMounted, onActivated, reactive } from 'vue'
import { useMessage, NInput, NForm, NFormItem } from 'naive-ui' import { useMessage, NInput, NForm, NFormItem } from 'naive-ui'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import SafeAvatar from '@/components/common/SafeAvatar.vue' import SafeAvatar from '@/components/common/SafeAvatar.vue'
import ExamDetail from '../components/ExamDetail.vue';
import QuillEditor from '@/components/common/QuillEditor.vue' import QuillEditor from '@/components/common/QuillEditor.vue'
const { t, locale } = useI18n() const { t, locale } = useI18n()
const router = useRouter()
// //
const bannerImage = computed(() => { const bannerImage = computed(() => {
@ -1135,36 +1133,36 @@ interface Exam {
} }
// //
interface ExamOption { // interface ExamOption {
id: string // id: string
text: string // text: string
image?: string // image?: string
} // }
// //
interface ExamQuestion { // interface ExamQuestion {
id: number // id: number
type: 'single' | 'multiple' // type: 'single' | 'multiple'
title: string // title: string
content: string // content: string
options: ExamOption[] // options: ExamOption[]
correctAnswers: string[] // correctAnswers: string[]
userAnswers: string[] // userAnswers: string[]
isCorrect: boolean // isCorrect: boolean
} // }
// //
interface ExamDetail { // interface ExamDetail {
id: number // id: number
title: string // title: string
examDate: string // examDate: string
duration: number // duration: number
totalQuestions: number // totalQuestions: number
correctCount: number // correctCount: number
wrongCount: number // wrongCount: number
score: number // score: number
questions: ExamQuestion[] // questions: ExamQuestion[]
} // }
// //
interface Practice { interface Practice {
@ -1181,17 +1179,17 @@ interface Practice {
} }
// //
interface PracticeDetail { // interface PracticeDetail {
id: number // id: number
title: string // title: string
practiceDate: string // practiceDate: string
duration: number // duration: number
totalQuestions: number // totalQuestions: number
correctCount: number // correctCount: number
wrongCount: number // wrongCount: number
score: number // score: number
questions: ExamQuestion[] // questions: ExamQuestion[]
} // }
// //
interface Activity { interface Activity {
@ -1604,180 +1602,180 @@ const mockExams: Exam[] = [
] ]
// //
const mockExamDetails: { [key: number]: ExamDetail } = { // const mockExamDetails: { [key: number]: ExamDetail } = {
3: { // 3: {
id: 3, // id: 3,
title: 'C++语言程序设计基础考试', // title: 'C++',
examDate: '2025-07-30 12:00', // examDate: '2025-07-30 12:00',
duration: 100, // duration: 100,
totalQuestions: 120, // totalQuestions: 120,
correctCount: 90, // correctCount: 90,
wrongCount: 10, // wrongCount: 10,
score: 98, // score: 98,
questions: [ // questions: [
{ // {
id: 1, // id: 1,
type: 'single', // type: 'single',
title: '[单选题]', // title: '[]',
content: '危险化学品生产企业应当提供危险化学品安全技术说明书,并在包装(包括外包装)上标识,或者将技术与包装内危险化学品相符的化学品()和安全技术说明书。', // content: '',
options: [ // options: [
{ id: 'A', text: 'A.操作规范说明书' }, // { id: 'A', text: 'A.' },
{ id: 'B', text: 'B.应急处理措施' }, // { id: 'B', text: 'B.' },
{ id: 'C', text: 'C.安全标签' }, // { id: 'C', text: 'C.' },
{ id: 'D', text: 'D.产品合格证' } // { id: 'D', text: 'D.' }
], // ],
correctAnswers: ['B'], // correctAnswers: ['B'],
userAnswers: ['B'], // userAnswers: ['B'],
isCorrect: true // isCorrect: true
}, // },
{ // {
id: 2, // id: 2,
type: 'multiple', // type: 'multiple',
title: '[多选题]', // title: '[]',
content: '危险化学品生产企业应当提供危险化学品安全技术说明书,并在包装(包括外包装)上标识,或者将技术与包装内危险化学品相符的化学品()和安全技术说明书。', // content: '',
options: [ // options: [
{ id: 'A', text: 'A.操作规范说明书', image: '/images/exam/option-a.png' }, // { id: 'A', text: 'A.', image: '/images/exam/option-a.png' },
{ id: 'B', text: 'B.应急处理措施', image: '/images/exam/option-b.png' }, // { id: 'B', text: 'B.', image: '/images/exam/option-b.png' },
{ id: 'C', text: 'C.安全标签' }, // { id: 'C', text: 'C.' },
{ id: 'D', text: 'D.产品合格证', image: '/images/exam/option-d.png' }, // { id: 'D', text: 'D.', image: '/images/exam/option-d.png' },
{ id: 'E', text: 'E.产品标签' } // { id: 'E', text: 'E.' }
], // ],
correctAnswers: ['A', 'B'], // correctAnswers: ['A', 'B'],
userAnswers: ['A', 'B'], // userAnswers: ['A', 'B'],
isCorrect: true // isCorrect: true
} // }
] // ]
}, // },
6: { // 6: {
id: 6, // id: 6,
title: 'C++语言程序设计基础考试', // title: 'C++',
examDate: '2025-07-30 12:00', // examDate: '2025-07-30 12:00',
duration: 100, // duration: 100,
totalQuestions: 120, // totalQuestions: 120,
correctCount: 90, // correctCount: 90,
wrongCount: 10, // wrongCount: 10,
score: 98, // score: 98,
questions: [ // questions: [
{ // {
id: 1, // id: 1,
type: 'single', // type: 'single',
title: '[单选题]', // title: '[]',
content: '危险化学品生产企业应当提供危险化学品安全技术说明书,并在包装(包括外包装)上标识,或者将技术与包装内危险化学品相符的化学品()和安全技术说明书。', // content: '',
options: [ // options: [
{ id: 'A', text: 'A.操作规范说明书' }, // { id: 'A', text: 'A.' },
{ id: 'B', text: 'B.应急处理措施' }, // { id: 'B', text: 'B.' },
{ id: 'C', text: 'C.安全标签' }, // { id: 'C', text: 'C.' },
{ id: 'D', text: 'D.产品合格证' } // { id: 'D', text: 'D.' }
], // ],
correctAnswers: ['B'], // correctAnswers: ['B'],
userAnswers: ['B'], // userAnswers: ['B'],
isCorrect: true // isCorrect: true
}, // },
{ // {
id: 2, // id: 2,
type: 'multiple', // type: 'multiple',
title: '[多选题]', // title: '[]',
content: '危险化学品生产企业应当提供危险化学品安全技术说明书,并在包装(包括外包装)上标识,或者将技术与包装内危险化学品相符的化学品()和安全技术说明书。', // content: '',
options: [ // options: [
{ id: 'A', text: 'A.操作规范说明书', image: '/images/exam/option-a.png' }, // { id: 'A', text: 'A.', image: '/images/exam/option-a.png' },
{ id: 'B', text: 'B.应急处理措施', image: '/images/exam/option-b.png' }, // { id: 'B', text: 'B.', image: '/images/exam/option-b.png' },
{ id: 'C', text: 'C.安全标签' }, // { id: 'C', text: 'C.' },
{ id: 'D', text: 'D.产品合格证', image: '/images/exam/option-d.png' }, // { id: 'D', text: 'D.', image: '/images/exam/option-d.png' },
{ id: 'E', text: 'E.产品标签' } // { id: 'E', text: 'E.' }
], // ],
correctAnswers: ['A', 'B'], // correctAnswers: ['A', 'B'],
userAnswers: ['A', 'B'], // userAnswers: ['A', 'B'],
isCorrect: true // isCorrect: true
} // }
] // ]
}, // },
8: { // 8: {
id: 8, // id: 8,
title: 'C++语言程序设计基础考试', // title: 'C++',
examDate: '2025-07-30 12:00', // examDate: '2025-07-30 12:00',
duration: 100, // duration: 100,
totalQuestions: 120, // totalQuestions: 120,
correctCount: 90, // correctCount: 90,
wrongCount: 10, // wrongCount: 10,
score: 98, // score: 98,
questions: [ // questions: [
{ // {
id: 1, // id: 1,
type: 'single', // type: 'single',
title: '[单选题]', // title: '[]',
content: '危险化学品生产企业应当提供危险化学品安全技术说明书,并在包装(包括外包装)上标识,或者将技术与包装内危险化学品相符的化学品()和安全技术说明书。', // content: '',
options: [ // options: [
{ id: 'A', text: 'A.操作规范说明书' }, // { id: 'A', text: 'A.' },
{ id: 'B', text: 'B.应急处理措施' }, // { id: 'B', text: 'B.' },
{ id: 'C', text: 'C.安全标签' }, // { id: 'C', text: 'C.' },
{ id: 'D', text: 'D.产品合格证' } // { id: 'D', text: 'D.' }
], // ],
correctAnswers: ['B'], // correctAnswers: ['B'],
userAnswers: ['B'], // userAnswers: ['B'],
isCorrect: true // isCorrect: true
}, // },
{ // {
id: 2, // id: 2,
type: 'multiple', // type: 'multiple',
title: '[多选题]', // title: '[]',
content: '危险化学品生产企业应当提供危险化学品安全技术说明书,并在包装(包括外包装)上标识,或者将技术与包装内危险化学品相符的化学品()和安全技术说明书。', // content: '',
options: [ // options: [
{ id: 'A', text: 'A.操作规范说明书', image: '/images/exam/option-a.png' }, // { id: 'A', text: 'A.', image: '/images/exam/option-a.png' },
{ id: 'B', text: 'B.应急处理措施', image: '/images/exam/option-b.png' }, // { id: 'B', text: 'B.', image: '/images/exam/option-b.png' },
{ id: 'C', text: 'C.安全标签' }, // { id: 'C', text: 'C.' },
{ id: 'D', text: 'D.产品合格证', image: '/images/exam/option-d.png' }, // { id: 'D', text: 'D.', image: '/images/exam/option-d.png' },
{ id: 'E', text: 'E.产品标签' } // { id: 'E', text: 'E.' }
], // ],
correctAnswers: ['A', 'B'], // correctAnswers: ['A', 'B'],
userAnswers: ['A', 'B'], // userAnswers: ['A', 'B'],
isCorrect: true // isCorrect: true
} // }
] // ]
}, // },
9: { // 9: {
id: 9, // id: 9,
title: 'C++语言程序设计基础考试', // title: 'C++',
examDate: '2025-07-30 12:00', // examDate: '2025-07-30 12:00',
duration: 100, // duration: 100,
totalQuestions: 120, // totalQuestions: 120,
correctCount: 90, // correctCount: 90,
wrongCount: 10, // wrongCount: 10,
score: 98, // score: 98,
questions: [ // questions: [
{ // {
id: 1, // id: 1,
type: 'single', // type: 'single',
title: '[单选题]', // title: '[]',
content: '危险化学品生产企业应当提供危险化学品安全技术说明书,并在包装(包括外包装)上标识,或者将技术与包装内危险化学品相符的化学品()和安全技术说明书。', // content: '',
options: [ // options: [
{ id: 'A', text: 'A.操作规范说明书' }, // { id: 'A', text: 'A.' },
{ id: 'B', text: 'B.应急处理措施' }, // { id: 'B', text: 'B.' },
{ id: 'C', text: 'C.安全标签' }, // { id: 'C', text: 'C.' },
{ id: 'D', text: 'D.产品合格证' } // { id: 'D', text: 'D.' }
], // ],
correctAnswers: ['B'], // correctAnswers: ['B'],
userAnswers: ['B'], // userAnswers: ['B'],
isCorrect: true // isCorrect: true
}, // },
{ // {
id: 2, // id: 2,
type: 'multiple', // type: 'multiple',
title: '[多选题]', // title: '[]',
content: '危险化学品生产企业应当提供危险化学品安全技术说明书,并在包装(包括外包装)上标识,或者将技术与包装内危险化学品相符的化学品()和安全技术说明书。', // content: '',
options: [ // options: [
{ id: 'A', text: 'A.操作规范说明书', image: '/images/exam/option-a.png' }, // { id: 'A', text: 'A.', image: '/images/exam/option-a.png' },
{ id: 'B', text: 'B.应急处理措施', image: '/images/exam/option-b.png' }, // { id: 'B', text: 'B.', image: '/images/exam/option-b.png' },
{ id: 'C', text: 'C.安全标签' }, // { id: 'C', text: 'C.' },
{ id: 'D', text: 'D.产品合格证', image: '/images/exam/option-d.png' }, // { id: 'D', text: 'D.', image: '/images/exam/option-d.png' },
{ id: 'E', text: 'E.产品标签' } // { id: 'E', text: 'E.' }
], // ],
correctAnswers: ['A', 'B'], // correctAnswers: ['A', 'B'],
userAnswers: ['A', 'B'], // userAnswers: ['A', 'B'],
isCorrect: true // isCorrect: true
} // }
] // ]
} // }
} // }
// //
const mockPractices: Practice[] = [ const mockPractices: Practice[] = [
@ -2077,132 +2075,132 @@ const mockSystemMessages: SystemMessage[] = [
] ]
// //
const mockPracticeDetails: { [key: number]: PracticeDetail } = { // const mockPracticeDetails: { [key: number]: PracticeDetail } = {
2: { // 2: {
id: 2, // id: 2,
title: 'C++语言程序设计基础练习题', // title: 'C++',
practiceDate: '2025-07-30 14:00', // practiceDate: '2025-07-30 14:00',
duration: 88, // duration: 88,
totalQuestions: 100, // totalQuestions: 100,
correctCount: 18, // correctCount: 18,
wrongCount: 15, // wrongCount: 15,
score: 90, // score: 90,
questions: [ // questions: [
{ // {
id: 1, // id: 1,
type: 'single', // type: 'single',
title: '[单选题]', // title: '[]',
content: 'C++中,下列哪个关键字用于定义类?', // content: 'C++',
options: [ // options: [
{ id: 'A', text: 'A.struct' }, // { id: 'A', text: 'A.struct' },
{ id: 'B', text: 'B.class' }, // { id: 'B', text: 'B.class' },
{ id: 'C', text: 'C.union' }, // { id: 'C', text: 'C.union' },
{ id: 'D', text: 'D.enum' } // { id: 'D', text: 'D.enum' }
], // ],
correctAnswers: ['B'], // correctAnswers: ['B'],
userAnswers: ['B'], // userAnswers: ['B'],
isCorrect: true // isCorrect: true
}, // },
{ // {
id: 2, // id: 2,
type: 'multiple', // type: 'multiple',
title: '[多选题]', // title: '[]',
content: 'C++中,下列哪些是面向对象编程的特性?', // content: 'C++',
options: [ // options: [
{ id: 'A', text: 'A.封装' }, // { id: 'A', text: 'A.' },
{ id: 'B', text: 'B.继承' }, // { id: 'B', text: 'B.' },
{ id: 'C', text: 'C.多态' }, // { id: 'C', text: 'C.' },
{ id: 'D', text: 'D.递归' }, // { id: 'D', text: 'D.' },
{ id: 'E', text: 'E.抽象' } // { id: 'E', text: 'E.' }
], // ],
correctAnswers: ['A', 'B', 'C', 'E'], // correctAnswers: ['A', 'B', 'C', 'E'],
userAnswers: ['A', 'B', 'C'], // userAnswers: ['A', 'B', 'C'],
isCorrect: false // isCorrect: false
} // }
] // ]
}, // },
3: { // 3: {
id: 3, // id: 3,
title: 'C++语言程序设计基础练习题', // title: 'C++',
practiceDate: '2025-07-30 14:00', // practiceDate: '2025-07-30 14:00',
duration: 88, // duration: 88,
totalQuestions: 100, // totalQuestions: 100,
correctCount: 18, // correctCount: 18,
wrongCount: 15, // wrongCount: 15,
score: 90, // score: 90,
questions: [ // questions: [
{ // {
id: 1, // id: 1,
type: 'single', // type: 'single',
title: '[单选题]', // title: '[]',
content: 'C++中,下列哪个关键字用于定义类?', // content: 'C++',
options: [ // options: [
{ id: 'A', text: 'A.struct' }, // { id: 'A', text: 'A.struct' },
{ id: 'B', text: 'B.class' }, // { id: 'B', text: 'B.class' },
{ id: 'C', text: 'C.union' }, // { id: 'C', text: 'C.union' },
{ id: 'D', text: 'D.enum' } // { id: 'D', text: 'D.enum' }
], // ],
correctAnswers: ['B'], // correctAnswers: ['B'],
userAnswers: ['B'], // userAnswers: ['B'],
isCorrect: true // isCorrect: true
} // }
] // ]
}, // },
5: { // 5: {
id: 5, // id: 5,
title: 'C++语言程序设计基础练习题', // title: 'C++',
practiceDate: '2025-07-30 14:00', // practiceDate: '2025-07-30 14:00',
duration: 88, // duration: 88,
totalQuestions: 100, // totalQuestions: 100,
correctCount: 18, // correctCount: 18,
wrongCount: 15, // wrongCount: 15,
score: 90, // score: 90,
questions: [ // questions: [
{ // {
id: 1, // id: 1,
type: 'single', // type: 'single',
title: '[单选题]', // title: '[]',
content: 'C++中,下列哪个关键字用于定义类?', // content: 'C++',
options: [ // options: [
{ id: 'A', text: 'A.struct' }, // { id: 'A', text: 'A.struct' },
{ id: 'B', text: 'B.class' }, // { id: 'B', text: 'B.class' },
{ id: 'C', text: 'C.union' }, // { id: 'C', text: 'C.union' },
{ id: 'D', text: 'D.enum' } // { id: 'D', text: 'D.enum' }
], // ],
correctAnswers: ['B'], // correctAnswers: ['B'],
userAnswers: ['B'], // userAnswers: ['B'],
isCorrect: true // isCorrect: true
} // }
] // ]
}, // },
6: { // 6: {
id: 6, // id: 6,
title: 'C++语言程序设计基础练习题', // title: 'C++',
practiceDate: '2025-07-30 14:00', // practiceDate: '2025-07-30 14:00',
duration: 88, // duration: 88,
totalQuestions: 100, // totalQuestions: 100,
correctCount: 18, // correctCount: 18,
wrongCount: 15, // wrongCount: 15,
score: 90, // score: 90,
questions: [ // questions: [
{ // {
id: 1, // id: 1,
type: 'single', // type: 'single',
title: '[单选题]', // title: '[]',
content: 'C++中,下列哪个关键字用于定义类?', // content: 'C++',
options: [ // options: [
{ id: 'A', text: 'A.struct' }, // { id: 'A', text: 'A.struct' },
{ id: 'B', text: 'B.class' }, // { id: 'B', text: 'B.class' },
{ id: 'C', text: 'C.union' }, // { id: 'C', text: 'C.union' },
{ id: 'D', text: 'D.enum' } // { id: 'D', text: 'D.enum' }
], // ],
correctAnswers: ['B'], // correctAnswers: ['B'],
userAnswers: ['B'], // userAnswers: ['B'],
isCorrect: true // isCorrect: true
} // }
] // ]
} // }
} // }
// //
const allFilteredCourses = computed(() => { const allFilteredCourses = computed(() => {
@ -2399,9 +2397,7 @@ const continueExam = (examId: number) => {
// //
const viewExamResult = (examId: number) => { const viewExamResult = (examId: number) => {
currentExamId.value = examId router.push(`/exam-detail/${examId}?source=exam`)
currentDetailType.value = 'exam'
showExamDetail.value = true
} }
// //
@ -2411,9 +2407,7 @@ const continuePractice = (practiceId: number) => {
// //
const viewPracticeDetail = (practiceId: number) => { const viewPracticeDetail = (practiceId: number) => {
currentExamId.value = practiceId router.push(`/exam-detail/${practiceId}?source=practice`)
currentDetailType.value = 'practice'
showExamDetail.value = true
} }
// //
@ -2424,8 +2418,7 @@ const continueActivity = (id: number) => {
// //
const viewActivityDetail = (id: number) => { const viewActivityDetail = (id: number) => {
console.log('查看活动详情:', id) router.push(`/activity/${id}`)
message.info(`查看活动详情 ${id}`)
} }
// //
@ -2652,28 +2645,7 @@ const showDraftBoxView = ref(false)
const draftAssignment = ref<Assignment | null>(null) const draftAssignment = ref<Assignment | null>(null)
// //
const showExamDetail = ref(false)
const currentExamId = ref<number | null>(null)
const currentDetailType = ref<'exam' | 'practice'>('exam')
//
const currentExamDetail = computed(() => {
if (currentExamId.value) {
if (currentDetailType.value === 'exam') {
return mockExamDetails[currentExamId.value]
} else if (currentDetailType.value === 'practice') {
return mockPracticeDetails[currentExamId.value]
}
}
return null
})
//
const closeExamDetail = () => {
showExamDetail.value = false
currentExamId.value = null
currentDetailType.value = 'exam'
}
// // // //
// const getAnswerItemClass = (index: number) => { // const getAnswerItemClass = (index: number) => {