diff --git a/frontend/index.html b/frontend/index.html index bbba12c..fe7027c 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4,7 +4,7 @@ - 甲辰收藏 v1.2.63 + 甲辰收藏 v1.2.64 diff --git a/frontend/src/pages/Home.jsx b/frontend/src/pages/Home.jsx index 3c37a1f..338efbb 100644 --- a/frontend/src/pages/Home.jsx +++ b/frontend/src/pages/Home.jsx @@ -6,9 +6,7 @@ export default function Home() { const [stats, setStats] = useState({ totalCount: 0, totalCost: 0, totalRevenue: 0, expectedProfit: 0, totalProfit: 0, gradedCount: 0 }) const [recentCollections, setRecentCollections] = useState([]) const [yichensStats, setYichensStats] = useState({ total: 0, deals: 0, wants: 0, dragons: 0, horses: 0, tianma: 0 }) - const [seekStats, setSeekStats] = useState({ seekCount: 0, matchedCount: 0 }) const [recentPosts, setRecentPosts] = useState([]) - const [dragonStats, setDragonStats] = useState({}) const [showFeedback, setShowFeedback] = useState(false) const [feedbackContent, setFeedbackContent] = useState('') const [feedbackContact, setFeedbackContact] = useState('') @@ -67,35 +65,6 @@ export default function Home() { setYichensStats(data || {}) }).catch(() => {}) - // 获取最新一尘帖子 - // 提交反馈 - const submitFeedback = async () => { - if (!feedbackContent.trim()) return alert('请输入反馈内容') - try { - const res = await fetch('/api/users/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/yichens/stats/dragons-today').then(res => res.json()).then(data => { - setDragonStats(data || {}) - }).catch(() => {}) - - fetch('/api/yichens/posts?limit=10&offset=0').then(res => res.json()).then(data => { - setRecentPosts(Array.isArray(data) ? data : []) - }).catch(() => {}) - - // 获取寻配号统计数据 // 提交反馈 const submitFeedback = async () => { if (!feedbackContent.trim()) return alert('请输入反馈内容') @@ -115,8 +84,9 @@ export default function Home() { } catch (e) { alert('提交失败') } } - fetch('/api/information/seek/stats').then(res => res.json()).then(data => { - setSeekStats(data || {}) + // 获取最新一尘帖子 + fetch('/api/yichens/posts?limit=10&offset=0').then(res => res.json()).then(data => { + setRecentPosts(Array.isArray(data) ? data : []) }).catch(() => {}) }, []) @@ -133,74 +103,18 @@ export default function Home() { const formatMoney = (val) => { if (!val || val === 0) return '0' const v = val / 10000 - return v.toFixed(1) + return v.toFixed(4) } const statCards = [ - { label: '藏品数', value: stats.totalCount, color: '#3b82f6' }, - { label: '总成本', value: formatMoney(stats.totalCost) + '万', color: '#22c55e' }, - { label: '总收入', value: formatMoney(stats.totalRevenue) + '万', color: '#06b6d4' }, - { label: '评级数', value: stats.gradedCount, color: '#8b5cf6' }, - { label: '预期利润', value: formatMoney(stats.expectedProfit) + '万', color: stats.expectedProfit >= 0 ? '#f59e0b' : '#ef4444' }, - { label: '总利润', value: formatMoney(stats.totalProfit) + '万', color: stats.totalProfit >= 0 ? '#10b981' : '#f43f5e' } + { label: '藏品数', value: stats.totalCount, color: '#3b82f6', icon: '📦' }, + { label: '总成本', value: formatMoney(stats.totalCost) + '万', color: '#22c55e', icon: '💰' }, + { label: '总收入', value: formatMoney(stats.totalRevenue) + '万', color: '#06b6d4', icon: '📈' }, + { label: '评级数', value: stats.gradedCount, color: '#8b5cf6', icon: '⭐' }, + { label: '预期利润', value: formatMoney(stats.expectedProfit) + '万', color: stats.expectedProfit >= 0 ? '#f59e0b' : '#ef4444', icon: '🎯' }, + { label: '总利润', value: formatMoney(stats.totalProfit) + '万', color: stats.totalProfit >= 0 ? '#10b981' : '#f43f5e', icon: '💵' } ] - // 反馈弹窗 - if (showFeedback) { - // 反馈弹窗 - if (showFeedback) { - return ( -
-
-
联系我们
-