lxr пре 1 недеља
родитељ
комит
5993ad94d5
1 измењених фајлова са 62 додато и 126 уклоњено
  1. 62 126
      HBuilderProjects/shareAiConsult.html

+ 62 - 126
HBuilderProjects/shareAiConsult.html

@@ -17,7 +17,6 @@
       --text: #151515;
       --muted: #aaaaaa;
       --orange: #f47d1f;
-      --safe-top: env(safe-area-inset-top, 0px);
       --safe-bottom: env(safe-area-inset-bottom, 0px);
     }
 
@@ -39,57 +38,6 @@
       padding-bottom: calc(92px + var(--safe-bottom));
     }
 
-    .nav {
-      position: sticky;
-      top: 0;
-      z-index: 10;
-      display: flex;
-      align-items: center;
-      padding: 10px 12px;
-      padding-top: calc(10px + var(--safe-top));
-      background: #fff;
-    }
-
-    .nav__close {
-      width: 36px;
-      height: 36px;
-      border: none;
-      background: transparent;
-      font-size: 22px;
-      line-height: 36px;
-      color: #151515;
-      flex-shrink: 0;
-      cursor: pointer;
-      -webkit-tap-highlight-color: transparent;
-    }
-
-    .nav__center {
-      flex: 1;
-      min-width: 0;
-      text-align: center;
-      padding: 0 8px;
-    }
-
-    .nav__title {
-      font-size: 15px;
-      font-weight: 600;
-      color: #151515;
-      white-space: nowrap;
-      overflow: hidden;
-      text-overflow: ellipsis;
-    }
-
-    .nav__url {
-      margin-top: 2px;
-      font-size: 11px;
-      color: var(--muted);
-    }
-
-    .nav__side {
-      width: 36px;
-      flex-shrink: 0;
-    }
-
     .hero {
       padding: 16px 15px 0;
     }
@@ -216,20 +164,25 @@
     }
 
     .footer__dock {
-      position: relative;
       display: flex;
       justify-content: center;
       width: 100%;
       pointer-events: auto;
     }
 
+    .footer__btn-slot {
+      position: relative;
+      width: 50%;
+      height: 48px;
+    }
+
     .continue-btn {
       display: flex;
       align-items: center;
       justify-content: center;
-      width: 50%;
+      width: 100%;
       height: 48px;
-      margin: 0 auto;
+      margin: 0;
       padding: 0;
       border: none;
       border-radius: 999px;
@@ -251,12 +204,11 @@
     #launch-btn {
       display: none;
       position: absolute;
-      left: 50%;
+      left: 0;
       top: 0;
-      width: 50%;
+      width: 100%;
       height: 48px;
       min-height: 48px;
-      transform: translateX(-50%);
       border-radius: 999px;
       overflow: hidden;
     }
@@ -290,15 +242,6 @@
   </style>
 </head>
 <body>
-  <header class="nav">
-    <button type="button" class="nav__close" id="btnClose" aria-label="关闭">×</button>
-    <div class="nav__center">
-      <div class="nav__title" id="navTitle">与AI助手-U宝</div>
-      <div class="nav__url" id="navUrl">www.ailien.shop</div>
-    </div>
-    <div class="nav__side"></div>
-  </header>
-
   <main id="main">
     <div class="empty">对话内容加载中…</div>
   </main>
@@ -307,40 +250,42 @@
 
   <footer class="footer">
     <div class="footer__dock">
