修复用户未/授权购买套餐价格计算 & 发布v1.6.0版本
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user