调整桌面端产品订购的菜单栏布局

This commit is contained in:
Eamon-meng
2026-03-14 18:00:27 +08:00
parent 83530d7f1e
commit d9f267e257
2 changed files with 51 additions and 42 deletions

View File

@@ -1,12 +1,13 @@
'use client' 'use client'
import {ReactNode, useContext, useState} from 'react' import {ReactNode, useContext, useState} from 'react'
import Wrap from '@/components/wrap' import Wrap from '@/components/wrap'
import Image, {StaticImageData} from 'next/image'
import Link from 'next/link' import Link from 'next/link'
import {merge} from '@/lib/utils' import {merge} from '@/lib/utils'
import prod from '@/assets/header/product/prod.svg' import prod from '@/assets/header/product/prod.svg'
import custom from '@/assets/header/product/custom.svg' import custom from '@/assets/header/product/custom.svg'
import {useRouter} from 'next/navigation' import {useRouter} from 'next/navigation'
import {FragmentTitle, HeaderContext} from './common' import {HeaderContext} from './common'
type TabType = 'domestic' | 'oversea' type TabType = 'domestic' | 'oversea'
@@ -53,33 +54,34 @@ export function Tab(props: {
export function Domestic(props: {}) { export function Domestic(props: {}) {
return ( return (
<section role="tabpanel" className="flex-auto flex flex-col lg:flex-row justify-evenly gap-3 lg:gap-0"> <section role="tabpanel" className="flex-auto">
<div className="w-full lg:w-64 flex flex-col"> <div className="grid grid-cols-1 lg:grid-cols-2 gap-3">
<FragmentTitle img={prod} text="短效 IP"/> <div className="grid grid-cols-1 gap-3">
<DomesticLink <ProductCard
icon={prod}
label="短效动态 IP" label="短效动态 IP"
discount="最低4.5折"
desc="全国 300+ 城市级定位节点IP 池资源充足自动高频切换。适用于数据采集、市场调研、SEO 优化等高并发场景。稳定可靠,响应迅速,助力业务高效运转。" desc="全国 300+ 城市级定位节点IP 池资源充足自动高频切换。适用于数据采集、市场调研、SEO 优化等高并发场景。稳定可靠,响应迅速,助力业务高效运转。"
href="/product?type=short" href="/product?type=short"
discount={45}
/> />
</div> <ProductCard
<div className="w-full lg:w-64 flex flex-col"> icon={prod}
<FragmentTitle img={prod} text="长效 IP"/> label="长效静态 IP"
<DomesticLink discount="最低4.5折"
label="长效动态 IP"
desc="IP 存活时长可达数小时至数天,连接稳定不掉线。适用于账号养号、社交运营、电商管理等需要持续在线的场景。优质线路保障,为您的长期业务保驾护航。" desc="IP 存活时长可达数小时至数天,连接稳定不掉线。适用于账号养号、社交运营、电商管理等需要持续在线的场景。优质线路保障,为您的长期业务保驾护航。"
href="/product?type=long" href="/product?type=long"
discount={45}
/> />
</div> </div>
<div className="w-full lg:w-64 flex flex-col"> <div className="flex flex-col gap-3">
<FragmentTitle img={custom} text="业务定制"/> <ProductCard
<DomesticLink icon={custom}
label="优质/企业/精选IP" label="业务定制"
discount="1V1 专属服务"
desc="超 1000 家企业共同信赖之选!大客户经理全程 1 对 1 沟通,随时为您排忧解难,提供 24 小时不间断支持" desc="超 1000 家企业共同信赖之选!大客户经理全程 1 对 1 沟通,随时为您排忧解难,提供 24 小时不间断支持"
href="/custom" href="/custom"
/> />
</div> </div>
</div>
</section> </section>
) )
} }
@@ -92,11 +94,12 @@ export function Oversea(props: {}) {
) )
} }
export function DomesticLink(props: { export function ProductCard(props: {
icon: StaticImageData
label: string label: string
discount: string
desc: string desc: string
href: string href: string
discount?: number
}) { }) {
const router = useRouter() const router = useRouter()
const ctx = useContext(HeaderContext) const ctx = useContext(HeaderContext)
@@ -116,18 +119,24 @@ export function DomesticLink(props: {
`transition-colors duration-150 ease-in-out`, `transition-colors duration-150 ease-in-out`,
`p-4 rounded-lg flex flex-col gap-1 hover:bg-blue-50`, `p-4 rounded-lg flex flex-col gap-1 hover:bg-blue-50`,
)} )}
onClick={onClick}> onClick={onClick}
<p className="flex gap-2"> >
<span>{props.label}</span> <div className="flex items-start gap-3">
{props.discount && ( <div className="flex-none">
<span className="text-orange-500 text-xs text-light px-2 py-1 bg-orange-50 rounded-full"> <Image src={props.icon} alt="" width={30} height={30}/>
{props.discount}% </div>
<div className="flex-1">
<div className="flex items-center justify-between gap-3">
<span className="font-bold">{props.label}</span>
<span className="text-xs font-medium text-orange-600 bg-orange-50 px-2 py-1 rounded-full">
{props.discount}
</span> </span>
)} </div>
</p> <div className="mt-2 text-sm text-gray-400 space-y-1">
<p className="text-gray-400 text-sm">
{props.desc} {props.desc}
</p> </div>
</div>
</div>
</Link> </Link>
) )
} }

View File

@@ -176,7 +176,7 @@ export default function IdentifyPage(props: IdentifyPageProps) {
<canvas ref={canvas} width={256} height={256}/> <canvas ref={canvas} width={256} height={256}/>
<p className="text-sm text-gray-600"></p> <p className="text-sm text-gray-600"></p>
<Button onClick={() => handleDialogOpenChange(false)}> <Button onClick={() => handleDialogOpenChange(false)}>
</Button> </Button>
</div> </div>
)} )}