feat: 首页最新港剧区块加上一页/下一页翻页按钮 (fixed125)
Docker Build & Test / build (push) Canceled after 0s
Docker Build & Test / test (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/amd64) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm/v7) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm64) (push) Canceled after 0s
Build & Push Docker image / merge-images (push) Canceled after 0s
Docker Build & Test / build (push) Canceled after 0s
Docker Build & Test / test (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/amd64) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm/v7) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm64) (push) Canceled after 0s
Build & Push Docker image / merge-images (push) Canceled after 0s
This commit is contained in:
1 parent
aee4b48995
commit
d0a2041d9a
2 files changed
+10
-8
No files matched your search
@@ -3,6 +3,7 @@
|
||||
import Link from 'next/link';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import PaginatedRow from './PaginatedRow';
|
||||
import VideoCard from './VideoCard';
|
||||
|
||||
type VodItem = {
|
||||
@@ -16,14 +17,15 @@ type VodItem = {
|
||||
vod_area?: string;
|
||||
};
|
||||
|
||||
const SHOW_COUNT = 10;
|
||||
const PAGE_SIZE = 10; // 每页条数,与热门电影一致
|
||||
const LOAD_COUNT = 60; // 一次性多取,支持上一页/下一页翻页
|
||||
|
||||
export default function HkDramaRow() {
|
||||
const [items, setItems] = useState<VodItem[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
const CACHE_KEY = 'hkDramaRow:v1';
|
||||
const CACHE_KEY = 'hkDramaRow:v2';
|
||||
const TTL = 5 * 60 * 1000;
|
||||
try {
|
||||
const raw = sessionStorage.getItem(CACHE_KEY);
|
||||
@@ -50,7 +52,7 @@ export default function HkDramaRow() {
|
||||
String(a.vod_time || '')
|
||||
);
|
||||
});
|
||||
const out = arr.slice(0, SHOW_COUNT);
|
||||
const out = arr.slice(0, LOAD_COUNT);
|
||||
setItems(out);
|
||||
try { sessionStorage.setItem(CACHE_KEY, JSON.stringify({ ts: Date.now(), data: out })); } catch {}
|
||||
})
|
||||
@@ -84,10 +86,10 @@ export default function HkDramaRow() {
|
||||
查看更多
|
||||
</Link>
|
||||
</div>
|
||||
<div className='grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4 relative'>
|
||||
<PaginatedRow itemsPerPage={PAGE_SIZE}>
|
||||
{loading
|
||||
? // 加载中显示10个占位,与热门电影/剧集同时出现,避免后半拍跳动
|
||||
Array.from({ length: SHOW_COUNT }).map((_, index) => (
|
||||
Array.from({ length: PAGE_SIZE }).map((_, index) => (
|
||||
<div key={index} className='w-full'>
|
||||
<div className='relative aspect-[2/3] w-full overflow-hidden rounded-lg bg-purple-200 animate-pulse dark:bg-purple-800'>
|
||||
<div className='absolute inset-0 bg-purple-300 dark:bg-purple-700'></div>
|
||||
@@ -119,7 +121,7 @@ export default function HkDramaRow() {
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</PaginatedRow>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user