From 4c1b70e9d6151129d129b162a4156001d33cca6a Mon Sep 17 00:00:00 2001 From: yuliang_guo Date: Tue, 3 Feb 2026 16:27:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=99=AA=E7=BB=83?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=9B=9E=E6=94=BE=E5=AF=B9=E8=AF=9D=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 回放对话时调用 API 获取对话详情 - 添加加载状态显示 - 添加空数据提示 Co-authored-by: Cursor --- .../src/views/trainee/practice-records.vue | 41 ++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) 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 + } } /**