diff --git a/config/VERSION b/config/VERSION index 24ca32d..8a27477 100644 --- a/config/VERSION +++ b/config/VERSION @@ -1 +1 @@ -VERSION=1.2.77 +VERSION=1.2.79 diff --git a/frontend/index.html b/frontend/index.html index 39c6905..803dee4 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4,7 +4,7 @@ - 甲辰收藏 v=1.2.72 + 甲辰收藏 v=1.2.78 diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 156d83c..95c053e 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "jiachenlong-frontend", - "version": "1.2.12", + "version": "1.2.72", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "jiachenlong-frontend", - "version": "1.2.12", + "version": "1.2.72", "dependencies": { "axios": "^1.7.9", "react": "^18.3.1", diff --git a/frontend/src/pages/Home.jsx b/frontend/src/pages/Home.jsx index 96d97c5..6c38011 100644 --- a/frontend/src/pages/Home.jsx +++ b/frontend/src/pages/Home.jsx @@ -127,7 +127,7 @@ export default function Home() {
甲辰收藏
-
{user?.username || '用户'}
+
{user?.username || '用户'} ID:{user?.user_code || '-'}
欢迎回来 👋
diff --git a/frontend/src/pages/YichensBoard.jsx b/frontend/src/pages/YichensBoard.jsx index 802cc0b..85d80e0 100644 --- a/frontend/src/pages/YichensBoard.jsx +++ b/frontend/src/pages/YichensBoard.jsx @@ -53,8 +53,28 @@ export default function YichensBoard() { const res = await fetch(url) if (!res.ok) throw new Error('posts API error: ' + res.status) let data = await res.json() || [] + // 确保data是数组 + if (!Array.isArray(data)) { + data = data.posts || data.data || [] + } console.log('YichensBoard: posts data count', data.length) - if (currentCat) { + if (currentCat && Array.isArray(data)) { + if (currentCat === '龙') { + data = data.filter(p => p.category && (p.category.includes('龙') || p.category.includes('纪念钞'))) + } else if (currentCat === '蛇') { + data = data.filter(p => p.category && p.category.includes('蛇')) + } else if (currentCat === '马') { + data = data.filter(p => p.category && p.category.includes('马')) + } else if (currentCat === '其他') { + data = data.filter(p => p.category && !p.category.includes('龙') && !p.category.includes('纪念钞') && !p.category.includes('蛇') && !p.category.includes('马')) + } + } + // 确保data是数组 + if (!Array.isArray(data)) { + data = data.posts || data.data || [] + } + console.log('YichensBoard: posts data count', data.length) + if (currentCat && Array.isArray(data)) { if (currentCat === '龙') { data = data.filter(p => p.category && (p.category.includes('龙') || p.category.includes('纪念钞'))) } else if (currentCat === '蛇') { @@ -66,7 +86,7 @@ export default function YichensBoard() { } } // 支持新格式 {posts:[], total:xxx} 或旧格式 [{},{}] - const postsArray = data.posts || data + const postsArray = Array.isArray(data) ? data : (data.posts || []) const totalCount = data.total || todayStats.total || postsArray.length setPosts(postsArray) setTotalPosts(totalCount) @@ -74,26 +94,27 @@ export default function YichensBoard() { console.error('YichensBoard: fetchPosts error', e) setError(e.message) setPosts([]) + } finally { + setLoading(false) } - setLoading(false) } useEffect(() => { if (todayStats.total > 0) { - // fetchTodayCategory() - fetchPosts(1, '') + fetchPosts(1, categoryFilter, searchKeyword) } - }, [todayStats]) + }, [todayStats, categoryFilter, postTypeFilter]) useEffect(() => { setPage(1) - fetchPosts(1, '') + fetchPosts(1, categoryFilter, searchKeyword) }, [searchKeyword]) const togglePost = id => setExpandedPosts(p => ({ ...p, [id]: !p[id] })) const StatCard = ({ label, value, color, onClick }) => ( -
{ setLoading(true); if (onClick) onClick(); }} + style={{ background: 'linear-gradient(145deg, #1f2937 0%, #111827 100%)', borderRadius: 12, padding: '12px 8px', border: '1px solid #374151', cursor: onClick ? 'pointer' : 'default', @@ -122,10 +143,10 @@ export default function YichensBoard() { 📈 连体钞/纪念钞 {dateStr}
- { setPostTypeFilter('all'); setCategoryFilter(''); setPage(1); fetchPosts(1, '') }} /> - { setPostTypeFilter('deal'); setCategoryFilter(''); setPage(1); fetchPosts(1, '') }} /> - { setPostTypeFilter('want'); setCategoryFilter(''); setPage(1); fetchPosts(1, '') }} /> - { setPostTypeFilter('other'); setCategoryFilter(''); setPage(1); fetchPosts(1, '') }} /> + { setPostTypeFilter('all'); setCategoryFilter(''); setPage(1); }} /> + { setPostTypeFilter('deal'); setCategoryFilter(''); setPage(1); }} /> + { setPostTypeFilter('want'); setCategoryFilter(''); setPage(1); }} /> + { setPostTypeFilter('other'); setCategoryFilter(''); setPage(1); }} />
@@ -154,7 +175,7 @@ export default function YichensBoard() {
{[{key:'all',label:'全部'},{key:'deal',label:'出售'},{key:'want',label:'求购'},{key:'other',label:'其他'}].map(k => ( -