From 831daeb46eeb8fc883df7971b03c9bfd6067ef86 Mon Sep 17 00:00:00 2001 From: Eamon-meng <17516219072@163.com> Date: Wed, 11 Jun 2025 19:07:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=A6=96=E9=A1=B5=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=B7=B3=E8=BD=AC=E4=BA=A7=E5=93=81=E8=AE=A2=E8=B4=AD?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(home)/@header/_client/product.tsx | 24 +++++-- src/app/(home)/page.tsx | 8 ++- src/components/composites/purchase/index.tsx | 68 ++++++++++++-------- 3 files changed, 69 insertions(+), 31 deletions(-) diff --git a/src/app/(home)/@header/_client/product.tsx b/src/app/(home)/@header/_client/product.tsx index 729ac47..6998412 100644 --- a/src/app/(home)/@header/_client/product.tsx +++ b/src/app/(home)/@header/_client/product.tsx @@ -1,4 +1,5 @@ -import {ReactNode, useContext, useState} from 'react' +'use client' +import {ReactNode, useContext, useState, useEffect} from 'react' import Wrap from '@/components/wrap' import Image from 'next/image' import anno from '@/assets/header/product/anno.svg' @@ -7,6 +8,7 @@ import {merge} from '@/lib/utils' import prod from '@/assets/header/product/prod.svg' import custom from '@/assets/header/product/custom.svg' import {HeaderContext} from '@/app/(home)/@header/_client/provider' +import {useSearchParams} from 'next/navigation' type TabType = 'domestic' | 'oversea' @@ -15,6 +17,8 @@ export function Tab(props: { onSelect: () => void children: ReactNode }) { + const searchParams = useSearchParams() + const currentType = searchParams?.get('type') || 'short' return (
  • diff --git a/src/components/composites/purchase/index.tsx b/src/components/composites/purchase/index.tsx index dc89b25..1998242 100644 --- a/src/components/composites/purchase/index.tsx +++ b/src/components/composites/purchase/index.tsx @@ -1,29 +1,36 @@ +'use client' 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' -export type PurchaseProps = {} +export type TabType = 'short' | 'long' | 'fixed' | 'custom' -export default async function Purchase(props: PurchaseProps) { +export default function Purchase() { + const searchParams = useSearchParams() + const defaultTab = searchParams?.get('type') as TabType || 'short' return ( -
    - - - 短效动态 - 长效静态 - 固定套餐 - 定制套餐 - - - - - - - - -
    + <> +
    + + + 短效动态 + 长效静态 + 固定套餐 + 定制套餐 + + + + + + + + +
    + ) } @@ -32,13 +39,22 @@ function Tab(props: { children: ReactNode }) { return ( - - {props.children} - + + + {props.children} + + ) }