v1.2.72 - 优化加载性能
This commit is contained in:
parent
a4be63512c
commit
e5a5a2c48c
|
|
@ -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.70</title>
|
||||
<title>甲辰收藏 v=1.2.72</title>
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" href="/static/icons/favicon.png" />
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export default function Home() {
|
|||
setDragonStats(data || {})
|
||||
}).catch(() => {})
|
||||
|
||||
fetch('/api/yichens/posts?limit=10&offset=0').then(res => res.json()).then(data => {
|
||||
fetch('/api/yichens/posts?limit=20&offset=0').then(res => res.json()).then(data => {
|
||||
setRecentPosts(Array.isArray(data) ? data : [])
|
||||
}).catch(() => {})
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export default function YichensBoard() {
|
|||
const currentPage = p !== undefined ? p : page
|
||||
const currentCat = cat !== undefined ? cat : categoryFilter
|
||||
|
||||
let url = '/api/yichens/posts?limit=390&offset=' + ((currentPage - 1) * 390)
|
||||
let url = '/api/yichens/posts?limit=50&offset=' + ((currentPage - 1) * 390)
|
||||
if (postTypeFilter === 'deal') url += '&post_type=deal'
|
||||
else if (postTypeFilter === 'want') url += '&post_type=want'
|
||||
else if (postTypeFilter === 'other') url += '&post_type=normal'
|
||||
|
|
@ -218,7 +218,7 @@ export default function YichensBoard() {
|
|||
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '12px 16px', background: '#1e293b', borderRadius: 12, marginTop: 16 }}>
|
||||
<div style={{ color: '#9ca3af', fontSize: 12 }}>
|
||||
共 {totalPosts} 条帖子,{Math.ceil(totalPosts / 390)} 页,当前第 {page} 页
|
||||
共 {totalPosts} 条帖子,{Math.ceil(totalPosts / 50)} 页,当前第 {page} 页
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 8 }}>
|
||||
{page > 1 ? (
|
||||
|
|
@ -226,7 +226,7 @@ export default function YichensBoard() {
|
|||
) : (
|
||||
<span style={{ padding: '6px 12px', borderRadius: 6, background: '#374151', color: '#6b7280', fontSize: 12 }}>上一页</span>
|
||||
)}
|
||||
{posts.length >= 390 ? (
|
||||
{posts.length >= 50 ? (
|
||||
<button onClick={() => { const newPage = page + 1; setPage(newPage); fetchPosts(newPage, categoryFilter) }} style={{ padding: '6px 12px', borderRadius: 6, border: 'none', background: '#3b82f6', color: '#fff', cursor: 'pointer', fontSize: 12 }}>下一页</button>
|
||||
) : (
|
||||
<span style={{ padding: '6px 12px', borderRadius: 6, background: '#374151', color: '#6b7280', fontSize: 12 }}>下一页</span>
|
||||
|
|
|
|||
Loading…
Reference in New Issue