-      <button type="button" class="continue-btn" id="btnContinue" aria-label="和U宝继续聊">
-        <img class="continue-btn__label" src="images/uCharts.png" alt="和U宝继续聊" decoding="async">
-      </button>
-      <wx-open-launch-app id="launch-btn" appid="wxf5f1efe3a9f5012e" extinfo="">
-        <script type="text/wxtag-template">
-          <style>
-            .wx-open-app-btn {
-              display: flex;
-              align-items: center;
-              justify-content: center;
-              width: 100%;
-              height: 48px;
-              margin: 0;
-              padding: 0;
-              border: none;
-              border-radius: 999px;
-              background: linear-gradient(90deg, #ffb84c 0%, #ff6b3e 100%);
-              box-shadow: 0 4px 16px rgba(255, 107, 62, 0.32);
-              cursor: pointer;
-              -webkit-tap-highlight-color: transparent;
-            }
-            .continue-btn__label {
-              display: block;
-              height: 16px;
-              width: auto;
-              max-width: 90%;
-              pointer-events: none;
-            }
-          </style>
-          <button class="wx-open-app-btn" aria-label="和U宝继续聊">
-            <img class="continue-btn__label" src="https://test.ailien.shop/h5/HBuilderProjects/images/uCharts.png" alt="和U宝继续聊" decoding="async">
-          </button>
-        </script>
-      </wx-open-launch-app>
+      <div class="footer__btn-slot">
+        <button type="button" class="continue-btn" id="btnContinue" aria-label="和U宝继续聊">
+          <img class="continue-btn__label" src="images/uCharts.png" alt="和U宝继续聊" decoding="async">
+        </button>
+        <wx-open-launch-app id="launch-btn" appid="wxf5f1efe3a9f5012e" extinfo="">
+          <script type="text/wxtag-template">
+            <style>
+              .wx-open-app-btn {
+                display: flex;
+                align-items: center;
+                justify-content: center;
+                width: 100%;
+                height: 48px;
+                margin: 0;
+                padding: 0;
+                border: none;
+                border-radius: 999px;
+                background: linear-gradient(90deg, #ffb84c 0%, #ff6b3e 100%);
+                box-shadow: 0 4px 16px rgba(255, 107, 62, 0.32);
+                cursor: pointer;
+                -webkit-tap-highlight-color: transparent;
+              }
+              .continue-btn__label {
+                display: block;
+                height: 20px;
+                width: auto;
+                max-width: 90%;
+                pointer-events: none;
+              }
+            </style>
+            <button class="wx-open-app-btn" aria-label="和U宝继续聊">
+              <img class="continue-btn__label" src="https://test.ailien.shop/h5/HBuilderProjects/images/uCharts.png" alt="和U宝继续聊" decoding="async">
+            </button>
+          </script>
+        </wx-open-launch-app>
+      </div>
     </div>
   </footer>
 
@@ -532,10 +477,8 @@
         applyWeixinShareMeta();
         sharePayloadCache = data || null;
         var main = document.getElementById("main");
-        var navTitle = document.getElementById("navTitle");
-        var navUrl = document.getElementById("navUrl");
         if (!data) {
-          if (navTitle) navTitle.textContent = "与AI助手-U宝";
+          document.title = "与AI助手-U宝";
           main.innerHTML = '<div class="empty">对话内容不存在或链接已失效</div>';
           refreshWxLaunchTagAttrs();
           return;
@@ -550,14 +493,6 @@
         var navTitleText = formatNavTitle(firstQuestion);
         var dateText = formatDate(data.shareTime);
 
-        if (navTitle) navTitle.textContent = navTitleText;
-        if (navUrl) {
-          try {
-            navUrl.textContent = location.hostname || "www.ailien.shop";
-          } catch (eNav) {
-            navUrl.textContent = "www.ailien.shop";
-          }
-        }
         document.title = navTitleText;
 
         var bodyHtml =
@@ -893,7 +828,19 @@
               : detail && detail.errmsg
                 ? String(detail.errmsg)
                 : "";
-          console.warn("[wx-open-launch-app]", detail);
+          console.warn("[wx-open-launch-app]", detail, "extinfo=", tag.getAttribute("extinfo"));
+          if (/launch:fail_check/i.test(errMsg)) {
+            showAppOpenFailTip(
+              "微信唤起 App 校验失败,请确认开放标签域名与 App 关联配置正确"
+            );
+            return;
+          }
+          if (/launch:fail/i.test(errMsg)) {
+            showAppOpenFailTip(
+              "未能打开 App,请确认已安装最新版「U店在哪」,或从 App 内分享到微信后再打开"
+            );
+            return;
+          }
           showAppOpenFailTip(
             errMsg
               ? "未能打开 App:" + errMsg
@@ -980,11 +927,9 @@
       function showAppOpenFailTip(msg) {
         var tip = msg || "未能打开 App,请确认已安装最新版「U店在哪」。";
         if (typeof uni !== "undefined" && typeof uni.showToast === "function") {
-          uni.showToast({ title: msg, icon: "none", duration: 2800 });
-        } else if (isWeChatInAppBrowser()) {
-          window.alert(tip);
+          uni.showToast({ title: tip, icon: "none", duration: 2800 });
         } else {
-          showFabToast(tip);
+          showFabToast(tip, 3200);
         }
       }
 
@@ -1078,15 +1023,6 @@
       bindWeChatLaunchTagEvents();
       scheduleWeChatJssdkBootstrap();
       document.getElementById("btnContinue").addEventListener("click", tryOpenApp);
-      document.getElementById("btnClose").addEventListener("click", function () {
-        if (window.history.length > 1) {
-          window.history.back();
-        } else if (typeof WeixinJSBridge !== "undefined") {
-          WeixinJSBridge.call("closeWindow");
-        } else {
-          window.close();
-        }
-      });
       render(parsePayload());
     })();
   </script>