This commit is contained in:
imeepos
2026-01-20 17:21:09 +08:00
parent d2189ed971
commit 8c43b9daf0
6 changed files with 322 additions and 297 deletions

View File

@@ -55,6 +55,14 @@ const ErrorState = () => (
</Layout>
)
const EmptyState = () => (
<Layout>
<View style={styles.centerContainer}>
<Text style={styles.messageText}></Text>
</View>
</Layout>
)
const FooterLoading = () => (
<View style={styles.footerLoading}>
<ActivityIndicator size="small" color="#FFE500" />
@@ -171,19 +179,37 @@ export default function VideoScreen() {
index,
}), [videoHeight])
// 过滤掉视频类型的 item
// 过滤掉没有可用预览的 item
const filteredTemplates = templates.filter((item: TemplateDetail) => {
// 检查所有可能的预览 URL如果任何一个包含视频格式则过滤掉
const hasVideoUrl = [
item.webpHighPreviewUrl,
item.webpPreviewUrl,
item.previewUrl,
].some(url => url && isVideoUrl(url))
return !hasVideoUrl
// 优先使用 WebP 格式(支持动画),回退到普通预览图
const displayUrl = item.webpHighPreviewUrl || item.webpPreviewUrl || item.previewUrl
// 只检查最终要显示的 URL 是否为视频格式
const isDisplayVideo = displayUrl && isVideoUrl(displayUrl)
// 有显示URL且不是视频格式才保留
const shouldKeep = !!displayUrl && !isDisplayVideo
console.log(`Filtering ${item.title}:`, {
displayUrl,
isDisplayVideo,
shouldKeep,
})
return shouldKeep
})
console.log('Video page state:', {
templatesLength: templates.length,
filteredTemplatesLength: filteredTemplates.length,
loading,
error,
hasMore,
})
if (loading && templates.length === 0) return <LoadingState />
if (error && templates.length === 0) return <ErrorState />
if (!loading && filteredTemplates.length === 0) return <EmptyState />
return (
<Layout>