diff --git a/frontend/src/pages/Home.jsx b/frontend/src/pages/Home.jsx index 5c94bf3..3c37a1f 100644 --- a/frontend/src/pages/Home.jsx +++ b/frontend/src/pages/Home.jsx @@ -96,7 +96,26 @@ export default function Home() { }).catch(() => {}) // 获取寻配号统计数据 - fetch('/api/information/seek/stats').then(res => res.json()).then(data => { + // 提交反馈 + const submitFeedback = async () => { + if (!feedbackContent.trim()) return alert('请输入反馈内容') + try { + const res = await fetch('/api/feedback', { + method: 'POST', + headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${localStorage.getItem('token')}` }, + body: JSON.stringify({ content: feedbackContent, contact: feedbackContact }) + }) + const data = await res.json() + if (data.success) { + alert('反馈已提交,感谢您的意见!') + setShowFeedback(false) + setFeedbackContent('') + setFeedbackContact('') + } + } catch (e) { alert('提交失败') } + } + + fetch('/api/information/seek/stats').then(res => res.json()).then(data => { setSeekStats(data || {}) }).catch(() => {}) }, []) @@ -126,6 +145,62 @@ export default function Home() { { label: '总利润', value: formatMoney(stats.totalProfit) + '万', color: stats.totalProfit >= 0 ? '#10b981' : '#f43f5e' } ] + // 反馈弹窗 + if (showFeedback) { + // 反馈弹窗 + if (showFeedback) { + return ( +