diff --git a/src/app/(auth)/login/login-card.tsx b/src/app/(auth)/login/login-card.tsx index fd454c1..77ad0f3 100644 --- a/src/app/(auth)/login/login-card.tsx +++ b/src/app/(auth)/login/login-card.tsx @@ -6,7 +6,7 @@ import {Card, CardContent} from '@/components/ui/card' import {Form, FormField} from '@/components/ui/form' import {Label} from '@/components/ui/label' import {Tabs, TabsList, TabsTrigger} from '@/components/ui/tabs' -import {EyeClosedIcon, EyeIcon} from 'lucide-react' +import {EyeClosedIcon, EyeIcon, HomeIcon} from 'lucide-react' import {useState, ReactNode, useEffect, Suspense} from 'react' import zod from 'zod' import {useForm, useFormContext, useWatch} from 'react-hook-form' @@ -16,6 +16,7 @@ import {useRouter} from 'next/navigation' import {login, LoginMode} from '@/actions/auth' import {useProfileStore} from '@/components/stores/profile' import dynamic from 'next/dynamic' +import Link from 'next/link' const smsSchema = zod.object({ username: zod.string().length(11, '请输入正确的手机号码'), @@ -88,111 +89,122 @@ export default function LoginCard() { const [showPwd, setShowPwd] = useState(false) return ( - - - {/* 登录方式切换 */} - { - setMode(val as LoginMode) - form.reset({username: '', password: '', remember: false}) - form.clearErrors() - }} - className="mb-6"> - - 密码登录 - 验证码登录/注册 - - - className="space-y-6" form={form} handler={handler}> - - {({id, field}) => ( - - )} - - - {({id, field}) => - mode === 'phone_code' ? ( -
- - -
- ) : ( -
- - -
- ) - } -
- - {({id, field}) => ( -
- +
+ + + 返回首页 + +
+ + + {/* 登录方式切换 */} + { + setMode(val as LoginMode) + form.reset({username: '', password: '', remember: false}) + form.clearErrors() + }} + className="mb-6"> + + 密码登录 + 验证码登录/注册 + + + className="space-y-6" form={form} handler={handler}> + + {({id, field}) => ( + -
- + )} + + + {({id, field}) => + mode === 'phone_code' ? ( +
+ + +
+ ) : ( +
+ + +
+ ) + } +
+ + {({id, field}) => ( +
+ +
+ +
-
- )} -
-
- -

- 登录即表示您同意 - 《用户协议》 - 和 - 《隐私政策》 -

-
- -
-
+ )} + +
+ +

+ 登录即表示您同意 + 《用户协议》 + 和 + 《隐私政策》 +

+
+ + + +
) } diff --git a/src/app/admin/clients.tsx b/src/app/admin/clients.tsx index a2a62bd..8eac354 100644 --- a/src/app/admin/clients.tsx +++ b/src/app/admin/clients.tsx @@ -6,7 +6,7 @@ import {RealnameAuthDialog} from '@/components/composites/dialogs/realname-auth- import UserCenter from '@/components/composites/user-center' import {Button} from '@/components/ui/button' import {Tooltip, TooltipContent, TooltipProvider, TooltipTrigger} from '@/components/ui/tooltip' -import {Archive, ArchiveRestore, Eye, HardDriveUpload, IdCard, LockKeyhole, Package, PanelLeftCloseIcon, PanelLeftOpenIcon, ShoppingCart, UserRound, UserRoundPen, Wallet} from 'lucide-react' +import {Archive, ArchiveRestore, Eye, HardDriveUpload, IdCard, LockKeyhole, MessageCircleMoreIcon, Package, PanelLeftCloseIcon, PanelLeftOpenIcon, ShoppingCart, UserRound, UserRoundPen, Wallet} from 'lucide-react' import {merge} from '@/lib/utils' import logoAvatar from '@/assets/logo-avatar.svg' import logoText from '@/assets/logo-text.svg' @@ -126,6 +126,16 @@ export function Header() { 实名认证 +
diff --git a/src/app/admin/whitelist/page.tsx b/src/app/admin/whitelist/page.tsx index 7e7c9af..0528ebf 100644 --- a/src/app/admin/whitelist/page.tsx +++ b/src/app/admin/whitelist/page.tsx @@ -34,7 +34,7 @@ type SchemaType = z.infer export type WhitelistPageProps = {} -const MAX_WHITELIST_COUNT = 5 +const MAX_WHITELIST_COUNT = 10 export default function WhitelistPage(props: WhitelistPageProps) { const [wait, setWait] = useState(false) diff --git a/src/components/composites/extract/index.tsx b/src/components/composites/extract/index.tsx index fd57349..90fcf02 100644 --- a/src/components/composites/extract/index.tsx +++ b/src/components/composites/extract/index.tsx @@ -379,12 +379,10 @@ function SelectResource() {
) : !profile ? (
- {/* */} 请先登录账号,去登录
) : resources.length === 0 ? (
- 暂无可用套餐
) : ( diff --git a/src/components/composites/purchase/index.tsx b/src/components/composites/purchase/index.tsx index 4add2cb..47931fb 100644 --- a/src/components/composites/purchase/index.tsx +++ b/src/components/composites/purchase/index.tsx @@ -30,7 +30,6 @@ export default function Purchase() { const res = profile ? await listProduct({}) : await listProductHome({}) - console.log(res, 'res') if (res.success) { setProductList(res.data) diff --git a/src/components/composites/purchase/long/center.tsx b/src/components/composites/purchase/long/center.tsx index 5c76b27..246c7a5 100644 --- a/src/components/composites/purchase/long/center.tsx +++ b/src/components/composites/purchase/long/center.tsx @@ -167,14 +167,14 @@ export default function Center({skuData}: { ) : ( )} diff --git a/src/components/composites/purchase/long/form.tsx b/src/components/composites/purchase/long/form.tsx index e37daff..f314ee7 100644 --- a/src/components/composites/purchase/long/form.tsx +++ b/src/components/composites/purchase/long/form.tsx @@ -11,9 +11,9 @@ import {PurchaseSidePanel} from '../shared/side-panel' const schema = z.object({ type: z.enum(['1', '2']).default('2'), live: z.string(), - quota: z.number().min(500, '购买数量不能少于 500 个'), + quota: z.number().min(1, '购买数量不能少于 1 个'), expire: z.string(), - daily_limit: z.number().min(100, '每日限额不能少于 100 个'), + daily_limit: z.number().min(1, '每日限额不能少于 1 个'), pay_type: z.enum(['wechat', 'alipay', 'balance']), }) export type Schema = z.infer @@ -37,8 +37,8 @@ export default function LongForm({skuList}: {skuList: ProductItem['skus']}) { type: defaultMode, live: defaultLive, expire: defaultExpire, - quota: defaultMode === '2' ? Math.max(defaultCountMin, 500) : 500, - daily_limit: defaultMode === '1' ? Math.max(defaultCountMin, 100) : 100, + quota: defaultCountMin, + daily_limit: defaultCountMin, pay_type: 'balance', // 余额支付 }, }) diff --git a/src/components/composites/purchase/short/center.tsx b/src/components/composites/purchase/short/center.tsx index 90f2c68..2a2f7b2 100644 --- a/src/components/composites/purchase/short/center.tsx +++ b/src/components/composites/purchase/short/center.tsx @@ -16,7 +16,6 @@ export default function Center({ }: { skuData: PurchaseSkuData }) { - // const {setValue} = useFormContext() const {setValue, getValues} = useFormContext() const type = useWatch({name: 'type'}) as Schema['type'] const live = useWatch({name: 'live'}) as Schema['live'] @@ -34,18 +33,13 @@ export default function Center({ const expireValue = type === '1' ? expire : '0' return getPurchaseSkuCountMin(skuData, {mode: type, live, expire: expireValue}) }, [type, live, expire, skuData]) + useEffect(() => { - if (type === '1') { - const current = getValues('daily_limit') - if (current < currentCountMin) { - setValue('daily_limit', currentCountMin) - } - } - else { - const current = getValues('quota') - if (current < currentCountMin) { - setValue('quota', currentCountMin) - } + if (currentCountMin <= 0) return + const targetField = type === '1' ? 'daily_limit' : 'quota' + const currentValue = getValues(targetField) + if (currentValue < currentCountMin) { + setValue(targetField, currentCountMin, {shouldValidate: true}) } }, [currentCountMin, type, setValue, getValues]) useEffect(() => { @@ -171,14 +165,14 @@ export default function Center({ ) : ( )} diff --git a/src/components/composites/purchase/short/form.tsx b/src/components/composites/purchase/short/form.tsx index 69ed764..f1b07c2 100644 --- a/src/components/composites/purchase/short/form.tsx +++ b/src/components/composites/purchase/short/form.tsx @@ -11,9 +11,9 @@ import {PurchaseSidePanel} from '../shared/side-panel' const schema = z.object({ type: z.enum(['1', '2']).default('2'), live: z.string(), - quota: z.number().min(10000, '购买数量不能少于 10000 个'), + quota: z.number(), expire: z.string(), - daily_limit: z.number().min(2000, '每日限额不能少于 2000 个'), + daily_limit: z.number(), pay_type: z.enum(['wechat', 'alipay', 'balance']).default('balance'), }) export type Schema = z.infer @@ -30,14 +30,15 @@ export default function ShortForm({skuList}: {skuList: ProductItem['skus']}) { live: defaultLive, expire: defaultExpire, }) + const form = useForm({ resolver: zodResolver(schema), defaultValues: { type: defaultMode, live: defaultLive, expire: defaultExpire, - quota: defaultMode === '2' ? defaultCountMin || 10000 : 10000, - daily_limit: defaultMode === '1' ? defaultCountMin || 2000 : 2000, + quota: defaultCountMin, + daily_limit: defaultCountMin, pay_type: 'balance', // 余额支付 }, })