fix: bug
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user