Compare commits

...

2 Commits

Author SHA1 Message Date
imeepos af6daa4911 fix: bug 2025-12-26 18:48:19 +08:00
imeepos 98f6166921 fix: bug 2025-12-26 18:48:02 +08:00
3 changed files with 18 additions and 6 deletions

2
.gitignore vendored
View File

@ -8,7 +8,7 @@ node_modules/
dist/ dist/
web-build/ web-build/
expo-env.d.ts expo-env.d.ts
nul
# Native # Native
.kotlin/ .kotlin/
*.orig.* *.orig.*

View File

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

View File

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