feat(training-workspace): 培训考试增加提交答卷后再进入结算结果

feat(training-workspace): 完善员工培训工作区考试流转与配置交互
This commit is contained in:
runny committed 2026-07-09 12:03:57 +08:00
1 parent 5bef77f86c
commit 8bd66baa21
8 files changed
+246 -197

No files matched your search

@@ -138,7 +138,7 @@ const compactSummary = computed(() => {
if (workspace.stage === 'summary') return t('chat.training.summary.title');
if (workspace.stage === 'exam') {
return t('chat.training.exam.questionCounter', {
current: workspace.answeredCount + 1,
current: workspace.currentQuestionNumber,
total: workspace.totalQuestionCount,
});
}
@@ -165,7 +165,15 @@ const examQuestionItems = computed(() => Array.from({ length: workspace.totalQue
const canNavigateExamQuestions = computed(() => workspace.stage === 'exam');
const jumpToExamQuestion = (index: number) => {
if (!canNavigateExamQuestions.value) return;
workspace.currentQuestionIndex = index;
workspace.syncExamQuestionIndex(index);
};
const canSwitchToStage = (stageKey: string) => {
if (stageKey !== 'result') return true;
return workspace.canEnterResultStage;
};
const handleStageCardClick = (stageKey: string) => {
if (!canSwitchToStage(stageKey)) return;
workspace.stage = stageKey as typeof workspace.stage;
};
</script>
@@ -387,8 +395,11 @@ const jumpToExamQuestion = (index: number) => {
v-for="(item, index) in stageItems"
:key="item.key"
class="rounded-xl border px-3 py-2.5 transition cursor-pointer hover:border-brand-300"
:class="stageStep >= index + 1 ? 'border-brand-200 bg-brand-50/70' : 'border-default bg-surface-soft/70'"
@click="workspace.stage = item.key as any"
:class="[
stageStep >= index + 1 ? 'border-brand-200 bg-brand-50/70' : 'border-default bg-surface-soft/70',
canSwitchToStage(String(item.key)) ? 'cursor-pointer hover:border-brand-300' : 'cursor-not-allowed opacity-60',
]"
@click="handleStageCardClick(String(item.key))"
>
<div class="flex items-center gap-2">
<div
@@ -492,7 +503,7 @@ const jumpToExamQuestion = (index: number) => {
{{ $t('chat.training.exam.title') }}
</div>
<h3 class="mt-1 text-lg font-semibold text-primary">
{{ $t('chat.training.exam.questionCounter', { current: workspace.answeredCount + 1, total: workspace.totalQuestionCount }) }}
{{ $t('chat.training.exam.questionCounter', { current: workspace.currentQuestionNumber, total: workspace.totalQuestionCount }) }}
</h3>
</div>
<div class="flex flex-wrap gap-2 text-sm text-secondary">
@@ -564,12 +575,12 @@ const jumpToExamQuestion = (index: number) => {
<button
type="button"
class="inline-flex items-center gap-2 rounded-xl bg-brand-600 px-4 py-2.5 text-sm font-medium text-white transition hover:bg-brand-700"
@click="workspace.moveToNextQuestion"
@click="workspace.examReadyToSubmit ? workspace.submitExam() : workspace.moveToNextQuestion()"
>
<ClipboardCheck class="h-4 w-4" />
{{
workspace.answeredCount >= workspace.totalQuestionCount
? $t('chat.training.exam.finishExam')
workspace.examReadyToSubmit
? $t('chat.training.exam.submitPaper')
: $t('chat.training.exam.nextQuestion')
}}
</button>