From 1e081167b33d0e4ebd5226bc2f921d4526e0e685 Mon Sep 17 00:00:00 2001 From: hzm <934585316@qq.com> Date: Tue, 10 Mar 2026 21:31:41 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=8C=81=E6=9C=89=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=95=B0=E6=8D=AE=E9=9A=90=E8=97=8F=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/FundCard.jsx | 29 +++++++++++++++++++---------- app/components/GroupSummary.jsx | 18 ++++++++++++++++-- app/components/MobileFundTable.jsx | 16 +++++++++------- app/components/PcFundTable.jsx | 16 +++++++++------- app/page.jsx | 9 +++++++++ 5 files changed, 62 insertions(+), 26 deletions(-) diff --git a/app/components/FundCard.jsx b/app/components/FundCard.jsx index eee0f3e..6f32760 100644 --- a/app/components/FundCard.jsx +++ b/app/components/FundCard.jsx @@ -59,6 +59,7 @@ export default function FundCard({ onToggleCollapse, onToggleTrendCollapse, layoutMode = 'card', // 'card' | 'drawer',drawer 时前10重仓与业绩走势以 Tabs 展示 + masked = false, }) { const holding = holdings[f?.code]; const profit = getHoldingProfit?.(f, holding) ?? null; @@ -246,7 +247,9 @@ export default function FundCard({ > 持仓金额 {layoutMode !== 'drawer' && } - ¥{profit.amount.toFixed(2)} + + {masked ? '******' : `¥${profit.amount.toFixed(2)}`} +
当日收益 @@ -262,7 +265,9 @@ export default function FundCard({ }`} > {profit.profitToday != null - ? `${profit.profitToday > 0 ? '+' : profit.profitToday < 0 ? '-' : ''}¥${Math.abs(profit.profitToday).toFixed(2)}` + ? masked + ? '******' + : `${profit.profitToday > 0 ? '+' : profit.profitToday < 0 ? '-' : ''}¥${Math.abs(profit.profitToday).toFixed(2)}` : '--'}
@@ -288,14 +293,18 @@ export default function FundCard({ profit.profitTotal > 0 ? 'up' : profit.profitTotal < 0 ? 'down' : '' }`} > - {profit.profitTotal > 0 ? '+' : profit.profitTotal < 0 ? '-' : ''} - {percentModes?.[f.code] - ? `${Math.abs( - holding?.cost * holding?.share - ? (profit.profitTotal / (holding.cost * holding.share)) * 100 - : 0, - ).toFixed(2)}%` - : `¥${Math.abs(profit.profitTotal).toFixed(2)}`} + {masked + ? '******' + : <> + {profit.profitTotal > 0 ? '+' : profit.profitTotal < 0 ? '-' : ''} + {percentModes?.[f.code] + ? `${Math.abs( + holding?.cost * holding?.share + ? (profit.profitTotal / (holding.cost * holding.share)) * 100 + : 0, + ).toFixed(2)}%` + : `¥${Math.abs(profit.profitTotal).toFixed(2)}`} + } )} diff --git a/app/components/GroupSummary.jsx b/app/components/GroupSummary.jsx index 524cb43..3940e21 100644 --- a/app/components/GroupSummary.jsx +++ b/app/components/GroupSummary.jsx @@ -56,9 +56,11 @@ export default function GroupSummary({ groupName, getProfit, stickyTop, + masked, + onToggleMasked, }) { const [showPercent, setShowPercent] = useState(true); - const [isMasked, setIsMasked] = useState(false); + const [isMasked, setIsMasked] = useState(masked ?? false); const [isSticky, setIsSticky] = useState(false); const rowRef = useRef(null); const [assetSize, setAssetSize] = useState(24); @@ -74,6 +76,12 @@ export default function GroupSummary({ } }, []); + useEffect(() => { + if (typeof masked === 'boolean') { + setIsMasked(masked); + } + }, [masked]); + const summary = useMemo(() => { let totalAsset = 0; let totalProfitToday = 0; @@ -185,7 +193,13 @@ export default function GroupSummary({