v1.2.41 添加一尘看板功能到资讯面板

This commit is contained in:
龙大 2026-04-06 15:54:22 +08:00
parent 5f6dffface
commit 5da876a193
3 changed files with 21 additions and 5 deletions

View File

@ -891,3 +891,18 @@ def get_publisher_info(
"contact": contact,
"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}}

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<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">
<title>甲辰收藏 v1.2.38</title>
<title>甲辰收藏 v0.0.0</title>
<!-- Favicon -->
<link rel="icon" type="image/png" href="/static/icons/favicon.png" />

View File

@ -69,7 +69,7 @@ export default function News() {
//
const token = localStorage.getItem('token')
// tab
const type = activeTab === 'seek' ? 'seek' : 'deal'
const type = activeTab === 'seek' ? 'seek' : activeTab === 'deal' ? 'deal' : 'yichen'
// token便matched_count
const headers = token ? { Authorization: `Bearer ${token}` } : {}
const res = await fetch(`${API_BASE}/api/information/list?info_type=${type}`, { headers })
@ -315,7 +315,8 @@ export default function News() {
// Tab
const tabs = [
{ key: 'seek', label: '🔍 寻配号' },
{ key: 'deal', label: '💰 成交行情' }
{ key: 'deal', label: '💰 成交行情' },
{ key: 'yichen', label: '📊 一尘看板' }
]
const formatDate = (dateStr) => {
@ -435,7 +436,7 @@ export default function News() {
</div>
)}
<h3 style={{ color: '#fff', marginBottom: '16px' }}>
{activeTab === 'seek' ? '🔍 寻配号信息' : '💰 成交行情信息'}
{activeTab === 'seek' ? '🔍 寻配号信息' : activeTab === 'deal' ? '💰 成交行情信息' : '📊 一尘看板'}
{activeTab === 'seek' && (
<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>
@ -450,7 +451,7 @@ export default function News() {
<div style={{ color: '#94a3b8', textAlign: 'center', padding: '40px' }}>加载中...</div>
) : infoList.length === 0 ? (
<div style={{ color: '#94a3b8', textAlign: 'center', padding: '40px' }}>
暂无{activeTab === 'seek' ? '寻配号' : '成交行情'}信息
暂无{activeTab === 'seek' ? '寻配号' : activeTab === 'deal' ? '成交行情' : '一尘看板'}信息
</div>
) : (
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>