From a2e99c58b2fd21ede58d84b9cb9ed4dd3ecb2b6c Mon Sep 17 00:00:00 2001 From: yezian Date: Mon, 17 Mar 2025 19:51:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BE=AE=E4=BF=A1h5=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/pay/page.jsx | 24 ++++++++++++++++++++---- app/vip/page.jsx | 24 ++++++++++++++++++++---- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/app/pay/page.jsx b/app/pay/page.jsx index b8aa4da..f6cd8d4 100644 --- a/app/pay/page.jsx +++ b/app/pay/page.jsx @@ -120,7 +120,7 @@ export default function Pay() { product_id: customCoin.selected ? "h5_custom_coin" : selectedPrice.id, custom_coins: customCoin.selected ? customCoin.num : 0, pay_type: type, - redirect_url: type === "yeepay_wxpay_h5" ? window.location.href : "", + redirect_url: type === "wxpay_h5" ? "https://yibowanhe.top/success" : "", from: searchParams.get("base") ? "web" : "app", }; @@ -163,9 +163,17 @@ export default function Pay() { break; case "wxpay_h5": if (base.b_ch === "h5") { - window.parent.location.href = `https://yibowanhe.top?url=${encodeURIComponent( + // 使用postMessage向父页面发送跳转请求 + const redirectUrl = `https://yibowanhe.top?url=${encodeURIComponent( data.data.wxpay_h5_param_str )}`; + window.parent.postMessage( + { + type: "navigation", + url: redirectUrl, + }, + "*" + ); // 生产环境中应替换为父页面的确切域名 } else { router.push( `https://yibowanhe.top?url=${encodeURIComponent( @@ -207,7 +215,7 @@ export default function Pay() { product_id: customCoin.selected ? "h5_custom_coin" : selectedPrice.id, custom_coins: customCoin.selected ? customCoin.num : 0, pay_type: type, - redirect_url: type === "yeepay_wxpay_h5" ? window.location.href : "", + redirect_url: type === "wxpay_h5" ? "https://yibowanhe.top/success" : "", from: searchParams.get("base") ? "web" : "app", ver: "aliv2", }; @@ -251,9 +259,17 @@ export default function Pay() { break; case "wxpay_h5": if (base.b_ch === "h5") { - window.parent.location.href = `https://yibowanhe.top?url=${encodeURIComponent( + // 使用postMessage向父页面发送跳转请求 + const redirectUrl = `https://yibowanhe.top?url=${encodeURIComponent( data.data.wxpay_h5_param_str )}`; + window.parent.postMessage( + { + type: "navigation", + url: redirectUrl, + }, + "*" + ); // 生产环境中应替换为父页面的确切域名 } else { router.push( `https://yibowanhe.top?url=${encodeURIComponent( diff --git a/app/vip/page.jsx b/app/vip/page.jsx index ceb27b5..e52e511 100644 --- a/app/vip/page.jsx +++ b/app/vip/page.jsx @@ -90,7 +90,7 @@ export default function Vip() { ...base, product_id: "membership", pay_type: type, - redirect_url: type === "yeepay_wxpay_h5" ? window.location.href : "", + redirect_url: type === "wxpay_h5" ? "https://yibowanhe.top/success" : "", from: searchParams.get("base") ? "web" : "app", }; @@ -133,9 +133,17 @@ export default function Vip() { break; case "wxpay_h5": if (base.b_ch === "h5") { - window.parent.location.href = `https://yibowanhe.top?url=${encodeURIComponent( + // 使用postMessage向父页面发送跳转请求 + const redirectUrl = `https://yibowanhe.top?url=${encodeURIComponent( data.data.wxpay_h5_param_str )}`; + window.parent.postMessage( + { + type: "navigation", + url: redirectUrl, + }, + "*" + ); // 生产环境中应替换为父页面的确切域名 } else { router.push( `https://yibowanhe.top?url=${encodeURIComponent( @@ -163,7 +171,7 @@ export default function Vip() { ...base, product_id: "membership", pay_type: type, - redirect_url: type === "yeepay_wxpay_h5" ? window.location.href : "", + redirect_url: type === "wxpay_h5" ? "https://yibowanhe.top/success" : "", from: searchParams.get("base") ? "web" : "app", ver: "aliv2", }; @@ -207,9 +215,17 @@ export default function Vip() { break; case "wxpay_h5": if (base.b_ch === "h5") { - window.parent.location.href = `https://yibowanhe.top?url=${encodeURIComponent( + // 使用postMessage向父页面发送跳转请求 + const redirectUrl = `https://yibowanhe.top?url=${encodeURIComponent( data.data.wxpay_h5_param_str )}`; + window.parent.postMessage( + { + type: "navigation", + url: redirectUrl, + }, + "*" + ); // 生产环境中应替换为父页面的确切域名 } else { router.push( `https://yibowanhe.top?url=${encodeURIComponent(