diff --git a/config/VERSION b/config/VERSION index f6594fa..0c9e143 100644 --- a/config/VERSION +++ b/config/VERSION @@ -1 +1 @@ -VERSION=1.2.45 +VERSION=1.2.46 diff --git a/frontend/index.html b/frontend/index.html index cdce529..81ca7b3 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4,7 +4,7 @@ - 甲辰收藏 v1.2.45 + 甲辰收藏 v1.2.46 diff --git a/frontend/src/pages/Home.jsx b/frontend/src/pages/Home.jsx index 19770b4..816ccb6 100644 --- a/frontend/src/pages/Home.jsx +++ b/frontend/src/pages/Home.jsx @@ -6,6 +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 [recentPosts, setRecentPosts] = useState([]) const currentPath = window.location.hash.slice(1) || '/' useEffect(() => { @@ -60,6 +61,11 @@ export default function Home() { fetch('/api/yichens/stats/today').then(res => res.json()).then(data => { setYichensStats(data || {}) }).catch(() => {}) + + // 获取最新一尘帖子 + fetch('/api/yichens/posts?limit=10&offset=0').then(res => res.json()).then(data => { + setRecentPosts(Array.isArray(data) ? data : []) + }).catch(() => {}) }, []) // 检查是否为管理员 @@ -146,37 +152,6 @@ export default function Home() { ))} - {/* 一尘看板数据 */} -
-
📊 一尘今日数据
-
-
-
{yichensStats.total || 0}
-
总帖子
-
-
-
{yichensStats.deals || 0}
-
出售
-
-
-
{yichensStats.wants || 0}
-
求购
-
-
-
{yichensStats.dragons || 0}
-
龙钞
-
-
-
{yichensStats.horses || 0}
-
马钞
-
-
-
{yichensStats.tianma || 0}
-
天马
-
-
-
- {/* 快捷操作 */}
快捷操作
@@ -214,11 +189,42 @@ export default function Home() {
- {/* 最近藏品 */} + {/* 一尘今日数据 */} +
+
📊 一尘今日数据
+
+
+
{yichensStats.total || 0}
+
总帖子
+
+
+
{yichensStats.deals || 0}
+
出售
+
+
+
{yichensStats.wants || 0}
+
求购
+
+
+
{yichensStats.dragons || 0}
+
龙钞
+
+
+
{yichensStats.horses || 0}
+
马钞
+
+
+
{yichensStats.tianma || 0}
+
天马
+
+
+
+ + {/* 最新一尘发帖 */}
-
最近藏品
-
window.location.hash = '#/list'} style={{ color: '#3b82f6', fontSize: '12px', cursor: 'pointer' }}>查看全部 →
+
📝 最新一尘发帖
+
window.location.hash = '#/news'} style={{ color: '#3b82f6', fontSize: '12px', cursor: 'pointer' }}>查看全部 →
- {recentCollections.length === 0 ? ( -
暂无藏品
+ {recentPosts.length === 0 ? ( +
暂无帖子
) : ( - recentCollections.map((item, idx) => ( -
window.location.hash = '#/detail?id=' + item.id} style={{ + recentPosts.map((item, idx) => ( +
window.location.hash = '#/news'} style={{ padding: '12px 16px', - borderBottom: idx < recentCollections.length - 1 ? '1px solid rgba(255,255,255,0.05)' : 'none', + borderBottom: idx < recentPosts.length - 1 ? '1px solid rgba(255,255,255,0.05)' : 'none', cursor: 'pointer', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}> -
-
{item.code || '-'} {item.prefixSerial || ''}
-
{item.version || '-'} · {item.status === 'sold' ? '已售' : item.status === 'in_collection' ? '收藏中' : item.status}
+
+
{item.title || '无标题'}
+
{item.category || '-'} · {item.author_username || '未知'} · {item.post_time?.substring(0, 16) || ''}
-
- {item.costPrice ? '¥' + item.costPrice : '-'} +
+ {item.post_type === 'deal' ? '出售' : item.post_type === 'want' ? '求购' : '其他'}
))