diff --git a/src/admin/cashOut/page.tsx b/src/admin/cashOut/page.tsx index dde018b..d47254b 100644 --- a/src/admin/cashOut/page.tsx +++ b/src/admin/cashOut/page.tsx @@ -1,10 +1,13 @@ import type { ColumnDef } from "@tanstack/react-table" +import { useMemo, useState } from "react" import { fetchCashOutList } from "@/api/cashOut" import DataTable from "@/components/data-table" import Page from "@/components/page" import { useList } from "@/lib/hooks/useList" import type { CashOutItem } from "@/lib/models/cashOut" +const PAGE_SIZE = 10 + const columns: ColumnDef[] = [ { accessorKey: "username", @@ -41,19 +44,32 @@ const columns: ColumnDef[] = [ export default function CashOutPage() { const { data, status } = useList(fetchCashOutList) + const [page, setPage] = useState(1) + const [pageSize, setPageSize] = useState(PAGE_SIZE) + + // 接口返回全量列表,本地做前端分页 + const paged = useMemo( + () => data.slice((page - 1) * pageSize, page * pageSize), + [data, page, pageSize], + ) return (

提现管理

- data={data} + data={paged} status={status} columns={columns} pagination={{ - page: 0, - size: 10, + page, + size: pageSize, total: data.length, + onPageChange: setPage, + onSizeChange: size => { + setPageSize(size) + setPage(1) + }, }} />
diff --git a/src/admin/channels/page.tsx b/src/admin/channels/page.tsx index 0f4d82f..f3fc6e2 100644 --- a/src/admin/channels/page.tsx +++ b/src/admin/channels/page.tsx @@ -138,13 +138,13 @@ export default function ChannelsPage() { useEffect(() => { if (loadedRef.current) return loadedRef.current = true - void load(toParams(INITIAL_QUERY)) + load(toParams(INITIAL_QUERY)) }, [load]) const applyFilters = (patch: Partial) => { const next = { ...query, ...patch } setQuery(next) - void load(toParams(next)) + load(toParams(next)) } const paged = useMemo( @@ -238,7 +238,7 @@ export default function ChannelsPage() { status={status} columns={columns} pagination={{ - page: page - 1, + page, size: PAGE_SIZE, total: data.length, onPageChange: setPage, diff --git a/src/admin/dashboard/page.tsx b/src/admin/dashboard/page.tsx index 5443e60..d4b472d 100644 --- a/src/admin/dashboard/page.tsx +++ b/src/admin/dashboard/page.tsx @@ -52,12 +52,12 @@ function readUserInfo(userInfo: UserInfoRecord | null) { const info = userInfo ?? {} const phone = String( info.Phone ?? - info.LoginCode ?? - info.phone ?? - info.logincode ?? - info.Mobile ?? - info.mobile ?? - "", + info.LoginCode ?? + info.phone ?? + info.logincode ?? + info.Mobile ?? + info.mobile ?? + "", ) const managerId = Number(info.ManagerId ?? info.managerId ?? 0) return { @@ -82,8 +82,8 @@ export default function DashboardPage() { // 页面挂载时加载一次账户总览与协议签署状态 useEffect(() => { - void refresh() - void refreshAgreement() + refresh() + refreshAgreement() }, [refresh, refreshAgreement]) // 支付窗口完成支付后(storage 事件)自动刷新余额 @@ -92,7 +92,7 @@ export default function DashboardPage() { if (e.key !== PAY_PAID_KEY || !e.newValue) return toast.success("充值成功,余额已更新") clearPayPaid() - void refresh() + refresh() } window.addEventListener("storage", handler) return () => window.removeEventListener("storage", handler) diff --git a/src/admin/funds/page.tsx b/src/admin/funds/page.tsx index fe1af20..6af8cf2 100644 --- a/src/admin/funds/page.tsx +++ b/src/admin/funds/page.tsx @@ -73,13 +73,13 @@ export default function FundsPage() { }, []) useEffect(() => { - void load(1) + load(1) }, [load]) const handlePageChange = (nextPage: number) => { if (nextPage < 1) return setPage(nextPage) - void load(nextPage) + load(nextPage) } // 接口不返回总条数:还有下一页时多加 1 条保证可翻页,否则按累计条数展示 @@ -96,7 +96,7 @@ export default function FundsPage() { status={status} columns={columns} pagination={{ - page: page - 1, + page, size: SCORE_PAGE_SIZE, sizeOptions: [SCORE_PAGE_SIZE], total, diff --git a/src/admin/layout.tsx b/src/admin/layout.tsx index f68837c..1ff3f42 100644 --- a/src/admin/layout.tsx +++ b/src/admin/layout.tsx @@ -1,4 +1,5 @@ import { Outlet } from "react-router-dom" +import RealNameGate from "@/components/realNameGate" import { Content, Header, Mask, Navbar, Shell } from "./clients" import Effects from "./effects" @@ -41,7 +42,9 @@ export default function AdminLayout() { - + + + diff --git a/src/admin/orders/page.tsx b/src/admin/orders/page.tsx index 09b09ae..cc635d5 100644 --- a/src/admin/orders/page.tsx +++ b/src/admin/orders/page.tsx @@ -80,7 +80,7 @@ export default function OrdersPage() { filters={filters} products={products} onPatch={patch} - onSearch={() => void load()} + onSearch={() => load()} />
@@ -90,7 +90,7 @@ export default function OrdersPage() { status={status} columns={columns} pagination={{ - page: page - 1, + page, size: MY_ORDER_PAGE_SIZE, total, onPageChange: setPage, diff --git a/src/admin/refundOrders/page.tsx b/src/admin/refundOrders/page.tsx index fe02a10..f74a000 100644 --- a/src/admin/refundOrders/page.tsx +++ b/src/admin/refundOrders/page.tsx @@ -75,7 +75,7 @@ export default function RefundOrdersPage() { products={products} showOrderType={false} onPatch={patch} - onSearch={() => void load()} + onSearch={() => load()} />
@@ -85,7 +85,7 @@ export default function RefundOrdersPage() { status={status} columns={columns} pagination={{ - page: page - 1, + page, size: MY_ORDER_PAGE_SIZE, total, onPageChange: setPage, diff --git a/src/admin/resources/long-renew-dialog.tsx b/src/admin/resources/long-renew-dialog.tsx index b76413f..0be8cb0 100644 --- a/src/admin/resources/long-renew-dialog.tsx +++ b/src/admin/resources/long-renew-dialog.tsx @@ -97,7 +97,7 @@ export default function LongRenewDialog({ seqRef.current = seq setPriceLoading(true) - void calcOrderPrice({ + calcOrderPrice({ order_type: target.orderType, money: 1, data: target.data, @@ -213,7 +213,7 @@ export default function LongRenewDialog({
- + {!mandatory && ( + + )} + {!mandatory && ( + + )} +
+ + ) +} diff --git a/src/components/stores/dashboard.ts b/src/components/stores/dashboard.ts index cc945da..0e0f12e 100644 --- a/src/components/stores/dashboard.ts +++ b/src/components/stores/dashboard.ts @@ -9,6 +9,7 @@ import type { ApiIndexItem } from "@/lib/models/dashboard" export type DashboardState = { data: ApiIndexItem | null agreementSigned: boolean | null + verified: boolean | null loading: boolean error: string | null } @@ -23,13 +24,19 @@ export type DashboardStore = DashboardState & DashboardActions export const useDashboardStore = create()(set => ({ data: null, agreementSigned: null, + verified: null, loading: false, error: null, refresh: async () => { set({ loading: true }) const res = await fetchApiIndex() if (res.success) { - set({ data: res.data, error: null, loading: false }) + set({ + data: res.data, + verified: res.data ? res.data.UserModel?.is_verify === 1 : null, + error: null, + loading: false, + }) } else { set({ error: res.message, loading: false }) } diff --git a/src/components/ui/pagination.tsx b/src/components/ui/pagination.tsx index ab3f84d..0281493 100644 --- a/src/components/ui/pagination.tsx +++ b/src/components/ui/pagination.tsx @@ -19,6 +19,7 @@ import { } from "./select" export interface PaginationProps { + /** 当前页码,1 起始;onPageChange 回调参数同样为 1 起始页码 */ page: number size: number total: number @@ -38,7 +39,8 @@ function Pagination({ className, }: PaginationProps) { const [currentPage, setCurrentPage] = useState(page) - const totalPages = Math.ceil(total / size) + // 无数据时兜底为 1 页,避免除零与空分页器 + const totalPages = size > 0 ? Math.max(Math.ceil(total / size), 1) : 1 // 移动端检测:小屏幕减少页码按钮数量,避免溢出 const [isMobile, setIsMobile] = useState( @@ -166,7 +168,7 @@ function Pagination({ handlePageChange(currentPage - 1)} className={ - currentPage === 1 ? "opacity-50 pointer-events-none" : "" + currentPage <= 1 ? "opacity-50 pointer-events-none" : "" } /> @@ -196,7 +198,7 @@ function Pagination({ handlePageChange(currentPage + 1)} className={ - currentPage === totalPages + currentPage >= totalPages ? "opacity-50 pointer-events-none" : "" } diff --git a/src/home/help/index.tsx b/src/home/help/index.tsx index bb35027..e0f3842 100644 --- a/src/home/help/index.tsx +++ b/src/home/help/index.tsx @@ -48,7 +48,7 @@ export default function HelpPage() { } setArticles(transformArticles(res.data.List ?? [])) } - void load() + load() return () => { cancelled = true } diff --git a/src/home/login/index.tsx b/src/home/login/index.tsx index 52b2b38..ec0048d 100644 --- a/src/home/login/index.tsx +++ b/src/home/login/index.tsx @@ -59,20 +59,22 @@ export default function LoginPage() { diff --git a/src/home/pay/index.tsx b/src/home/pay/index.tsx index 875f6ca..ca1fa15 100644 --- a/src/home/pay/index.tsx +++ b/src/home/pay/index.tsx @@ -8,6 +8,7 @@ import { type RechargeOrderResult, } from "@/api/order" import { QrCodeImage } from "@/components/qrCodeImage" +import RealNameCheck from "@/components/realNameCheck" import { Button } from "@/components/ui/button" import { clearOrderPay, notifyPayPaid, readOrderPay } from "@/lib/recharge" import alipay from "../_assets/alipay.svg" @@ -44,8 +45,8 @@ function usePayPolling( } } - void poll() - const timer = window.setInterval(() => void poll(), POLL_INTERVAL) + poll() + const timer = window.setInterval(() => poll(), POLL_INTERVAL) return () => { stopped = true window.clearInterval(timer) @@ -59,7 +60,12 @@ export default function PayPage() { const [searchParams] = useSearchParams() const mode = searchParams.get("mode") - return mode === "order" ? : + return ( + <> + + {mode === "order" ? : } + + ) } // ==================== 充值模式 ==================== diff --git a/src/home/product/buy.tsx b/src/home/product/buy.tsx index e360731..a77a02c 100644 --- a/src/home/product/buy.tsx +++ b/src/home/product/buy.tsx @@ -2,6 +2,7 @@ import { useEffect, useState } from "react" import { useLocation, useNavigate } from "react-router-dom" import { toast } from "sonner" import { createOrder } from "@/api/order" +import RealNameCheck from "@/components/realNameCheck" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" @@ -385,6 +386,7 @@ export default function BuyPage() { return ( +
{/* 标题 */}
diff --git a/src/home/product/buyStatic.tsx b/src/home/product/buyStatic.tsx index dd9f22c..1058f6e 100644 --- a/src/home/product/buyStatic.tsx +++ b/src/home/product/buyStatic.tsx @@ -2,6 +2,7 @@ import { useEffect, useState } from "react" import { useLocation, useNavigate } from "react-router-dom" import { toast } from "sonner" import { createOrder } from "@/api/order" +import RealNameCheck from "@/components/realNameCheck" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" @@ -388,6 +389,7 @@ export default function BuyStaticPage() { const [regionSearch, setRegionSearch] = useState("") return ( +
{/* 标题 */}
@@ -616,7 +618,7 @@ export default function BuyStaticPage() {