修改为显示最新成交数据
This commit is contained in:
parent
f7fd2ee77d
commit
d18e269193
|
|
@ -38,9 +38,8 @@ export default function Home() {
|
||||||
|
|
||||||
// 获取今日成交数据
|
// 获取今日成交数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const today = new Date()
|
// 获取最新成交数据
|
||||||
const dealDate = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`
|
fetch(`/api/information/list?info_type=deal&page_size=500`)
|
||||||
fetch(`/api/information/list?info_type=deal&deal_date=${dealDate}&page_size=500`)
|
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (Array.isArray(data)) {
|
if (Array.isArray(data)) {
|
||||||
|
|
@ -301,7 +300,7 @@ export default function Home() {
|
||||||
{/* 今日成交数据统计 */}
|
{/* 今日成交数据统计 */}
|
||||||
{dealStats.total > 0 && (
|
{dealStats.total > 0 && (
|
||||||
<div style={{ marginBottom: '20px' }}>
|
<div style={{ marginBottom: '20px' }}>
|
||||||
<div style={{ color: 'rgba(255,255,255,0.7)', fontSize: '14px', marginBottom: '12px', paddingLeft: '4px' }}>📈 当日成交信息统计(均价)</div>
|
<div style={{ color: 'rgba(255,255,255,0.7)', fontSize: '14px', marginBottom: '12px', paddingLeft: '4px' }}>📈 最新成交信息统计(均价)</div>
|
||||||
<div style={{ background: '#1e293b', borderRadius: '12px', padding: '16px' }}>
|
<div style={{ background: '#1e293b', borderRadius: '12px', padding: '16px' }}>
|
||||||
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', marginBottom: '12px' }}>
|
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', marginBottom: '12px' }}>
|
||||||
{['龙钞', '马钞', '蛇钞', '其他'].map(v => (
|
{['龙钞', '马钞', '蛇钞', '其他'].map(v => (
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ export default function News() {
|
||||||
// 获取资讯列表
|
// 获取资讯列表
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchInfoList()
|
fetchInfoList()
|
||||||
}, [activeTab, dealDate])
|
}, [activeTab])
|
||||||
|
|
||||||
// 自动生成寻号标题
|
// 自动生成寻号标题
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -87,14 +87,7 @@ export default function News() {
|
||||||
const headers = token ? { Authorization: `Bearer ${token}` } : {}
|
const headers = token ? { Authorization: `Bearer ${token}` } : {}
|
||||||
|
|
||||||
// 构建URL参数
|
// 构建URL参数
|
||||||
let url = `${API_BASE}/api/information/list?info_type=${type}`
|
let url = `${API_BASE}/api/information/list?info_type=${type}&page_size=500`
|
||||||
|
|
||||||
// 如果是成交行情tab,获取当天所有数据(不分页)
|
|
||||||
if (activeTab === 'deal' && dealDate) {
|
|
||||||
url += `&deal_date=${dealDate}&page_size=500`
|
|
||||||
} else {
|
|
||||||
url += `&page=${currentPage}&page_size=50`
|
|
||||||
}
|
|
||||||
|
|
||||||
const res = await fetch(url, { headers })
|
const res = await fetch(url, { headers })
|
||||||
// 从响应头获取总页数
|
// 从响应头获取总页数
|
||||||
|
|
@ -500,7 +493,7 @@ export default function News() {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<h3 style={{ color: '#fff', marginBottom: '16px' }}>
|
<h3 style={{ color: '#fff', marginBottom: '16px' }}>
|
||||||
{activeTab === 'seek' ? '寻配号信息' : activeTab === 'deal' ? `当日成交信息统计(均价) (${dealDate})` : '一尘看板'}
|
{activeTab === 'seek' ? '寻配号信息' : activeTab === 'deal' ? '最新成交信息统计(均价)' : '一尘看板'}
|
||||||
{activeTab === 'seek' && (
|
{activeTab === 'seek' && (
|
||||||
<div style={{ display: 'flex', gap: '8px', marginLeft: 'auto' }}>
|
<div style={{ display: 'flex', gap: '8px', marginLeft: 'auto' }}>
|
||||||
<button onClick={() => { setViewMode('all'); fetchInfoList(); }} style={{ padding: '6px 12px', background: viewMode==='all'?'#3b82f6':'#1e293b', border: '1px solid #334155', borderRadius: '6px', color: '#fff', fontSize: '12px' }}>全部</button>
|
<button onClick={() => { setViewMode('all'); fetchInfoList(); }} style={{ padding: '6px 12px', background: viewMode==='all'?'#3b82f6':'#1e293b', border: '1px solid #334155', borderRadius: '6px', color: '#fff', fontSize: '12px' }}>全部</button>
|
||||||
|
|
@ -509,12 +502,6 @@ export default function News() {
|
||||||
<button onClick={() => setShowSeekPublish(!showSeekPublish)} style={{ padding: '6px 12px', background: showSeekPublish ? '#6b7280' : '#10b981', border: 'none', borderRadius: '6px', color: '#fff', fontSize: '12px', cursor: 'pointer' }}>发布寻号</button>
|
<button onClick={() => setShowSeekPublish(!showSeekPublish)} style={{ padding: '6px 12px', background: showSeekPublish ? '#6b7280' : '#10b981', border: 'none', borderRadius: '6px', color: '#fff', fontSize: '12px', cursor: 'pointer' }}>发布寻号</button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{activeTab === 'deal' && (
|
|
||||||
<div style={{ display: 'flex', gap: '8px', marginLeft: 'auto' }}>
|
|
||||||
<input type="date" value={dealDate} onChange={e => setDealDate(e.target.value)}
|
|
||||||
style={{ padding: '6px 12px', background: '#1e293b', border: '1px solid #334155', borderRadius: '6px', color: '#fff', fontSize: '12px' }} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
{/* 一尘看板独立渲染 */}
|
{/* 一尘看板独立渲染 */}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue