This commit is contained in:
imeepos 2025-12-26 18:48:02 +08:00
parent 0ee481dc13
commit 98f6166921
2 changed files with 17 additions and 5 deletions

View File

@ -159,6 +159,7 @@ type Template = {
name: string
image: string
type: 'video'
price?: number
data?: any
}
@ -261,9 +262,17 @@ const TemplateSection = memo<TemplateSectionProps>(function TemplateSection({ te
)
})
type GenerateSectionProps = { onGenerate: () => void }
const GenerateSection = memo<GenerateSectionProps>(function GenerateSection({ onGenerate }) {
type GenerateSectionProps = {
selectedTemplate: Template | undefined
onGenerate: () => void
}
const GenerateSection = memo<GenerateSectionProps>(function GenerateSection({ selectedTemplate, onGenerate }) {
const insets = useSafeAreaInsets()
if (!selectedTemplate) return null
const price = selectedTemplate.price || selectedTemplate.data?.price || 0
return (
<Block className="absolute bottom-[96px] left-[16px] right-[16px] z-40" style={{ paddingBottom: insets.bottom }}>
<Block style={{ transform: [{ skewX: '-6deg' }] }}>
@ -281,7 +290,7 @@ const GenerateSection = memo<GenerateSectionProps>(function GenerateSection({ on
{/* 右侧 Goo 标签 */}
<Block className="z-10 flex-row items-center gap-[8px] border-[2px] border-black bg-black px-[12px] py-[4px]">
<Ionicons name="flash" size={14} color="#FFE500" />
<Text className="text-[14px] font-black italic text-[#FFE500]">3 Goo</Text>
<Text className="text-[14px] font-black italic text-[#FFE500]">{price} Goo</Text>
</Block>
</Block>
</Block>
@ -317,6 +326,7 @@ export default function Index() {
name: t.title,
image: t.coverImageUrl,
type: 'video' as const,
price: t.price,
data: t,
}))
}, [templates.data])
@ -393,7 +403,7 @@ export default function Index() {
<Block className="h-[200px] w-full"></Block>
</ScrollView>
<GenerateSection onGenerate={handleGenerate} />
<GenerateSection selectedTemplate={selectedTemplate} onGenerate={handleGenerate} />
</Block>
)
}

View File

@ -32,6 +32,7 @@ type MediaItem = {
url: string
poster?: string
likeCount: number
price: number
}
type ActiveTab = 'gen' | '' | 'new' | 'like'
@ -358,6 +359,7 @@ export default function Sync() {
url: isVideo ? template.previewUrl : template.coverImageUrl || template.previewUrl,
poster: isVideo ? template.coverImageUrl : undefined,
likeCount: template.likeCount || 0,
price: template.price || 2, // 默认为 2 Goo
}
}, [])
@ -594,7 +596,7 @@ export default function Sync() {
return
}
const cost = 2
const cost = selectedItem.price
if (balance < cost) {
Toast.show({ title: '余额不足,请充值' })