|
|
@@ -87,39 +87,8 @@ const showSuccess = (message: string) => {
|
|
|
|
|
|
// Safari兼容性处理:打开支付页面
|
|
|
const openPaymentPage = (url: string) => {
|
|
|
- // 检测是否为Safari浏览器
|
|
|
- const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
|
-
|
|
|
- if (isSafari) {
|
|
|
- // Safari浏览器:尝试多种方式打开支付页面
|
|
|
- try {
|
|
|
- // 方法1:直接使用window.open
|
|
|
- const newWindow = window.open(url, "_blank");
|
|
|
-
|
|
|
- // 检查是否被阻止
|
|
|
- if (
|
|
|
- !newWindow ||
|
|
|
- newWindow.closed ||
|
|
|
- typeof newWindow.closed === "undefined"
|
|
|
- ) {
|
|
|
- // 方法2:创建临时链接并点击
|
|
|
- const link = document.createElement("a");
|
|
|
- link.href = url;
|
|
|
- link.target = "_blank";
|
|
|
- link.rel = "noopener noreferrer";
|
|
|
- document.body.appendChild(link);
|
|
|
- link.click();
|
|
|
- document.body.removeChild(link);
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error("Safari支付页面打开失败:", error);
|
|
|
- // 方法3:使用location.href作为备用方案
|
|
|
- showError("无法打开支付页面,请手动复制链接:" + url);
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 其他浏览器:正常使用window.open
|
|
|
- window.open(url, "_blank");
|
|
|
- }
|
|
|
+ // 直接使用location.href跳转,确保Safari兼容性
|
|
|
+ window.location.href = url;
|
|
|
};
|
|
|
|
|
|
const handleMembershipPurchase = async () => {
|