From 5136b590de1c9dc4743261510177686ae95737e2 Mon Sep 17 00:00:00 2001 From: NAC Admin Date: Sat, 21 Mar 2026 01:56:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E5=9C=B0=E5=9D=80=E5=90=8E=E8=B4=AD=E4=B9=B0?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 EVMPurchasePanel 中添加 manualAddress 状态 - 手动输入地址确认后显示购买按钮(提示连接钱包完成购买) - 添加 effectiveAddress 和 isManualMode 辅助变量 - 钱包信息区域支持手动地址显示(琥珀色样式区分) --- client/src/pages/Home.tsx | 43 +++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/client/src/pages/Home.tsx b/client/src/pages/Home.tsx index 4d9d971..1c0a232 100644 --- a/client/src/pages/Home.tsx +++ b/client/src/pages/Home.tsx @@ -320,8 +320,12 @@ function EVMPurchasePanel({ network, lang, wallet }: { network: "BSC" | "ETH"; l const { purchaseState, buyWithUSDT, reset, calcTokens, getUsdtBalance } = usePresale(wallet, network); const [usdtInput, setUsdtInput] = useState("100"); const [usdtBalance, setUsdtBalance] = useState(null); + const [manualAddress, setManualAddress] = useState(null); const targetChainId = CONTRACTS[network].chainId; const isWrongNetwork = wallet.isConnected && wallet.chainId !== targetChainId; + // effectiveAddress: 真实钱包地址 或 手动输入的地址 + const effectiveAddress = wallet.address || manualAddress; + const isManualMode = !wallet.isConnected && !!manualAddress; const fetchBalance = useCallback(async () => { const bal = await getUsdtBalance(); @@ -388,14 +392,15 @@ function EVMPurchasePanel({ network, lang, wallet }: { network: "BSC" | "ETH"; l return (
- {/* Wallet info — only shown when connected */} - {wallet.isConnected && !isWrongNetwork && ( -
+ {/* Wallet info — shown when connected or manual address entered */} + {effectiveAddress && !isWrongNetwork && ( +
-
- {shortenAddress(wallet.address || "")} +
+ {shortenAddress(effectiveAddress)} + {isManualMode && {lang === "zh" ? "(手动地址)" : "(manual)"}}
- {usdtBalance !== null && ( + {usdtBalance !== null && !isManualMode && ( {t("buy_balance")} {usdtBalance.toFixed(2)} USDT )}
@@ -482,14 +487,15 @@ function EVMPurchasePanel({ network, lang, wallet }: { network: "BSC" | "ETH"; l )} {/* Buy Button — or Connect Wallet if not connected */} - {!wallet.isConnected ? ( + {!wallet.isConnected && !manualAddress ? (

{t("buy_connect_msg")}

{ - toast.success(lang === "zh" ? `已连接: ${addr.slice(0, 6)}...${addr.slice(-4)}` : `Connected: ${addr.slice(0, 6)}...${addr.slice(-4)}`); + setManualAddress(addr); + toast.success(lang === "zh" ? `地址已确认: ${addr.slice(0, 6)}...${addr.slice(-4)}` : `Address confirmed: ${addr.slice(0, 6)}...${addr.slice(-4)}`); }} compact /> @@ -505,6 +511,27 @@ function EVMPurchasePanel({ network, lang, wallet }: { network: "BSC" | "ETH"; l ? `切换到 ${CONTRACTS[network].chainName} 后即可购买` : `Switch to ${CONTRACTS[network].chainName} to Buy`} + ) : isManualMode ? ( +
+
+

+ {lang === "zh" ? "⚠️ 手动地址模式:需连接钱包才能完成链上购买" : "⚠️ Manual mode: Connect wallet to complete on-chain purchase"} +

+

+ {lang === "zh" ? "请点击右上角连接您的钱包" : "Please connect your wallet via the top-right button"} +

+
+ +
) : (