sunshibo 5 өдөр өмнө
parent
commit
f576643883

+ 52 - 41
HBuilderProjects/shareAiConsult.html

@@ -192,9 +192,8 @@
     }
 
     .fab-dock__slot {
-      position: relative;
       width: 100%;
-      max-width: 198px;
+      max-width: 280px;
       height: 48px;
       margin: 0 auto;
       pointer-events: auto;
@@ -214,9 +213,9 @@
 
     .fab__brand-img {
       display: block;
-      height: 26px;
+      height: 20px;
       width: auto;
-      max-width: none;
+      max-width: 90%;
       pointer-events: none;
       -webkit-user-drag: none;
     }
@@ -230,22 +229,29 @@
 
     #launch-btn {
       display: none;
-      position: absolute;
-      left: 0;
-      top: 0;
-      z-index: 2;
       width: 100%;
       height: 48px;
       min-height: 48px;
-      border-radius: 24px;
+      border-radius: 999px;
       overflow: hidden;
       opacity: 1;
-      pointer-events: none;
     }
 
-    /* 开放标签叠在 openApp 上;openApp 始终可见,避免标签未渲染时按钮消失 */
     body.is-wechat.wx-jssdk-ready #launch-btn {
       display: block;
+      pointer-events: auto;
+    }
+
+    body.is-wechat.wx-jssdk-ready #openApp {
+      display: none !important;
+    }
+
+    body.is-wechat.wx-launch-fallback #launch-btn {
+      display: none !important;
+    }
+
+    body.is-wechat.wx-launch-fallback #openApp {
+      display: flex !important;
     }
 
     .fab-wrap .fab {
@@ -262,16 +268,16 @@
       justify-content: center;
       gap: 4px;
       width: 100%;
-      max-width: 198px;
+      max-width: 280px;
       margin: 0 auto;
       height: 48px;
       border: none;
-      border-radius: 24px;
-      background: #F47D1F;
+      border-radius: 999px;
+      background: linear-gradient(90deg, #ffb84c 0%, #ff6b3e 100%);
       color: #fff;
       font-size: 16px;
       font-weight: 600;
-      box-shadow: 0 4px 16px rgba(245, 130, 32, 0.45);
+      box-shadow: 0 4px 16px rgba(255, 107, 62, 0.32);
       cursor: pointer;
     }
 
@@ -313,11 +319,10 @@
   <div class="fab-wrap">
     <div class="fab-dock__slot">
       <!-- 与 secondShareGoods 相同顺序:openApp 在下,launch-btn 在上,避免挡住点击 -->
-      <button type="button" class="fab" id="openApp" aria-label="APP内打开">
+      <button type="button" class="fab" id="openApp" aria-label="和U宝继续聊">
         <span class="fab__brand-clip" aria-hidden="true">
-          <img class="fab__brand-img" src="images/uBtn.svg" alt="" decoding="async">
+          <img class="fab__brand-img" src="images/uCharts.png" alt="和U宝继续聊" decoding="async">
         </span>
-        <span class="fab__label">APP内打开</span>
       </button>
       <wx-open-launch-app id="launch-btn" appid="wxf5f1efe3a9f5012e" extinfo="">
         <script type="text/wxtag-template">
@@ -326,23 +331,18 @@
               display: flex;
               align-items: center;
               justify-content: center;
-              gap: 4px;
               width: 100%;
               height: 48px;
               margin: 0;
-              padding: 0 10px;
+              padding: 0;
               border: none;
-              border-radius: 24px;
-              background: #F47D1F;
-              box-shadow: 0 4px 16px rgba(245, 130, 32, 0.45);
-              color: #fff;
-              font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
-              -webkit-font-smoothing: antialiased;
+              border-radius: 999px;
+              background: linear-gradient(90deg, #ffb84c 0%, #ff6b3e 100%);
+              box-shadow: 0 4px 16px rgba(255, 107, 62, 0.32);
               cursor: pointer;
               overflow: hidden;
               -webkit-tap-highlight-color: transparent;
               box-sizing: border-box;
-              pointer-events: auto;
             }
             .wx-open-app-btn .fab__brand-clip {
               display: block;
@@ -351,24 +351,17 @@
             }
             .wx-open-app-btn .fab__brand-img {
               display: block;
-              height: 26px;
+              height: 20px;
               width: auto;
-              max-width: none;
+              max-width: 90%;
               pointer-events: none;
               -webkit-user-drag: none;
             }
-            .wx-open-app-btn .fab__label {
-              font-size: 15px;
-              line-height: 1;
-              letter-spacing: 0.04em;
-              white-space: nowrap;
-            }
           </style>
-          <button class="wx-open-app-btn" aria-label="APP内打开">
+          <button class="wx-open-app-btn" aria-label="和U宝继续聊">
             <span class="fab__brand-clip" aria-hidden="true">
-              <img class="fab__brand-img" src="https://prod.ailien.shop/h5/HBuilderProjects/images/uBtn.svg" alt="" decoding="async">
+              <img class="fab__brand-img" src="https://prod.ailien.shop/h5/HBuilderProjects/images/uCharts.png" alt="和U宝继续聊" decoding="async">
             </span>
-            <span class="fab__label">APP内打开</span>
           </button>
         </script>
       </wx-open-launch-app>
@@ -1014,6 +1007,7 @@
           wx.config(wxConfigParams);
           wx.ready(function () {
             weChatJssdkConfigured = true;
+            document.body.classList.remove("wx-launch-fallback");
             document.body.classList.add("wx-jssdk-ready");
             refreshWxLaunchTagAttrs();
             console.log("[wx.config] ready, htmlUrl=", htmlUrl);
@@ -1021,7 +1015,7 @@
           });
           wx.error(function (err) {
             weChatJssdkConfigured = false;
-            document.body.classList.remove("wx-jssdk-ready");
+            enableWxLaunchFallback();
             wxJssdkInitPromise = null;
             var errMsg = getWxErrMsg(err);
             setWxInitError(formatWxConfigErrorTip(err, htmlUrl));
@@ -1044,6 +1038,11 @@
         });
       }
 
