lxr пре 1 недеља
родитељ
комит
78020fbf7b
1 измењених фајлова са 83 додато и 3 уклоњено
  1. 83 3
      HBuilderProjects/shareAiConsult.html

+ 83 - 3
HBuilderProjects/shareAiConsult.html

@@ -17,6 +17,7 @@
       --text: #151515;
       --muted: #aaaaaa;
       --orange: #f47d1f;
+      --safe-top: env(safe-area-inset-top, 0px);
       --safe-bottom: env(safe-area-inset-bottom, 0px);
     }
 
@@ -38,6 +39,57 @@
       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;
     }
@@ -83,11 +135,11 @@
       max-width: 78%;
       padding: 10px 12px;
       background: var(--orange);
-      border-radius: 6px;
+      border-radius: 11px;
       color: #fff;
       font-size: 15px;
       font-weight: 500;
-      line-height: 1.5;
+      line-height: 1.47;
       white-space: pre-wrap;
       word-break: break-word;
     }
@@ -208,6 +260,15 @@
   </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">www.ailien.shop</div>
+    </div>
+    <div class="nav__side"></div>
+  </header>
+
   <main id="main">
     <div class="empty">对话内容加载中…</div>
   </main>
@@ -239,7 +300,7 @@
             }
             .continue-btn__label {
               display: block;
-              height: 16px;
+              height: 20px;
               width: auto;
               max-width: 90%;
               pointer-events: none;
@@ -331,6 +392,13 @@
         return qText + "的讨论";
       }
 
+      function formatNavTitle(question) {
+        var titled = formatDiscussionTitle(question);
+        var maxLen = 14;
+        var short = titled.length > maxLen ? titled.slice(0, maxLen) + "..." : titled;
+        return short + "-U宝";
+      }
+
       function formatDate(ts) {
         var d = ts ? new Date(Number(ts)) : new Date();
         if (isNaN(d.getTime())) d = new Date();
@@ -397,7 +465,9 @@
         applyWeixinShareMeta();
         sharePayloadCache = data || null;
         var main = document.getElementById("main");
+        var navTitle = document.getElementById("navTitle");
         if (!data) {
+          if (navTitle) navTitle.textContent = "与AI助手-U宝";
           main.innerHTML = '<div class="empty">对话内容不存在或链接已失效</div>';
           refreshWxLaunchTagAttrs();
           return;
@@ -409,6 +479,7 @@
         var pageTitle = formatDiscussionTitle(firstQuestion);
         var dateText = formatDate(data.shareTime);
 
+        if (navTitle) navTitle.textContent = formatNavTitle(firstQuestion);
         document.title = pageTitle;
 
         var bodyHtml =
@@ -934,6 +1005,15 @@
       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>