From a00aa3d46a9deb9bd844fc9249794af38a8c972a Mon Sep 17 00:00:00 2001 From: moux1024 <403053463@qq.com> Date: Mon, 15 Sep 2025 21:22:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E9=87=8D=E5=AE=9A?= =?UTF-8?q?=E5=90=91=E9=A1=B5=E5=A2=9E=E5=8A=A0loading,=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/pay-redirect/page.tsx | 21 +++++++++++++-------- components/layout/top-bar.tsx | 6 +++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/pay-redirect/page.tsx b/app/pay-redirect/page.tsx index 7ec78c2..24fc220 100644 --- a/app/pay-redirect/page.tsx +++ b/app/pay-redirect/page.tsx @@ -1,9 +1,10 @@ "use client"; import React from "react"; +import { TailwindSpinner } from "@/components/common/GlobalLoad"; export default function PayRedirectPage() { - const [status, setStatus] = React.useState("等待安全收银台跳转..."); + const [status, setStatus] = React.useState("Waiting for secure checkout redirect..."); const [error, setError] = React.useState(""); React.useEffect(() => { @@ -12,21 +13,20 @@ export default function PayRedirectPage() { if (event.origin !== window.location.origin) return; const data = event.data || {}; if (data?.type === "redirect-to-payment" && typeof data?.url === "string") { - setStatus("即将跳转到 Stripe 收银台..."); + setStatus("Redirecting to Stripe Checkout..."); window.location.href = data.url as string; } else if (data?.type === "redirect-error") { - setError(typeof data?.message === "string" ? data.message : "创建支付失败,请关闭此页重试"); + setError(typeof data?.message === "string" ? data.message : "Failed to create payment. Please close this page and try again."); } } catch { - setError("处理跳转信息时发生错误,请关闭此页重试"); + setError("An error occurred while processing redirect info. Please close this page and try again."); } }; window.addEventListener("message", handleMessage); - // 超时兜底:若 15 秒内未收到跳转指令,提示用户 const timeoutId = window.setTimeout(() => { setStatus(""); - setError("未收到跳转指令,可能网络异常或页面被拦截。请返回重试。"); + setError("No redirect instruction received. It may be a network issue or the page was blocked. Please go back and try again."); }, 15000); return () => { @@ -38,11 +38,16 @@ export default function PayRedirectPage() { return (
-

正在准备跳转

+

Preparing to redirect

{status &&

{status}

} + {!error && ( +
+ +
+ )} {error &&

{error}

} {!error && ( -

如长时间未跳转,请返回原页重试或检查网络。

+

If it takes too long, please return to the previous page or check your network.

)}
diff --git a/components/layout/top-bar.tsx b/components/layout/top-bar.tsx index 3a9c3f3..15c7d7a 100644 --- a/components/layout/top-bar.tsx +++ b/components/layout/top-bar.tsx @@ -113,7 +113,7 @@ export function TopBar({ collapsed, isDesktop=true }: { collapsed: boolean, isDe type: "waiting-payment", paymentType: "token" }, "*"); - + sessionStorage.setItem('session_id', response.data.session_id); // 通过 postMessage 通知新页面进行重定向 redirectWindow.postMessage({ type: "redirect-to-payment", @@ -407,7 +407,7 @@ export function TopBar({ collapsed, isDesktop=true }: { collapsed: boolean, isDe ? "Loading..." : `${credits} credits`} - + */} {/* Purchase Credits 按钮 */}