From eb292d79f38a94a98db8e751f9c684590987a4bd Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 15 Sep 2026 08:53:29 +0800 Subject: [PATCH] fix(lint): resolve unused vars and any types in apps/web/src/pages/subscription/Plans.tsx --- apps/web/src/pages/subscription/Plans.tsx | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/web/src/pages/subscription/Plans.tsx b/apps/web/src/pages/subscription/Plans.tsx index 173737b36..83ac01a28 100644 --- a/apps/web/src/pages/subscription/Plans.tsx +++ b/apps/web/src/pages/subscription/Plans.tsx @@ -31,7 +31,7 @@ import { import { useNavigate } from "react-router-dom" import PageHead from "@/components/layout/PageHead" import { usePointsStore } from "@/store/pointsStore" -import { SUBSCRIPTION_PLANS, createPointsOrder, subscribe } from "@/api/points" +import { SUBSCRIPTION_PLANS, createPointsOrder } from "@/api/points" import type { PointsPackage } from "@/api/points/types" import { getPointsPackages } from "@/api/points" import "./Plans.css" @@ -67,12 +67,12 @@ const formatYuan = (cents: number) => const Plans: React.FC = () => { const navigate = useNavigate() - const { balance, subscription, init, loading: storeLoading } = usePointsStore() + const { balance, init } = usePointsStore() const [selectedBilling, setSelectedBilling] = useState<"monthly" | "quarterly" | "yearly">( "quarterly", ) const [packages, setPackages] = useState([]) - const [subscribing, setSubscribing] = useState(false) + const [subscribing] = useState(false) const [buying, setBuying] = useState(null) useEffect(() => { @@ -85,12 +85,12 @@ const Plans: React.FC = () => { const isMember = !!balance?.is_member const memberType = balance?.member_type ?? null - const /** 根据会员等级计算积分包折后价(分) */ - getPackPrice = (pkg: PointsPackage): number => { - const mt = memberType ?? "free" - const key = `discounted_price_for_${mt}` as const - return (pkg as any)[key] ?? pkg.price - } + /** 根据会员等级计算积分包折后价(分) */ + const getPackPrice = (pkg: PointsPackage): number => { + const mt = memberType ?? "free" + const key = `discounted_price_for_${mt}` as const + return (pkg as PointsPackage & Record)[key] ?? pkg.price + } const selectedPlan = useMemo( () => SUBSCRIPTION_PLANS.find((p) => p.id === selectedBilling)!, @@ -139,8 +139,9 @@ const Plans: React.FC = () => { ), okText: "知道了", }) - } catch (e: any) { - message.error(e?.message ?? "创建订单失败") + } catch (e) { + const err = e as { message?: string } + message.error(err?.message ?? "创建订单失败") } finally { setBuying(null) }