'use client' import {ReactNode, useEffect, useState} from 'react' import {merge} from '@/lib/utils' import {Tabs, TabsContent, TabsList, TabsTrigger} from '@/components/ui/tabs' import LongForm from '@/components/composites/purchase/long/form' import ShortForm from '@/components/composites/purchase/short/form' import {useProfileStore} from '@/components/stores-provider' import {useRouter} from 'next/navigation' export type TabType = 'short' | 'long' | 'fixed' | 'custom' type PurchaseProps = { defaultType: TabType } export default function Purchase(props: PurchaseProps) { const [currentTab, setCurrentTab] = useState(props.defaultType) const profile = useProfileStore(store => store.profile) const router = useRouter() useEffect(() => { setCurrentTab(props.defaultType) // if (!profile) { // router.push('/login?redirect=/admin/purchase') // 未登录用户重定向到登录页 // } }, [props.defaultType, profile, router]) return (
短效动态 长效静态 固定套餐 定制套餐
) } function Tab(props: { value: string children: ReactNode }) { return ( {props.children} ) }