diff --git a/frontend/src/views/trainee/practice-records.vue b/frontend/src/views/trainee/practice-records.vue index f77f4ad..3da85e7 100644 --- a/frontend/src/views/trainee/practice-records.vue +++ b/frontend/src/views/trainee/practice-records.vue @@ -283,8 +283,15 @@ -
-
+
+ + + + +
(null) // 筛选表单 @@ -608,9 +616,32 @@ const viewPracticeReport = (record: any) => { /** * 回放陪练对话 */ -const replayPractice = (record: any) => { - currentRecord.value = record - replayDialogVisible.value = true +const replayPractice = async (record: any) => { + try { + // 先设置基本信息并打开弹窗 + currentRecord.value = { ...record, conversation: [] } + replayDialogVisible.value = true + replayLoading.value = true + + // 调用 API 获取对话详情 + const response: any = await practiceApi.getPracticeReport(record.sessionId) + + if (response.code === 200 && response.data?.analysis?.dialogue_review) { + // 转换对话数据格式 + const dialogueReview = response.data.analysis.dialogue_review + currentRecord.value.conversation = dialogueReview.map((item: any) => ({ + role: item.speaker === 'user' ? 'user' : 'ai', + content: item.content, + timestamp: item.time || '', + feedback: item.comment || '' + })) + } + } catch (error: any) { + console.error('获取对话详情失败:', error) + ElMessage.error('获取对话详情失败,请稍后重试') + } finally { + replayLoading.value = false + } } /**