Explorar el Código

优化支付页面提示文本,调整Safari浏览器兼容性处理,简化支付页面打开逻辑,提升用户体验。

wuyi hace 3 meses
padre
commit
eb487af969
Se han modificado 3 ficheros con 21 adiciones y 31 borrados
  1. 0 1
      src/components/VideoProcessor.vue
  2. 13 3
      src/views/Account.vue
  3. 8 27
      src/views/VideoPlayer.vue

+ 0 - 1
src/components/VideoProcessor.vue

@@ -231,7 +231,6 @@ const processVideo = async (url: string): Promise<void> => {
 
       if (typeof decryptedData === "string") {
         const playlist = processM3u8Content(decryptedData, processedUrl);
-        console.log("playlist", playlist);
 
         // Safari 特殊处理:对于加密的 HLS 流,Safari 原生播放器可能无法处理
         // 我们需要确保使用 HLS.js 来处理加密流

+ 13 - 3
src/views/Account.vue

@@ -87,8 +87,16 @@ const showSuccess = (message: string) => {
 
 // Safari兼容性处理:打开支付页面
 const openPaymentPage = (url: string) => {
-  // 直接使用location.href跳转,确保Safari兼容性
-  window.location.href = url;
+  // 检测是否为Safari浏览器
+  const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
+
+  if (isSafari) {
+    // Safari浏览器:使用location.href跳转
+    window.location.href = url;
+  } else {
+    // 其他浏览器:正常使用window.open
+    window.open(url, "_blank");
+  }
 };
 
 const handleMembershipPurchase = async () => {
@@ -553,7 +561,9 @@ onMounted(async () => {
         </div>
 
         <!-- 等待文字 -->
-        <h3 class="text-lg font-semibold text-white/90 mb-2">等待支付...</h3>
+        <h3 class="text-lg font-semibold text-white/90 mb-2">
+          正在拉起支付页面,等待支付...
+        </h3>
         <p class="text-sm text-white/60 mb-6">
           请在支付页面完成支付<br />
           支付完成后点击已完成支付

+ 8 - 27
src/views/VideoPlayer.vue

@@ -311,7 +311,9 @@
         </div>
 
         <!-- 等待文字 -->
-        <h3 class="text-lg font-semibold text-white/90 mb-2">等待支付...</h3>
+        <h3 class="text-lg font-semibold text-white/90 mb-2">
+          正在拉起支付页面,等待支付...
+        </h3>
         <p class="text-sm text-white/60 mb-6">
           请在支付页面完成支付<br />
           支付完成后点击已完成支付
@@ -351,7 +353,9 @@
         </div>
 
         <!-- 等待文字 -->
-        <h3 class="text-lg font-semibold text-white/90 mb-2">等待支付...</h3>
+        <h3 class="text-lg font-semibold text-white/90 mb-2">
+          正在拉起支付页面,等待支付...
+        </h3>
         <p class="text-sm text-white/60 mb-6">
           请在支付页面完成支付<br />
           支付完成后点击已完成支付
@@ -716,31 +720,8 @@ const openPaymentPage = (url: string) => {
   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);
-    }
+    // Safari浏览器:使用location.href跳转
+    window.location.href = url;
   } else {
     // 其他浏览器:正常使用window.open
     window.open(url, "_blank");