修复useState位置
This commit is contained in:
parent
0093367452
commit
615be9805b
|
|
@ -32,6 +32,8 @@ export default function News() {
|
|||
const [comments, setComments] = useState({}) // 存储各寻号的评论
|
||||
const [matchedStatus, setMatchedStatus] = useState({}) // 存储各寻号的匹配状态
|
||||
const [showMatchList, setShowMatchList] = useState(false)
|
||||
const [dealVersion, setDealVersion] = useState('龙钞')
|
||||
const [dealDate, setDealDate] = useState('')
|
||||
const [matchCollections, setMatchCollections] = useState([])
|
||||
const [networkMatchCollections, setNetworkMatchCollections] = useState([])
|
||||
const [showNetworkMatchList, setShowNetworkMatchList] = useState(false)
|
||||
|
|
@ -483,9 +485,6 @@ export default function News() {
|
|||
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
||||
{/* 成交行情 - 价格统计表格 */}
|
||||
{activeTab === 'deal' && (() => {
|
||||
const [selectedVersion, setSelectedVersion] = useState('龙钞')
|
||||
const [selectedDate, setSelectedDate] = useState('')
|
||||
|
||||
const versions = ['龙钞', '马钞', '蛇钞', '其他']
|
||||
const packagings = ['标百', '标十', '单张']
|
||||
const categories = ['带4号', '带7号', '永恒号', '钻石号', '如意号', '朦胧号', '天马号', '金山号', '金马号']
|
||||
|
|
@ -496,10 +495,10 @@ export default function News() {
|
|||
if (serial.startsWith('J0')) version = '龙钞'
|
||||
else if (serial.startsWith('J1')) version = '马钞'
|
||||
else if (serial.startsWith('J3')) version = '蛇钞'
|
||||
if (version !== selectedVersion) return false
|
||||
if (selectedDate) {
|
||||
const dealDate = item.deal_date || ''
|
||||
if (!dealDate.startsWith(selectedDate)) return false
|
||||
if (version !== dealVersion) return false
|
||||
if (dealDate) {
|
||||
const itemDate = item.deal_date || ''
|
||||
if (!itemDate.startsWith(dealDate)) return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
|
@ -521,15 +520,15 @@ export default function News() {
|
|||
<div style={{ marginBottom: '16px' }}>
|
||||
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', marginBottom: '12px' }}>
|
||||
{versions.map(v => (
|
||||
<button key={v} onClick={() => setSelectedVersion(v)}
|
||||
<button key={v} onClick={() => setDealVersion(v)}
|
||||
style={{ padding: '6px 16px', borderRadius: '8px', border: 'none', cursor: 'pointer',
|
||||
background: selectedVersion === v ? '#3b82f6' : 'rgba(255,255,255,0.1)',
|
||||
color: '#fff', fontSize: '13px', fontWeight: selectedVersion === v ? '600' : '400' }}>
|
||||
background: dealVersion === v ? '#3b82f6' : 'rgba(255,255,255,0.1)',
|
||||
color: '#fff', fontSize: '13px', fontWeight: dealVersion === v ? '600' : '400' }}>
|
||||
{v}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<select value={selectedDate} onChange={e => setSelectedDate(e.target.value)}
|
||||
<select value={dealDate} onChange={e => setDealDate(e.target.value)}
|
||||
style={{ padding: '8px 12px', borderRadius: '8px', border: '1px solid rgba(255,255,255,0.2)',
|
||||
background: 'rgba(255,255,255,0.05)', color: '#fff', fontSize: '14px' }}>
|
||||
<option value="">全部日期</option>
|
||||
|
|
@ -564,7 +563,7 @@ export default function News() {
|
|||
<td key={i} style={{ padding: '8px', textAlign: 'center', borderBottom: '1px solid rgba(255,255,255,0.05)' }}>
|
||||
{d ? (
|
||||
<div style={{ color: '#22c55e', fontWeight: '600', cursor: 'pointer' }}
|
||||
onClick={() => alert(`${selectedVersion} ${cat} ${packagings[i]} 平均价¥${d.avg.toLocaleString()}, 共${d.count}笔`)}>
|
||||
onClick={() => alert(`${dealVersion} ${cat} ${packagings[i]} 平均价¥${d.avg.toLocaleString()}, 共${d.count}笔`)}>
|
||||
¥{d.avg.toLocaleString()}
|
||||
<span style={{ color: '#64748b', fontSize: '11px', marginLeft: '4px' }}>({d.count})</span>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue