+
{{ mistake.title }}
+
+
+
-
-
正确答案:
-
{{ mistake.correctAnswer }}
+
+ {{ formatAnswer(mistake.yourAnswer) || '未作答' }}
+
+
+
+
+
+ {{ formatAnswer(mistake.correctAnswer) }}
+
@@ -550,19 +560,38 @@ const loadMistakes = async () => {
*/
const viewDetail = (mistake: any) => {
ElMessageBox.alert(
- h('div', { class: 'mistake-detail' }, [
- h('h4', '题目'),
- h('p', mistake.title),
- h('h4', '你的答案'),
- h('p', { style: 'color: #f56c6c' }, mistake.yourAnswer || '未作答'),
- h('h4', '正确答案'),
- h('p', { style: 'color: #67c23a' }, mistake.correctAnswer),
- h('h4', '知识点'),
- h('p', mistake.knowledge)
+ h('div', { class: 'mistake-detail-content' }, [
+ // 题目区域
+ h('div', { class: 'detail-section question-section' }, [
+ h('div', { class: 'section-label' }, '📝 题目内容'),
+ h('div', { class: 'section-content question-text' }, mistake.title)
+ ]),
+ // 答案对比区域
+ h('div', { class: 'detail-section answers-section' }, [
+ h('div', { class: 'answer-box wrong-answer' }, [
+ h('div', { class: 'answer-badge wrong' }, [
+ h('span', { class: 'badge-icon' }, '✗'),
+ h('span', { class: 'badge-text' }, '你的答案')
+ ]),
+ h('div', { class: 'answer-text' }, formatAnswer(mistake.yourAnswer) || '未作答')
+ ]),
+ h('div', { class: 'answer-box correct-answer' }, [
+ h('div', { class: 'answer-badge correct' }, [
+ h('span', { class: 'badge-icon' }, '✓'),
+ h('span', { class: 'badge-text' }, '正确答案')
+ ]),
+ h('div', { class: 'answer-text' }, formatAnswer(mistake.correctAnswer))
+ ])
+ ]),
+ // 知识点区域
+ h('div', { class: 'detail-section knowledge-section' }, [
+ h('div', { class: 'section-label' }, '💡 关联知识点'),
+ h('div', { class: 'section-content knowledge-tag' }, mistake.knowledge || '未关联')
+ ])
]),
'错题详情',
{
- confirmButtonText: '关闭',
+ confirmButtonText: '我知道了',
customClass: 'mistake-detail-dialog'
}
)
@@ -790,6 +819,33 @@ const getStatusTagType = (status: string) => {
return map[status] || 'info'
}
+/**
+ * 格式化答案显示
+ * 处理多选答案(逗号分隔)和选项格式
+ */
+const formatAnswer = (answer: string | null | undefined) => {
+ if (!answer) return ''
+
+ // 如果是JSON数组格式,解析并格式化
+ if (answer.startsWith('[') && answer.endsWith(']')) {
+ try {
+ const arr = JSON.parse(answer)
+ if (Array.isArray(arr)) {
+ return arr.join('、')
+ }
+ } catch {
+ // 解析失败,使用原始字符串
+ }
+ }
+
+ // 如果是逗号分隔的多选答案,用顿号分隔显示
+ if (answer.includes(',')) {
+ return answer.split(',').map(s => s.trim()).join('、')
+ }
+
+ return answer
+}
+
// 初始化加载数据
onMounted(() => {
loadStatistics()
@@ -1036,32 +1092,90 @@ console.log('错题分析页面已加载')
.answer-comparison {
display: grid;
grid-template-columns: 1fr 1fr;
- gap: 12px;
- margin-bottom: 12px;
+ gap: 16px;
+ margin-bottom: 16px;
+
+ @media (max-width: 640px) {
+ grid-template-columns: 1fr;
+ }
.answer-item {
- padding: 8px 12px;
- border-radius: 6px;
+ border-radius: 12px;
+ overflow: hidden;
+ transition: transform 0.2s ease, box-shadow 0.2s ease;
+
+ &:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
+ }
&.wrong {
- background: #fef0f0;
- border: 1px solid #fcdede;
+ background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
+ border: 1px solid #ffccc7;
+
+ .answer-header {
+ background: linear-gradient(90deg, #ff7875 0%, #ff9c9c 100%);
+ }
+
+ .answer-icon {
+ background: #fff;
+ color: #ff4d4f;
+ }
}
&.correct {
- background: #f0f9ff;
- border: 1px solid #b3d8ff;
+ background: linear-gradient(135deg, #f6ffed 0%, #d9f7be 100%);
+ border: 1px solid #b7eb8f;
+
+ .answer-header {
+ background: linear-gradient(90deg, #52c41a 0%, #73d13d 100%);
+ }
+
+ .answer-icon {
+ background: #fff;
+ color: #52c41a;
+ }
}
- .answer-label {
- font-size: 12px;
- color: #666;
- margin-right: 8px;
+ .answer-header {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ padding: 10px 14px;
+
+ .answer-icon {
+ width: 24px;
+ height: 24px;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 14px;
+ font-weight: bold;
+ flex-shrink: 0;
+ }
+
+ .answer-label {
+ font-size: 13px;
+ font-weight: 600;
+ color: #fff;
+ letter-spacing: 0.5px;
+ }
}
- .answer-value {
- font-weight: 500;
- color: #333;
+ .answer-body {
+ padding: 14px 16px;
+ min-height: 48px;
+ display: flex;
+ align-items: center;
+
+ .answer-value {
+ font-size: 15px;
+ font-weight: 500;
+ color: #333;
+ line-height: 1.6;
+ word-break: break-word;
+ }
}
}
}
@@ -1113,4 +1227,181 @@ console.log('错题分析页面已加载')
}
}
}
+
+
+
+
\ No newline at end of file