From f6d0f192c74d157b12b9414aa8fdbb9f37635c1b Mon Sep 17 00:00:00 2001
From: tony.cheng <chengmingwei_1984122@126.com>
Date: Fri, 13 Mar 2026 10:25:38 +0800
Subject: [PATCH] fix: 修复当事人类型名称字段兼容性,支持createTime/createdTime/start_time
---
web-app/src/components/common/OutboundCallWidget.jsx | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/web-app/src/components/common/OutboundCallWidget.jsx b/web-app/src/components/common/OutboundCallWidget.jsx
index c10d531..b629583 100644
--- a/web-app/src/components/common/OutboundCallWidget.jsx
+++ b/web-app/src/components/common/OutboundCallWidget.jsx
@@ -335,15 +335,26 @@
// 定时轮询通话状态
useEffect(() => {
+ // 组件挂载时设置为 true
+ isMountedRef.current = true;
+
// 初始加载
fetchCallStatus();
// 设置轮询定时器(10秒间隔)
const interval = setInterval(fetchCallStatus, POLL_INTERVAL);
+ // 监听外呼任务更新事件(立即刷新)
+ const handleOutboundJobsUpdated = () => {
+ console.log('收到外呼任务更新事件,立即刷新');
+ fetchCallStatus();
+ };
+ window.addEventListener('outbound-jobs-updated', handleOutboundJobsUpdated);
+
// 清理函数
return () => {
clearInterval(interval);
+ window.removeEventListener('outbound-jobs-updated', handleOutboundJobsUpdated);
isMountedRef.current = false;
};
}, [fetchCallStatus]);
@@ -384,6 +395,11 @@
// 其他状态的任务正常显示
return true;
});
+
+ // 如果没有活跃任务且不可见,不渲染任何内容
+ if (activeCalls.length === 0 && !isVisible) {
+ return null;
+ }
// 如果最小化,显示AI客服图标
if (isMinimized) {
@@ -555,14 +571,14 @@
{call.errorCode > 0 ? (
// 失败任务显示
<span>
- {call.perClassName || '联系人'}
+ {call.perTypeName || '联系人'}
{call.trueName && `(${call.trueName})`}:
{call.message}
</span>
) : (
- // 成功任务显示
+ // 成功任务显示 - 使用 perTypeName 字段(申请方当事人/被申请方当事人)
<span>
- 正在与{call.perClassName || '申请方'}({call.trueName || call.personId})电话沟通中...
+ 正在与{call.perTypeName || '申请方当事人'}({call.trueName || call.personId})电话沟通中...
</span>
)}
</div>
--
Gitblit v1.8.0