+      function enableWxLaunchFallback() {
+        document.body.classList.add("wx-launch-fallback");
+        document.body.classList.remove("wx-jssdk-ready");
+      }
+
       function refreshWxLaunchTagAttrs(useBarePathOnly) {
         var tag = document.getElementById("launch-btn");
         if (!tag) return;
@@ -1078,6 +1077,7 @@
           );
 
           if (/launch:fail_check/i.test(errMsg)) {
+            enableWxLaunchFallback();
             showAppOpenFailTip(
               "请用微信分享卡片进入,或确认已安装最新版「U店在哪」"
             );
@@ -1091,7 +1091,7 @@
           ) {
             tag._wxLaunchBareRetried = true;
             refreshWxLaunchTagAttrs(true);
-            showFabToast("请再点一次「APP内打开」");
+            showFabToast("请再点一次「和U宝继续聊」");
             return;
           }
 
@@ -1102,6 +1102,7 @@
             return;
           }
 
+          enableWxLaunchFallback();
           showAppOpenFailTip(
             errMsg
               ? "未能打开 App:" + errMsg
@@ -1287,6 +1288,10 @@
 
       function tryOpenHBuilderApp() {
         if (isWeChatInAppBrowser()) return;
+        if (!isWxPcBrowser()) {
+          tryOpenHBuilderAppViaScheme();
+          return;
+        }
         tryFetchWxConfigOnPcClick().then(function () {
           if (isWxConfigOnClickDebug() && !isWxForceDebug() && !isWxPcAutoDebugHost()) {
             return;
@@ -1313,7 +1318,7 @@
         }
 
         document.addEventListener("WeixinOpenTagsError", function (e) {
-          document.body.classList.remove("wx-jssdk-ready");
+          enableWxLaunchFallback();
           console.warn("[WeixinOpenTagsError]", e && e.detail);
         });
 
@@ -1326,6 +1331,12 @@
                   wxInitLastError || "微信 SDK 初始化中,请稍候再点底部按钮"
                 );
                 initWeChatOpenLaunchApp(true);
+                return;
+              }
+              if (document.body.classList.contains("wx-launch-fallback")) {
+                showAppOpenFailTip(
+                  "请使用 App「分享到微信」后点分享卡片进入,或确认已安装最新版「U店在哪」"
+                );
               }
             });
           } else {