diff --git a/frontend/sidebar/src/SummaryApp.tsx b/frontend/sidebar/src/SummaryApp.tsx index 1a1d87c..c0b6b0a 100644 --- a/frontend/sidebar/src/SummaryApp.tsx +++ b/frontend/sidebar/src/SummaryApp.tsx @@ -76,6 +76,7 @@ function SummaryApp() { const [bindPhone, setBindPhone] = useState('') const [bindWechatId, setBindWechatId] = useState('') const [bindSaving, setBindSaving] = useState(false) + const [contactInfo, setContactInfo] = useState<{ phone: string; wechatId: string } | null>(null) useEffect(() => { const init = async () => { @@ -240,6 +241,7 @@ function SummaryApp() { return } setCustomerId(customerId) + loadContactInfo(customerId) try { const res = await fetch( @@ -272,6 +274,18 @@ function SummaryApp() { } } + const loadContactInfo = async (cid: string) => { + try { + const res = await noCacheFetch(`/api/v1/archive/customer/contact?customerId=${encodeURIComponent(cid)}`) + const data = await res.json() + if (data.code === 0 && data.data) { + setContactInfo({ phone: data.data.phone || '', wechatId: data.data.wechatId || '' }) + } + } catch (e) { + console.error('加载绑定状态失败:', e) + } + } + const loadRecentChat = async (customerId: string, staffId: string) => { try { const res = await noCacheFetch( @@ -323,6 +337,7 @@ function SummaryApp() { if (data.code === 0) { Toast.show({ content: '绑定成功', icon: 'success' }) setBindVisible(false) + setContactInfo({ phone, wechatId }) } else { Toast.show({ content: data.message || '绑定失败', icon: 'fail' }) } @@ -439,6 +454,9 @@ function SummaryApp() { ) } + const isBound = !!(contactInfo && (contactInfo.phone || contactInfo.wechatId)) + const maskPhone = (p: string) => (p && p.length === 11 ? `${p.slice(0, 3)}****${p.slice(7)}` : p) + if (loading) { return (
@@ -501,7 +519,17 @@ function SummaryApp() {
+ {isBound && contactInfo && ( +
+ ✅ 该学员已绑定联系方式,如需修改请点击右上角按钮 + + {contactInfo.phone && `手机:${maskPhone(contactInfo.phone)}`} + {contactInfo.phone && contactInfo.wechatId && ' / '} + {contactInfo.wechatId && `微信:${contactInfo.wechatId}`} + +
+ )} + {/* 立即总结(实时流式) */}
- 绑定联系方式 + {isBound ? '修改联系方式' : '绑定联系方式'}
绑定后运营可通过手机号或微信号查询该学员的每日总结