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({