diff --git a/config/VERSION.json b/config/VERSION.json
index 8850437..0cbfdb3 100644
--- a/config/VERSION.json
+++ b/config/VERSION.json
@@ -16,7 +16,7 @@
"News_YichensBoard": "0.0.1",
"Settings": "0.0.1",
"Stats": "0.0.1",
- "YichensBoard": "0.0.1"
+ "YichensBoard": "0.0.2"
},
"config": {
"version": "0.0.1"
diff --git a/frontend/src/pages/YichensBoard.jsx b/frontend/src/pages/YichensBoard.jsx
index fb1c2f4..f01b819 100644
--- a/frontend/src/pages/YichensBoard.jsx
+++ b/frontend/src/pages/YichensBoard.jsx
@@ -1,7 +1,7 @@
/**
* YichensBoard - 一尘看板页面
- * Version: 0.0.1x
- * 更新:
+ * Version: 0.0.2
+ * 更新:新增号码特色筛选按钮(带4、无4、无47等)
*/
import React, { useState, useEffect } from 'react'
@@ -15,6 +15,7 @@ export default function YichensBoard() {
const [expandedPosts, setExpandedPosts] = useState({})
const [postTypeFilter, setPostTypeFilter] = useState('all')
const [categoryFilter, setCategoryFilter] = useState('')
+ const [numberFilter, setNumberFilter] = useState('')
const [page, setPage] = useState(1)
const [totalPosts, setTotalPosts] = useState(0)
const [searchKeyword, setSearchKeyword] = useState('')
@@ -75,187 +76,23 @@ export default function YichensBoard() {
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 === '蛇') {
- 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('马'))
+ // 号码特色筛选(根据标题和内容关键字)
+ if (numberFilter && Array.isArray(data)) {
+ const filterKeywords = {
+ '带4': ['带4', '带四', '通货', '标四'],
+ '无4': ['无4', '无四', '带7'],
+ '无47': ['无47', '无四七', '永恒'],
+ '无247': ['无247', '无二四七', '天马', '金山'],
+ '无347': ['无347', '无三四七', '钻石', '如意', '朦胧', '金马'],
+ '年份': ['年份', '生日', '生日号', '纪念'],
+ '特色': ['倒置', '圆圆', '豹子', '老虎', '狮子', '大象', '龙三', '龙二']
+ }
+ const kw = filterKeywords[numberFilter] || []
+ if (kw.length > 0) {
+ data = data.filter(p => {
+ const text = (p.title || '') + (p.content || '') + (p.description || '')
+ return kw.some(k => text.includes(k))
+ })
}
}
- // 支持新格式 {posts:[], total:xxx} 或旧格式 [{},{}]
- const postsArray = Array.isArray(data) ? data : (data.posts || [])
- const totalCount = data.total || todayStats.total || postsArray.length
- setPosts(postsArray)
- setTotalPosts(totalCount)
- } catch(e) {
- console.error('YichensBoard: fetchPosts error', e)
- setError(e.message)
- setPosts([])
- } finally {
- setLoading(false)
- }
- }
-
- useEffect(() => {
- if (todayStats.total > 0) {
- fetchPosts(1, categoryFilter, searchKeyword)
- }
- }, [todayStats, categoryFilter, postTypeFilter])
-
- useEffect(() => {
- setPage(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',
- textAlign: 'center'
- }}>
-
{label}
-
{value}
-
- )
-
- if (error) {
- return (
-
-
加载失败: {error}
-
-
- )
- }
-
- return (
-
-
-
- 📈 连体钞/纪念钞 {dateStr}
-
-
- { setPostTypeFilter('all'); setCategoryFilter(''); setPage(1); }} />
- { setPostTypeFilter('deal'); setCategoryFilter(''); setPage(1); }} />
- { setPostTypeFilter('want'); setCategoryFilter(''); setPage(1); }} />
- { setPostTypeFilter('other'); setCategoryFilter(''); setPage(1); }} />
-
-
-
-
-
📊 今日分类统计
-
龙: {todayStats.dragons || 0} | 马: {todayStats.horses || 0} | 蛇: {todayStats.snakes || 0} | 天马: {todayStats.tianma || 0}
-
-
-
-
- { const kw = e.target.value; setSearchKeyword(kw); setPage(1); fetchPosts(1, '', kw) }}
- style={{ flex: 1, padding: '10px 14px', borderRadius: 8, border: '1px solid #374151', background: '#1f2937', color: '#fff', fontSize: 13, outline: 'none' }}
- />
-
-
- {searchKeyword &&
搜索: "{searchKeyword}",共找到 {totalPosts} 条结果
}
-
-
-
- {[{key:'all',label:'全部'},{key:'deal',label:'出售'},{key:'want',label:'求购'},{key:'other',label:'其他'}].map(k => (
-
- ))}
-
-
-
- {[{key:'',label:'全部'},{key:'龙',label:'龙钞'},{key:'蛇',label:'蛇钞'},{key:'马',label:'马钞'},{key:'其他',label:'其他'}].map(k => (
-
- ))}
-
-
- {loading ?
加载中...
: (
-
-
- {posts.length === 0 ? (
-
暂无帖子数据
- ) : (
- posts.map(post => (
-
-
togglePost(post.post_id)} style={{ cursor: 'pointer' }}>
-
-
{post.title||'无标题'}
-
-
- {post.post_type==='deal'?'出售':post.post_type==='want'?'求购':post.post_type==='normal'?'其他':'普通'}
-
-
- {post.category || '-'}
-
-
-
-
- {post.author_username||'未知'}
- {post.post_time?.substring(0,16)||''}
-
-
- {expandedPosts[post.post_id] && post.content && (
-
-
- {post.content}
-
- {post.url &&
查看原帖}
-
- )}
-
- ))
- )}
-
-
-
-
- 共 {totalPosts} 条结果,{Math.ceil(totalPosts / 390)} 页,当前第 {page} 页
-
-
- {page > 1 ? (
-
- ) : (
- 上一页
- )}
- {posts.length >= 390 && totalPosts > page * 390 ? (
-
- ) : (
- 下一页
- )}
-
-
-
- )}
-
- )
-}
+ // 确保data是数组