v1.2.41 添加一尘看板功能到资讯面板
This commit is contained in:
parent
5f6dffface
commit
5da876a193
|
|
@ -891,3 +891,18 @@ def get_publisher_info(
|
||||||
"contact": contact,
|
"contact": contact,
|
||||||
"created_at": info.created_at.isoformat() if info.created_at else None
|
"created_at": info.created_at.isoformat() if info.created_at else None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/yichen-posts")
|
||||||
|
def get_yichen_posts(category: str = None, search: str = None, page: int = 1, page_size: int = 20):
|
||||||
|
from app.models.models import Information
|
||||||
|
from sqlalchemy import desc
|
||||||
|
query = db.query(Information).filter(Information.info_type == 'yichen')
|
||||||
|
if category:
|
||||||
|
query = query.filter(Information.expect_category == category)
|
||||||
|
if search:
|
||||||
|
query = query.filter(Information.title.contains(search))
|
||||||
|
total = query.count()
|
||||||
|
offset = (page - 1) * page_size
|
||||||
|
items = query.order_by(desc(Information.created_at)).offset(offset).limit(page_size).all()
|
||||||
|
return {"data": items, "pagination": {"page": page, "limit": page_size, "total": total}}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<title>甲辰收藏 v1.2.38</title>
|
<title>甲辰收藏 v0.0.0</title>
|
||||||
|
|
||||||
<!-- Favicon -->
|
<!-- Favicon -->
|
||||||
<link rel="icon" type="image/png" href="/static/icons/favicon.png" />
|
<link rel="icon" type="image/png" href="/static/icons/favicon.png" />
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ export default function News() {
|
||||||
// 寻配号对所有人公开,无需登录即可查看
|
// 寻配号对所有人公开,无需登录即可查看
|
||||||
const token = localStorage.getItem('token')
|
const token = localStorage.getItem('token')
|
||||||
// 根据tab获取不同类型的数据
|
// 根据tab获取不同类型的数据
|
||||||
const type = activeTab === 'seek' ? 'seek' : 'deal'
|
const type = activeTab === 'seek' ? 'seek' : activeTab === 'deal' ? 'deal' : 'yichen'
|
||||||
// 始终传递token,以便获取准确的matched_count
|
// 始终传递token,以便获取准确的matched_count
|
||||||
const headers = token ? { Authorization: `Bearer ${token}` } : {}
|
const headers = token ? { Authorization: `Bearer ${token}` } : {}
|
||||||
const res = await fetch(`${API_BASE}/api/information/list?info_type=${type}`, { headers })
|
const res = await fetch(`${API_BASE}/api/information/list?info_type=${type}`, { headers })
|
||||||
|
|
@ -315,7 +315,8 @@ export default function News() {
|
||||||
// Tab切换
|
// Tab切换
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{ key: 'seek', label: '🔍 寻配号' },
|
{ key: 'seek', label: '🔍 寻配号' },
|
||||||
{ key: 'deal', label: '💰 成交行情' }
|
{ key: 'deal', label: '💰 成交行情' },
|
||||||
|
{ key: 'yichen', label: '📊 一尘看板' }
|
||||||
]
|
]
|
||||||
|
|
||||||
const formatDate = (dateStr) => {
|
const formatDate = (dateStr) => {
|
||||||
|
|
@ -435,7 +436,7 @@ export default function News() {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<h3 style={{ color: '#fff', marginBottom: '16px' }}>
|
<h3 style={{ color: '#fff', marginBottom: '16px' }}>
|
||||||
{activeTab === 'seek' ? '🔍 寻配号信息' : '💰 成交行情信息'}
|
{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>
|
||||||
|
|
@ -450,7 +451,7 @@ export default function News() {
|
||||||
<div style={{ color: '#94a3b8', textAlign: 'center', padding: '40px' }}>加载中...</div>
|
<div style={{ color: '#94a3b8', textAlign: 'center', padding: '40px' }}>加载中...</div>
|
||||||
) : infoList.length === 0 ? (
|
) : infoList.length === 0 ? (
|
||||||
<div style={{ color: '#94a3b8', textAlign: 'center', padding: '40px' }}>
|
<div style={{ color: '#94a3b8', textAlign: 'center', padding: '40px' }}>
|
||||||
暂无{activeTab === 'seek' ? '寻配号' : '成交行情'}信息
|
暂无{activeTab === 'seek' ? '寻配号' : activeTab === 'deal' ? '成交行情' : '一尘看板'}信息
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue