更新支付传参&首页接口&菜单栏导航后tab切换
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import {ReactNode} from 'react'
|
||||
'use client'
|
||||
import {ReactNode, useEffect, useState} from 'react'
|
||||
import {merge} from '@/lib/utils'
|
||||
import {Tabs, TabsContent, TabsList, TabsTrigger} from '@/components/ui/tabs'
|
||||
import LongForm from '@/components/composites/purchase/long/form'
|
||||
@@ -10,10 +11,16 @@ type PurchaseProps = {
|
||||
defaultType: TabType
|
||||
}
|
||||
|
||||
export default async function Purchase(props: PurchaseProps) {
|
||||
export default function Purchase(props: PurchaseProps) {
|
||||
const [currentTab, setCurrentTab] = useState<string>(props.defaultType)
|
||||
|
||||
useEffect(() => {
|
||||
setCurrentTab(props.defaultType)
|
||||
}, [props.defaultType])
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<Tabs defaultValue={props.defaultType} className="gap-4">
|
||||
<Tabs value={currentTab} onValueChange={setCurrentTab} className="gap-4">
|
||||
<TabsList className="w-full p-2 bg-white rounded-lg justify-start md:justify-center overflow-auto">
|
||||
<Tab value="short">短效动态</Tab>
|
||||
<Tab value="long">长效静态</Tab>
|
||||
|
||||
@@ -10,7 +10,6 @@ import {toast} from 'sonner'
|
||||
import {useRouter} from 'next/navigation'
|
||||
import {completeResource, createResource, prepareResource} from '@/actions/resource'
|
||||
import {
|
||||
TradePlatform,
|
||||
usePlatformType,
|
||||
TradeMethod,
|
||||
TradeMethodDecoration,
|
||||
@@ -37,18 +36,14 @@ export default function Pay(props: PayProps) {
|
||||
|
||||
if (props.method === 'balance') return
|
||||
|
||||
const method = platform === TradePlatform.Desktop
|
||||
? TradeMethod.Sft
|
||||
: props.method === 'alipay'
|
||||
? TradeMethod.SftAlipay
|
||||
: TradeMethod.SftWechat
|
||||
|
||||
const method = props.method === 'alipay'
|
||||
? TradeMethod.SftAlipay
|
||||
: TradeMethod.SftWechat
|
||||
const res = {
|
||||
...props.resource,
|
||||
payment_method: method,
|
||||
payment_platform: platform,
|
||||
}
|
||||
console.log(res, '请求参数')
|
||||
|
||||
const resp = await prepareResource(res)
|
||||
if (!resp.success) {
|
||||
|
||||
Reference in New Issue
Block a user