feat(practice): complete five-position training operations

This commit is contained in:
2026-07-24 00:26:27 +08:00
parent 067cc30d80
commit faa2a77e9a
15 changed files with 1357 additions and 77 deletions
+7 -2
View File
@@ -180,7 +180,7 @@
<view class="chat-head">
<view class="chat-head-row">
<text class="chat-title">{{ activeScenarioName }}</text>
<text class="chat-context">{{ realtimeActive ? `实时 · ${realtimeStatusLabel}` : `第 ${Math.min(roundIndex + 1, 3)}/3 轮` }}</text>
<text class="chat-context">{{ realtimeActive ? `实时 · ${realtimeStatusLabel}` : `第 ${Math.min(roundIndex + 1, activeRoundCount)}/${activeRoundCount} 轮` }}</text>
</view>
<view v-if="hasCoachState" class="coach-strip">
<view class="coach-metric">
@@ -425,6 +425,7 @@ const storedRealtimeVoice = uni.getStorageSync(realtimeVoiceStorageKey);
const status = ref<PracticeStatus>('idle');
const sessionId = ref('');
const roundIndex = ref(0);
const activeRoundCount = ref(3);
const draft = ref('');
const message = ref('');
const turns = ref<PracticeTurn[]>([]);
@@ -508,7 +509,7 @@ const practicePageTitle = computed(() => {
});
const practicePageSubtitle = computed(() => {
if (practiceView.value === 'result') return `${activeScenarioName.value} · ${Math.max(roundIndex.value, 1)} 轮对话`;
if (practiceView.value === 'active') return `${activeScenarioName.value} · 第 ${Math.min(roundIndex.value + 1, 3)}/3 轮`;
if (practiceView.value === 'active') return `${activeScenarioName.value} · 第 ${Math.min(roundIndex.value + 1, activeRoundCount.value)}/${activeRoundCount.value} 轮`;
return '先掌握要点,再开始场景练习';
});
const canStartPractice = computed(() => status.value === 'idle' || status.value === 'finished');
@@ -794,6 +795,7 @@ const clearPracticeData = () => {
satisfactionSubmitted.value = false;
sessionId.value = '';
roundIndex.value = 0;
activeRoundCount.value = 3;
draft.value = '';
status.value = 'idle';
selectedScenarioId.value = defaultScenarioId;
@@ -1284,6 +1286,7 @@ const start = async (scenarioId = defaultScenarioId, assignmentId?: number) => {
trustScore.value = 0;
redFlagActive.value = false;
roundIndex.value = 0;
activeRoundCount.value = 3;
activeAssignmentId.value = assignmentId;
try {
const data = await startPractice(scenarioId, assignmentId);
@@ -1291,6 +1294,7 @@ const start = async (scenarioId = defaultScenarioId, assignmentId?: number) => {
activeScenarioName.value = data.scenarioName || activeScenarioName.value;
emotionScore.value = data.emotion ?? 0;
trustScore.value = data.trust ?? 0;
activeRoundCount.value = Math.max(2, Math.min(6, data.roundCount || 3));
sessionId.value = data.sessionId;
appendTurn('customer', data.customerText, data.emotion, true, 0);
status.value = 'active';
@@ -1416,6 +1420,7 @@ const submit = async () => {
return;
}
if (data.finished) {
roundIndex.value = data.roundIndex;
await finish(true);
return;
}