v0.1.8 - 行情页新增成交行情筛选功能(版别、包装类型、号码分类)
This commit is contained in:
parent
3eb8aac2be
commit
87da78d6d8
|
|
@ -1 +1 @@
|
||||||
VERSION=v0.0.7
|
VERSION=v0.1.8
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* News - 资讯列表页面
|
* News - 资讯列表页面
|
||||||
* Version: 0.0.8 (2026-04-24)
|
* Version: 0.0.9 (2026-05-01)
|
||||||
* 稳定版:自有匹配+网络匹配缓存
|
* 稳定版:自有匹配+网络匹配缓存
|
||||||
|
* 更新:成交行情页面新增筛选功能(版别、包装类型、号码分类)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
|
|
@ -39,6 +40,8 @@ export default function News() {
|
||||||
const [matchedStatus, setMatchedStatus] = useState({}) // 存储各寻号的匹配状态
|
const [matchedStatus, setMatchedStatus] = useState({}) // 存储各寻号的匹配状态
|
||||||
const [showMatchList, setShowMatchList] = useState(false)
|
const [showMatchList, setShowMatchList] = useState(false)
|
||||||
const [dealVersion, setDealVersion] = useState('龙钞')
|
const [dealVersion, setDealVersion] = useState('龙钞')
|
||||||
|
const [dealPackagingFilter, setDealPackagingFilter] = useState('') // 包装类型筛选
|
||||||
|
const [dealNumberCatFilter, setDealNumberCatFilter] = useState('') // 号码分类筛选
|
||||||
const [dealDate, setDealDate] = useState('')
|
const [dealDate, setDealDate] = useState('')
|
||||||
const [dealDetailItems, setDealDetailItems] = useState(null) // 弹窗显示的详情列表
|
const [dealDetailItems, setDealDetailItems] = useState(null) // 弹窗显示的详情列表
|
||||||
const [matchCollections, setMatchCollections] = useState([])
|
const [matchCollections, setMatchCollections] = useState([])
|
||||||
|
|
@ -558,6 +561,22 @@ export default function News() {
|
||||||
else if (serial.startsWith('J1')) version = '马钞'
|
else if (serial.startsWith('J1')) version = '马钞'
|
||||||
else if (serial.startsWith('J3')) version = '蛇钞'
|
else if (serial.startsWith('J3')) version = '蛇钞'
|
||||||
if (version !== dealVersion) return false
|
if (version !== dealVersion) return false
|
||||||
|
|
||||||
|
// 包装类型筛选
|
||||||
|
if (dealPackagingFilter) {
|
||||||
|
const content = item.content || ''
|
||||||
|
const p = content.includes('包装:') ? content.split('包装:')[1].split('\n')[0].trim() : (item.packaging || '')
|
||||||
|
if (p !== dealPackagingFilter) return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 号码分类筛选
|
||||||
|
if (dealNumberCatFilter) {
|
||||||
|
const content = item.content || ''
|
||||||
|
let c = content.includes('分类:') ? content.split('分类:')[1].split('\n')[0].trim() : (item.category || '')
|
||||||
|
c = normalizeCat(c)
|
||||||
|
if (c !== dealNumberCatFilter) return false
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -577,6 +596,8 @@ export default function News() {
|
||||||
return (
|
return (
|
||||||
<div style={{ background: '#1e293b', borderRadius: '12px', padding: '16px', marginBottom: '12px' }}>
|
<div style={{ background: '#1e293b', borderRadius: '12px', padding: '16px', marginBottom: '12px' }}>
|
||||||
<div style={{ marginBottom: '16px' }}>
|
<div style={{ marginBottom: '16px' }}>
|
||||||
|
{/* 版别筛选 */}
|
||||||
|
<div style={{ color: '#94a3b8', fontSize: '11px', marginBottom: '8px' }}>版别筛选:</div>
|
||||||
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', marginBottom: '12px' }}>
|
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', marginBottom: '12px' }}>
|
||||||
{versions.map(v => (
|
{versions.map(v => (
|
||||||
<button key={v} onClick={() => setDealVersion(v)}
|
<button key={v} onClick={() => setDealVersion(v)}
|
||||||
|
|
@ -587,6 +608,52 @@ export default function News() {
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* 包装类型筛选 */}
|
||||||
|
<div style={{ color: '#94a3b8', fontSize: '11px', marginBottom: '8px' }}>包装筛选:</div>
|
||||||
|
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap', marginBottom: '12px' }}>
|
||||||
|
{[{value: '', label: '全部'}, ...packagings.map(p => ({value: p, label: p}))].map(item => (
|
||||||
|
<button key={item.value} onClick={() => setDealPackagingFilter(item.value)}
|
||||||
|
style={{ padding: '4px 12px', borderRadius: '6px', border: 'none', cursor: 'pointer',
|
||||||
|
background: dealPackagingFilter === item.value ? '#8b5cf6' : 'rgba(255,255,255,0.1)',
|
||||||
|
color: '#fff', fontSize: '12px' }}>
|
||||||
|
{item.label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 号码分类筛选 */}
|
||||||
|
<div style={{ color: '#94a3b8', fontSize: '11px', marginBottom: '8px' }}>号码分类:</div>
|
||||||
|
<div style={{ display: 'flex', gap: '6px', flexWrap: 'wrap', marginBottom: '12px' }}>
|
||||||
|
{[
|
||||||
|
{value: '', label: '全部'},
|
||||||
|
{value: '带4号', label: '带4号'},
|
||||||
|
{value: '带7号', label: '带7号'},
|
||||||
|
{value: '永恒号', label: '永恒'},
|
||||||
|
{value: '钻石号', label: '钻石'},
|
||||||
|
{value: '天马号', label: '天马'},
|
||||||
|
{value: '金山号', label: '金山'},
|
||||||
|
{value: '金马号', label: '金马'},
|
||||||
|
{value: '倒置号', label: '倒置'},
|
||||||
|
{value: '圆圆号', label: '圆圆'}
|
||||||
|
].map(item => (
|
||||||
|
<button key={item.value} onClick={() => setDealNumberCatFilter(item.value)}
|
||||||
|
style={{ padding: '4px 10px', borderRadius: '6px', border: 'none', cursor: 'pointer',
|
||||||
|
background: dealNumberCatFilter === item.value ? '#22c55e' : 'rgba(255,255,255,0.08)',
|
||||||
|
color: '#fff', fontSize: '11px' }}>
|
||||||
|
{item.label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* 清除筛选 */}
|
||||||
|
{(dealPackagingFilter || dealNumberCatFilter) && (
|
||||||
|
<button onClick={() => { setDealPackagingFilter(''); setDealNumberCatFilter(''); }}
|
||||||
|
style={{ padding: '4px 10px', borderRadius: '6px', border: 'none', cursor: 'pointer',
|
||||||
|
background: 'rgba(239,68,68,0.2)', color: '#ef4444', fontSize: '11px' }}>
|
||||||
|
✕ 清除筛选
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ overflowX: 'auto' }}>
|
<div style={{ overflowX: 'auto' }}>
|
||||||
|
|
@ -696,7 +763,42 @@ export default function News() {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{infoList.map(item => {
|
{infoList.filter(item => {
|
||||||
|
// 成交行情 tab - 应用筛选
|
||||||
|
if (activeTab === 'deal') {
|
||||||
|
const content = item.content || ''
|
||||||
|
const serial = (item.title || '').split('-')[0] || ''
|
||||||
|
|
||||||
|
// 版别筛选
|
||||||
|
let version = '其他'
|
||||||
|
if (serial.startsWith('J0')) version = '龙钞'
|
||||||
|
else if (serial.startsWith('J1')) version = '马钞'
|
||||||
|
else if (serial.startsWith('J3')) version = '蛇钞'
|
||||||
|
if (version !== dealVersion) return false
|
||||||
|
|
||||||
|
// 包装类型筛选
|
||||||
|
const packagingMatch = content.match(/包装:\s*(.+?)(?:\n|$)/)
|
||||||
|
const packaging = packagingMatch ? packagingMatch[1].trim() : (item.packaging || '')
|
||||||
|
if (dealPackagingFilter && packaging !== dealPackagingFilter) return false
|
||||||
|
|
||||||
|
// 号码分类筛选
|
||||||
|
const categoryMatch = content.match(/分类:\s*(.+?)(?:\n|$)/)
|
||||||
|
let category = categoryMatch ? categoryMatch[1].trim() : (item.category || '')
|
||||||
|
// 标准化分类名
|
||||||
|
if (category === '通货' || category === '无4') category = '带4号'
|
||||||
|
if (category === '永恒') category = '永恒号'
|
||||||
|
if (category === '钻石') category = '钻石号'
|
||||||
|
if (category === '天马' || category === '天马号') category = '天马号'
|
||||||
|
if (category === '金山' || category === '金山号') category = '金山号'
|
||||||
|
if (category === '金马' || category === '金马号') category = '金马号'
|
||||||
|
if (category === '倒置') category = '倒置号'
|
||||||
|
if (category === '圆圆') category = '圆圆号'
|
||||||
|
if (dealNumberCatFilter && category !== dealNumberCatFilter) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}).map(item => {
|
||||||
// 成交行情 tab - 按维度汇总展示
|
// 成交行情 tab - 按维度汇总展示
|
||||||
if (activeTab === 'deal') {
|
if (activeTab === 'deal') {
|
||||||
const content = item.content || ''
|
const content = item.content || ''
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue