feat(training): 完成员工培训闭环与管理配置

This commit is contained in:
runny committed 2026-07-06 01:52:55 +08:00
1 parent 91758ef2b4
commit 95f3906779
37 files changed
+1766 -249

No files matched your search

@@ -5,23 +5,27 @@
*/
<script setup lang="ts">
import { CheckCircle2, XCircle, ClipboardCheck } from 'lucide-vue-next';
import type { TrainingQuestion } from '@/features/chat/training/training.types';
import type { TrainingExamTransitionFeedback, TrainingQuestion } from '@/features/chat/training/training.types';
export interface TrainingHandlers {
getQuestion: () => TrainingQuestion | null;
getCurrentQuestionIndex: () => number;
getAnsweredCount: () => number;
getTotalCount: () => number;
getPassScore: () => number;
getScore: () => number;
getSelectedOptionId: () => string;
getAnswerLocked: () => boolean;
getFeedbackCorrect: () => boolean;
getAnswerLabel: () => string;
getLatestExamFeedback: () => TrainingExamTransitionFeedback | null;
onSelect: (optionId: string) => void;
onNext: () => void;
onPlayVideo: () => void;
onStartExam: () => void;
onRestartExam: () => void;
getResultScore: () => number;
getResultPassed: () => boolean;
getCorrectCount: () => number;
getWrongCount: () => number;
getSummaryPoints: () => string[];
@@ -33,11 +37,13 @@ const props = defineProps<{
currentQuestionIndex: number;
answeredCount: number;
totalCount: number;
passScore: number;
score: number;
selectedOptionId: string;
answerLocked: boolean;
feedbackCorrect: boolean;
answerLabel: string;
latestExamFeedback: TrainingExamTransitionFeedback | null;
isThinking: boolean;
}>();
@@ -46,7 +52,6 @@ const emit = defineEmits<{
next: [];
}>();
const passLine = 90;
</script>
<template>
@@ -68,7 +73,42 @@ const passLine = 90;
</div>
<div class="rounded-lg bg-slate-50 px-3 py-1.5 font-medium text-slate-600 border border-slate-100 flex items-center gap-2">
<span>及格线:</span>
<span class="text-slate-800 font-bold">{{ passLine }} 分</span>
<span class="text-slate-800 font-bold">{{ passScore }} 分</span>
</div>
</div>
</div>
<!-- 上一题反馈摘要:自动推进到下一题后,仍需把对错、解析和分数留在同一张题卡顶部 -->
<div
v-if="latestExamFeedback"
class="rounded-2xl border p-4"
:class="latestExamFeedback.correct ? 'border-emerald-100 bg-emerald-50/60' : 'border-red-100 bg-red-50/60'"
>
<div class="flex flex-wrap items-center justify-between gap-3">
<div class="flex items-center gap-2 text-sm font-bold" :class="latestExamFeedback.correct ? 'text-emerald-700' : 'text-red-700'">
<CheckCircle2 v-if="latestExamFeedback.correct" class="h-4 w-4" />
<XCircle v-else class="h-4 w-4" />
{{ latestExamFeedback.correct ? $t('chat.training.exam.correctFeedback') : $t('chat.training.exam.wrongFeedback') }}
</div>
<div class="rounded-lg bg-white/70 px-3 py-1 text-xs font-semibold text-slate-600">
{{ $t('chat.training.exam.currentScore', { score: latestExamFeedback.scoreAfterAnswer }) }}
</div>
</div>
<div class="mt-3 space-y-2 text-[13px] leading-6 text-slate-600">
<div class="text-slate-500">{{ latestExamFeedback.questionPrompt }}</div>
<div class="flex gap-2">
<span class="font-medium" :class="latestExamFeedback.correct ? 'text-emerald-600' : 'text-red-600'">
{{ $t('chat.training.exam.selectedAnswer', { answer: latestExamFeedback.selectedAnswerLabel || '--' }) }}
</span>
</div>
<div v-if="!latestExamFeedback.correct" class="flex gap-2">
<span class="text-emerald-600 font-medium">
{{ $t('chat.training.exam.correctAnswer', { answer: latestExamFeedback.correctAnswerLabel || '--' }) }}
</span>
</div>
<div class="pl-2 border-l-2 border-slate-200/60 text-slate-500/90">
{{ latestExamFeedback.explanation }}
</div>
</div>
</div>