diff --git a/src/app/(home)/product/page.tsx b/src/app/(home)/product/page.tsx
index f90a021..e57d3b0 100644
--- a/src/app/(home)/product/page.tsx
+++ b/src/app/(home)/product/page.tsx
@@ -1,8 +1,12 @@
import BreadCrumb from '@/components/bread-crumb'
import Wrap from '@/components/wrap'
-import Purchase from '@/components/composites/purchase'
+import Purchase, {TabType} from '@/components/composites/purchase'
-export type ProductPageProps = {}
+export type ProductPageProps = {
+ searchParams?: {
+ type?: TabType
+ }
+}
export default function ProductPage(props: ProductPageProps) {
return (
@@ -11,7 +15,7 @@ export default function ProductPage(props: ProductPageProps) {
-
+
)
diff --git a/src/app/admin/purchase/page.tsx b/src/app/admin/purchase/page.tsx
index 49bd335..cb6193d 100644
--- a/src/app/admin/purchase/page.tsx
+++ b/src/app/admin/purchase/page.tsx
@@ -1,12 +1,16 @@
-import Purchase from '@/components/composites/purchase'
+import Purchase, {TabType} from '@/components/composites/purchase'
import Page from '@/components/page'
-export type PurchasePageProps = {}
+export type PurchasePageProps = {
+ searchParams?: {
+ type?: TabType
+ }
+}
export default async function PurchasePage(props: PurchasePageProps) {
return (
-
+
)
}
diff --git a/src/components/composites/purchase/index.tsx b/src/components/composites/purchase/index.tsx
index c2642c3..00a3ba7 100644
--- a/src/components/composites/purchase/index.tsx
+++ b/src/components/composites/purchase/index.tsx
@@ -1,38 +1,33 @@
-'use client'
-import {ReactNode, useContext} from 'react'
+import {ReactNode} 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 Link from 'next/link'
-import {useSearchParams} from 'next/navigation'
-import {HeaderContext} from '@/app/(home)/@header/_client/provider'
-import {useRouter} from 'next/navigation'
export type TabType = 'short' | 'long' | 'fixed' | 'custom'
-export default function Purchase() {
- const searchParams = useSearchParams()
- const defaultTab = searchParams?.get('type') as TabType || 'short'
+type PurchaseProps = {
+ defaultType: TabType
+}
+
+export default async function Purchase(props: PurchaseProps) {
return (
- <>
-
-
-
- 短效动态
- 长效静态
- 固定套餐
- 定制套餐
-
-
-
-
-
-
-
-
-
- >
+
+
+
+ 短效动态
+ 长效静态
+ 固定套餐
+ 定制套餐
+
+
+
+
+
+
+
+
+
)
}
@@ -40,33 +35,15 @@ function Tab(props: {
value: string
children: ReactNode
}) {
- const ctx = useContext(HeaderContext)
- const router = useRouter()
- const handleClick = (e: React.MouseEvent) => {
- e.preventDefault()
- e.stopPropagation()
- if (ctx) {
- ctx.setMenu(false)
- }
- }
return (
-
-
- {props.children}
-
-
+ {props.children}
+
)
}