修复用户未/授权购买套餐价格计算 & 发布v1.6.0版本

This commit is contained in:
Eamon-meng
2026-04-16 17:46:11 +08:00
parent 5607217625
commit 8b65a1745c
7 changed files with 97 additions and 47 deletions

View File

@@ -1,6 +1,6 @@
'use client'
import {useContext, useState} from 'react'
import {useContext, useEffect, useState} from 'react'
import {useRouter} from 'next/navigation'
import {X} from 'lucide-react'
import {HeaderContext} from './common'
@@ -21,6 +21,8 @@ import h03 from '@/assets/header/help/03.svg'
import {merge} from '@/lib/utils'
import Link from 'next/link'
import logo from '@/assets/logo.webp'
import {Product} from '@/lib/models/product'
import {listProductHome} from '@/actions/product'
export type MobileMenuProps = {}
@@ -37,7 +39,18 @@ export default function MobileMenu(props: MobileMenuProps) {
ctx.setMenu(false)
router.push(href)
}
const [productList, setProductList] = useState<Product[]>([])
useEffect(() => {
const fetchProducts = async () => {
const res = await listProductHome({})
if (res.success) {
setProductList(res.data)
}
}
fetchProducts()
}, [])
const shortProduct = productList.find(p => p.name?.includes('短效') || p.code === 'short')
const longProduct = productList.find(p => p.name?.includes('长效') || p.code === 'long')
return (
<div className="h-full flex flex-col bg-white">
<div className="flex items-center justify-between px-4 h-16 border-b border-gray-100">
@@ -87,20 +100,24 @@ export default function MobileMenu(props: MobileMenuProps) {
{productTab === 'domestic' && (
<div className="space-y-2">
<ProductItem
icon={prod}
label="短效动态IP"
badge="最低4.5折"
href="/product?type=short"
onNavigate={navigate}
/>
<ProductItem
icon={prod}
label="长效静态IP"
badge="最低4.5折"
href="/product?type=long"
onNavigate={navigate}
/>
{shortProduct && (
<ProductItem
icon={prod}
label="短效动态IP"
badge="最低4.5折"
href={`/product?type=${shortProduct.code}`}
onNavigate={navigate}
/>
)}
{longProduct && (
<ProductItem
icon={prod}
label="长效静态IP"
badge="最低4.5折"
href={`/product?type=${longProduct.code}`}
onNavigate={navigate}
/>
)}
<ProductItem
icon={custom}
label="优质/企业/精选IP"