| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
- <meta name="format-detection" content="telephone=no">
- <title>与U宝对话</title>
- <meta property="og:title" content="和U宝的对话">
- <meta property="og:description" content="点击查看对话内容">
- <meta property="og:site_name" content="U店在哪">
- <meta name="application-name" content="U店在哪">
- <link rel="icon" type="image/png" href="https://alien-volume.oss-cn-beijing.aliyuncs.com/icon/ubao.png">
- <link rel="apple-touch-icon" href="https://alien-volume.oss-cn-beijing.aliyuncs.com/icon/ubao.png">
- <style>
- :root {
- --bg: #f4f6fb;
- --text: #151515;
- --muted: #aaaaaa;
- --orange: #f47d1f;
- --safe-bottom: env(safe-area-inset-bottom, 0px);
- }
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- html {
- height: 100%;
- -webkit-tap-highlight-color: transparent;
- overflow: hidden;
- }
- body {
- font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
- background: var(--bg);
- color: var(--text);
- height: 100vh;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- }
- #main {
- flex: 1;
- min-height: 0;
- overflow-x: hidden;
- overflow-y: auto;
- -webkit-overflow-scrolling: touch;
- padding-bottom: calc(100px + var(--safe-bottom));
- }
- .hero {
- padding: 16px 15px 0;
- }
- .hero__title {
- font-size: 20px;
- font-weight: 700;
- line-height: 1.4;
- word-break: break-word;
- }
- .hero__meta {
- margin-top: 8px;
- font-size: 12px;
- color: var(--muted);
- line-height: 1.4;
- }
- .hero__divider {
- margin-top: 14px;
- height: 1px;
- background: rgba(170, 170, 170, 0.25);
- }
- .conversation {
- padding: 14px 15px 8px;
- }
- .scroll-spacer {
- height: calc(72px + var(--safe-bottom));
- flex-shrink: 0;
- }
- .conversation .row:last-child {
- margin-bottom: 0;
- }
- .row {
- display: flex;
- margin-bottom: 12px;
- }
- .row--user {
- justify-content: flex-end;
- }
- .row--ai {
- justify-content: flex-start;
- }
- .user-bubble {
- position: relative;
- max-width: 78%;
- padding: 10px 14px;
- background: var(--orange);
- border-radius: 8px 8px 2px 8px;
- color: #fff;
- font-size: 15px;
- font-weight: 500;
- line-height: 1.5;
- white-space: pre-wrap;
- word-break: break-word;
- }
- .user-bubble::after {
- content: "";
- position: absolute;
- right: -6px;
- bottom: 8px;
- width: 0;
- height: 0;
- border-style: solid;
- border-width: 6px 0 6px 7px;
- border-color: transparent transparent transparent var(--orange);
- }
- .ai-card {
- width: 100%;
- padding: 14px 13px;
- background: #fff;
- border-radius: 12px;
- box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
- }
- .ai-card__text {
- font-size: 14px;
- line-height: 1.65;
- white-space: pre-wrap;
- word-break: break-word;
- text-align: left;
- }
- .ai-card__image {
- display: block;
- max-width: 100%;
- height: auto;
- margin: 8px 0;
- border-radius: 6px;
- }
- .user-bubble__image {
- display: block;
- max-width: 180px;
- border-radius: 4px;
- }
- .fallback-card {
- margin: 14px 15px 0;
- padding: 14px 13px;
- background: #fff;
- border-radius: 8px;
- box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
- }
- .fallback-card .ai-card__text {
- font-size: 14px;
- line-height: 1.65;
- white-space: pre-wrap;
- word-break: break-word;
- text-align: left;
- }
- .empty {
- padding: 48px 20px;
- text-align: center;
- color: var(--muted);
- font-size: 14px;
- }
- .fab-wrap {
- position: fixed;
- left: 0;
- right: 0;
- bottom: 0;
- z-index: 200;
- padding: 12px 24px calc(12px + var(--safe-bottom));
- background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 70%, transparent);
- pointer-events: none;
- }
- .fab-dock__slot {
- width: 100%;
- max-width: 280px;
- height: 48px;
- margin: 0 auto;
- pointer-events: auto;
- }
- #openApp.fab {
- padding: 0 10px;
- -webkit-font-smoothing: antialiased;
- text-rendering: optimizeLegibility;
- }
- .fab__brand-clip {
- display: block;
- flex-shrink: 0;
- line-height: 0;
- }
- .fab__brand-img {
- display: block;
- height: 20px;
- width: auto;
- max-width: 90%;
- pointer-events: none;
- -webkit-user-drag: none;
- }
- .fab__label {
- font-size: 15px;
- line-height: 1;
- letter-spacing: 0.04em;
- white-space: nowrap;
- }
- #launch-btn {
- display: none;
- width: 100%;
- height: 48px;
- min-height: 48px;
- border-radius: 999px;
- overflow: hidden;
- opacity: 1;
- }
- body.is-wechat.wx-jssdk-ready #launch-btn {
- display: block;
- }
- body.is-wechat.wx-jssdk-ready #openApp {
- display: none !important;
- }
- .fab-wrap .fab {
- pointer-events: auto;
- }
- #openApp {
- touch-action: manipulation;
- }
- .fab {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 4px;
- width: 100%;
- max-width: 280px;
- margin: 0 auto;
- height: 48px;
- border: none;
- 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(255, 107, 62, 0.32);
- cursor: pointer;
- }
- .home-indicator {
- height: 5px;
- background: #000;
- border-radius: 3px;
- width: 134px;
- margin: 8px auto 4px;
- opacity: 0.2;
- }
- #openAppToast {
- display: none;
- position: fixed;
- left: 16px;
- right: 16px;
- bottom: calc(72px + var(--safe-bottom));
- z-index: 10001;
- padding: 10px 14px;
- font-size: 13px;
- line-height: 1.45;
- color: #fff;
- text-align: center;
- background: rgba(0, 0, 0, 0.78);
- border-radius: 8px;
- pointer-events: none;
- word-break: break-all;
- }
- </style>
- </head>
- <body>
- <main id="main">
- <div class="empty">对话内容加载中…</div>
- </main>
- <div id="openAppToast" role="status" aria-live="polite"></div>
- <div class="fab-wrap">
- <div class="fab-dock__slot">
- <!-- 与 secondShareGoods 相同顺序:openApp 在下,launch-btn 在上,避免挡住点击 -->
- <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/uCharts.png" alt="和U宝继续聊" decoding="async">
- </span>
- </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 10px;
- 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;
- overflow: hidden;
- -webkit-tap-highlight-color: transparent;
- box-sizing: border-box;
- font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
- -webkit-font-smoothing: antialiased;
- }
- .wx-open-app-btn .fab__brand-clip {
- display: block;
- flex-shrink: 0;
- line-height: 0;
- }
- .wx-open-app-btn .fab__brand-img {
- display: block;
- height: 20px;
- width: auto;
- max-width: 90%;
- pointer-events: none;
- -webkit-user-drag: none;
- }
- </style>
- <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/uCharts.png" alt="和U宝继续聊" decoding="async">
- </span>
- </button>
- </script>
- </wx-open-launch-app>
- </div>
- <div class="home-indicator" aria-hidden="true"></div>
- </div>
- <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
- <script>
- (function () {
- "use strict";
- var API_BASE = "https://prod.ailien.shop/alienStore";
- var WECHAT_MP_APP_ID = "wx412792c77f47babd";
- var WECHAT_OPEN_APP_ID = "wxf5f1efe3a9f5012e";
- var WECHAT_GET_WX_CONFIG_PATH = "/wx/getWxConfig";
- var H5_PAGE_BASE_FALLBACK = "https://prod.ailien.shop/h5/HBuilderProjects/";
- var WX_GET_CONFIG_SIGN_URL = H5_PAGE_BASE_FALLBACK + "shareAiConsult.html";
- var WECHAT_JS_SAFE_HOSTS = ["uat.ailien.shop", "prod.ailien.shop"];
- var APP_ANDROID_PACKAGE = "com.alien.Udianzaizhe";
- var APP_IOS_URL_SCHEME = "shopro://";
- var APP_UNI_AI_PATH = "pages/aiSearchResult/index";
- var AI_CONVERSATION_API =
- "http://183.252.196.135:9100/ai/life-manager/api/v1/legal-consultation/history/conversation";
- var sharePayloadCache = null;
- var weChatJssdkConfigured = false;
- var wxConfigSignRetriedBaseUrl = false;
- var wxInitLastError = "";
- var wxJssdkInitPromise = null;
- function escHtml(s) {
- return String(s || "")
- .replace(/&/g, "&")
- .replace(/</g, "<")
- .replace(/>/g, ">")
- .replace(/"/g, """);
- }
- var IMAGE_EXT = "(?:jpe?g|png|gif|webp|bmp|avif)";
- var IMAGE_URL_PATTERN =
- "https?:\\/\\/[^\\s))\\]]+\\." + IMAGE_EXT + "(?:\\?[^\\s))\\]]*)?";
- function isInsideImageUrlSyntax(full, offset) {
- if (offset >= 2 && full.slice(offset - 2, offset) === "](") return true;
- if (offset >= 1 && full[offset - 1] === "(") return true;
- if (offset >= 6 && full.slice(offset - 6, offset) === "{{IMG|") return true;
- return false;
- }
- /** AI 回复常见:店名(https://...jpg) — 转为可渲染的图片占位 */
- function embedInlineImageUrls(text) {
- if (text == null) return "";
- var t = String(text);
- t = t.replace(
- new RegExp("([^\\n((]+?)\\((" + IMAGE_URL_PATTERN + ")\\)", "gi"),
- function (_, label, url) {
- var name = String(label).trim();
- if (!name) return "\n\n{{IMG|" + url + "|}}\n\n";
- var alt = name.length > 24 ? "图片" : name.replace(/[\[\]]/g, "");
- return name + "\n\n{{IMG|" + url + "|" + alt + "}}\n\n";
- }
- );
- t = t.replace(
- new RegExp("\\((" + IMAGE_URL_PATTERN + ")\\)", "gi"),
- function (_, url) {
- return "\n\n{{IMG|" + url + "|}}\n\n";
- }
- );
- t = t.replace(new RegExp(IMAGE_URL_PATTERN, "gi"), function (url, offset, full) {
- if (isInsideImageUrlSyntax(full, offset)) return url;
- return "\n\n{{IMG|" + url + "|}}\n\n";
- });
- return t.replace(/\n{3,}/g, "\n\n");
- }
- function formatTextBlockHtml(text) {
- return escHtml(text).replace(/\n/g, "<br>");
- }
- function buildAiImageTag(url, alt) {
- var safeUrl = escHtml(url);
- var safeAlt = escHtml(alt || "图片");
- return (
- '<img class="ai-card__image" src="' +
- safeUrl +
- '" alt="' +
- safeAlt +
- '" loading="lazy" decoding="async" />'
- );
- }
- function renderAiContentHtml(text) {
- var t = embedInlineImageUrls(text);
- var html = "";
- var tokenRe = /\{\{IMG\|([^|]+)\|([^}]*)\}\}/g;
- var lastIndex = 0;
- var match;
- while ((match = tokenRe.exec(t)) !== null) {
- if (match.index > lastIndex) {
- html += formatTextBlockHtml(t.slice(lastIndex, match.index));
- }
- html += buildAiImageTag(match[1], match[2]);
- lastIndex = tokenRe.lastIndex;
- }
- if (lastIndex < t.length) {
- html += formatTextBlockHtml(t.slice(lastIndex));
- }
- return html;
- }
- function q(name) {
- try {
- var v = new URLSearchParams(location.search || "").get(name);
- return v == null ? "" : String(v);
- } catch (e) {
- return "";
- }
- }
- function getQueryParam(name) {
- var m = new RegExp("[?&]" + name + "=([^&]*)").exec(window.location.search);
- if (!m) return "";
- try {
- return decodeURIComponent(m[1].replace(/\+/g, " "));
- } catch (e) {
- return "";
- }
- }
- function parsePayload() {
- var raw = getQueryParam("payload");
- if (!raw) return null;
- try {
- return JSON.parse(raw);
- } catch (e) {
- return null;
- }
- }
- function getConversationQueryParams() {
- var sessionId = String(q("session_id") || q("sessionId") || "").trim();
- var userId = String(q("user_id") || q("userId") || "").trim();
- if (!sessionId || !userId) return null;
- return { sessionId: sessionId, userId: userId };
- }
- function buildConversationApiUrl(sessionId, userId) {
- var params = new URLSearchParams();
- params.set("session_id", sessionId);
- params.set("user_id", userId);
- return AI_CONVERSATION_API + "?" + params.toString();
- }
- function normalizeConversationRole(raw) {
- var role = String(raw || "").trim().toLowerCase();
- if (
- role === "user" ||
- role === "human" ||
- role === "customer" ||
- role === "question" ||
- role === "1" ||
- role === "我"
- ) {
- return "user";
- }
- if (
- role === "ai" ||
- role === "assistant" ||
- role === "bot" ||
- role === "ubao" ||
- role === "answer" ||
- role === "2" ||
- role === "system"
- ) {
- return "ai";
- }
- return "";
- }
- function normalizeConversationApiPayload(res) {
- if (!res || typeof res !== "object") return null;
- if (res.code != null) {
- var code = Number(res.code);
- if (code !== 200 && code !== 0 && res.success !== true) {
- throw new Error(res.msg || res.message || "对话接口返回 code " + code);
- }
- }
- var root = res.data != null && typeof res.data === "object" ? res.data : res;
- var rawList =
- (Array.isArray(root) && root) ||
- (Array.isArray(root.messages) && root.messages) ||
- (Array.isArray(root.messageList) && root.messageList) ||
- (Array.isArray(root.conversation) && root.conversation) ||
- (Array.isArray(root.conversations) && root.conversations) ||
- (Array.isArray(root.records) && root.records) ||
- (Array.isArray(root.list) && root.list) ||
- null;
- if (!rawList) return null;
- var messages = [];
- for (var i = 0; i < rawList.length; i++) {
- var item = rawList[i];
- if (!item || typeof item !== "object") continue;
- var role = normalizeConversationRole(
- item.role || item.sender || item.messageRole || item.type || item.messageType || item.senderType
- );
- var content = String(
- item.content != null
- ? item.content
- : item.message != null
- ? item.message
- : item.text != null
- ? item.text
- : ""
- ).trim();
- if (!role && item.question) {
- role = "user";
- content = String(item.question).trim();
- } else if (!role && item.answer) {
- role = "ai";
- content = String(item.answer).trim();
- } else if (!role && item.userMessage) {
- role = "user";
- content = String(item.userMessage).trim();
- } else if (!role && (item.aiMessage || item.assistantMessage)) {
- role = "ai";
- content = String(item.aiMessage || item.assistantMessage).trim();
- }
- if (!content) continue;
- var imageUrl = item.imageUrl || item.image || item.imgUrl || item.url;
- if (imageUrl && /^(https?:)?\/\//i.test(String(imageUrl))) {
- messages.push({
- role: role || "user",
- isImage: true,
- imageUrl: String(imageUrl),
- });
- continue;
- }
- messages.push({
- role: role || (messages.length % 2 === 0 ? "user" : "ai"),
- content: content,
- });
- }
- if (!messages.length) return null;
- return {
- messages: messages,
- shareTime:
- root.shareTime ||
- root.createdAt ||
- root.createTime ||
- root.updateTime ||
- root.timestamp ||
- res.timestamp,
- firstQuestion: root.firstQuestion || root.title || root.topic || "",
- sessionId: root.sessionId || root.session_id || "",
- userId: root.userId || root.user_id || "",
- };
- }
- function fetchConversationHistory(sessionId, userId) {
- var requestUrl = buildConversationApiUrl(sessionId, userId);
- console.log("[conversation-api] GET", requestUrl);
- return fetch(requestUrl, {
- method: "GET",
- mode: "cors",
- credentials: "omit",
- headers: { Accept: "application/json" },
- })
- .then(function (r) {
- if (r.ok) return r.json();
- return r
- .text()
- .catch(function () {
- return "";
- })
- .then(function (text) {
- var hint = "";
- try {
- var j = JSON.parse(text);
- hint = j.msg || j.message || "";
- } catch (eP) {
- if (text) hint = text.slice(0, 120);
- }
- throw new Error("对话接口 HTTP " + r.status + (hint ? ":" + hint : ""));
- });
- })
- .then(function (res) {
- var data = normalizeConversationApiPayload(res);
- if (!data) {
- throw new Error("对话接口返回数据为空或格式无法解析");
- }
- return data;
- });
- }
- function loadPageData() {
- var main = document.getElementById("main");
- var params = getConversationQueryParams();
- if (!params) {
- render(parsePayload());
- return;
- }
- main.innerHTML = '<div class="empty">对话内容加载中…</div>';
- fetchConversationHistory(params.sessionId, params.userId)
- .then(function (data) {
- render(data);
- })
- .catch(function (e) {
- var tip = e && e.message ? e.message : "对话加载失败,请稍后重试";
- console.warn("[conversation-api]", tip, e);
- main.innerHTML = '<div class="empty">' + escHtml(tip) + "</div>";
- refreshWxLaunchTagAttrs();
- });
- }
- function getFirstUserQuestion(messages) {
- var list = Array.isArray(messages) ? messages : [];
- for (var i = 0; i < list.length; i++) {
- var m = list[i];
- if (!m || m.role !== "user") continue;
- if (m.isImage) return "[图片]";
- var t = String(m.content || "").trim();
- if (t) return t;
- }
- return "";
- }
- function formatDiscussionTitle(question) {
- var qText = String(question || "").trim();
- if (!qText) return "与AI助手对话";
- if (qText.slice(-3) === "的讨论") return qText;
- return qText + "的讨论";
- }
- function formatDate(ts) {
- var d = ts ? new Date(Number(ts)) : new Date();
- if (isNaN(d.getTime())) d = new Date();
- return d.getFullYear() + "年" + (d.getMonth() + 1) + "月" + d.getDate() + "日";
- }
- function renderMessages(messages) {
- var html = "";
- var list = Array.isArray(messages) ? messages : [];
- for (var i = 0; i < list.length; i++) {
- var msg = list[i];
- if (!msg) continue;
- if (msg.role === "user") {
- if (msg.isImage && msg.imageUrl) {
- html +=
- '<div class="row row--user"><div class="user-bubble"><img class="user-bubble__image" src="' +
- escHtml(msg.imageUrl) +
- '" alt="图片" loading="lazy" decoding="async" /></div></div>';
- continue;
- }
- var userText = String(msg.content || "").trim();
- if (!userText) continue;
- html +=
- '<div class="row row--user"><div class="user-bubble">' +
- escHtml(userText) +
- "</div></div>";
- continue;
- }
- if (msg.role === "ai" || msg.role === "assistant") {
- var aiText = String(msg.content || "").trim();
- if (!aiText) continue;
- html +=
- '<div class="row row--ai"><div class="ai-card"><div class="ai-card__text">' +
- renderAiContentHtml(aiText) +
- "</div></div></div>";
- }
- }
- return html;
- }
- function applyWeixinShareMeta() {
- var siteName = "U店在哪";
- var iconUrl =
- "https://alien-volume.oss-cn-beijing.aliyuncs.com/icon/ubao.png";
- var setMeta = function (key, content) {
- var el =
- document.querySelector('meta[property="' + key + '"]') ||
- document.querySelector('meta[name="' + key + '"]');
- if (!el) {
- el = document.createElement("meta");
- if (key.indexOf("og:") === 0) {
- el.setAttribute("property", key);
- } else {
- el.setAttribute("name", key);
- }
- document.head.appendChild(el);
- }
- el.setAttribute("content", content);
- };
- setMeta("og:site_name", siteName);
- setMeta("application-name", siteName);
- setMeta("og:title", "和U宝的对话");
- setMeta("og:description", "点击查看对话内容");
- var links = document.querySelectorAll('link[rel="icon"], link[rel="apple-touch-icon"]');
- for (var i = 0; i < links.length; i++) {
- links[i].setAttribute("href", iconUrl);
- }
- }
- function countDisplayableMessages(messages) {
- var list = Array.isArray(messages) ? messages : [];
- var count = 0;
- for (var i = 0; i < list.length; i++) {
- var msg = list[i];
- if (!msg) continue;
- if (msg.role === "user") {
- if (msg.isImage && msg.imageUrl) {
- count += 1;
- continue;
- }
- if (String(msg.content || "").trim()) count += 1;
- continue;
- }
- if (msg.role === "ai" || msg.role === "assistant") {
- if (String(msg.content || "").trim()) count += 1;
- }
- }
- return count;
- }
- function parseMessagesFromContent(text) {
- var raw = String(text || "").trim();
- if (!raw) return [];
- var list = [];
- var blocks = raw.split(/\n\n+/);
- for (var i = 0; i < blocks.length; i++) {
- var block = String(blocks[i] || "").trim();
- if (!block) continue;
- var userMatch = block.match(/^我[::]\s*([\s\S]*)$/);
- if (userMatch) {
- var userText = String(userMatch[1] || "").trim();
- if (userText) list.push({ role: "user", content: userText });
- continue;
- }
- var aiMatch = block.match(/^UBAO[::]\s*([\s\S]*)$/i);
- if (aiMatch) {
- var aiText = String(aiMatch[1] || "").trim();
- if (aiText) list.push({ role: "ai", content: aiText });
- }
- }
- if (list.length) return list;
- var current = null;
- var lines = raw.split(/\n/);
- for (var j = 0; j < lines.length; j++) {
- var line = String(lines[j] || "");
- var userLine = line.match(/^我[::]\s*(.*)$/);
- var aiLine = line.match(/^UBAO[::]\s*(.*)$/i);
- if (userLine) {
- if (current) list.push(current);
- current = { role: "user", content: String(userLine[1] || "").trim() };
- continue;
- }
- if (aiLine) {
- if (current) list.push(current);
- current = { role: "ai", content: String(aiLine[1] || "").trim() };
- continue;
- }
- if (current && line.trim()) {
- current.content = (current.content ? current.content + "\n" : "") + line.trim();
- }
- }
- if (current && String(current.content || "").trim()) list.push(current);
- return list;
- }
- function resolveShareMessagesForDisplay(data) {
- var fromArray = Array.isArray(data && data.messages) ? data.messages : [];
- var fromContent = parseMessagesFromContent((data && data.content) || "");
- var arrayCount = countDisplayableMessages(fromArray);
- var contentCount = countDisplayableMessages(fromContent);
- // 分享链接超长时 messages 会被截断,但 content 仍保留完整对话文本
- if (contentCount > arrayCount) return fromContent;
- if (arrayCount) return fromArray;
- return fromContent;
- }
- function render(data) {
- applyWeixinShareMeta();
- sharePayloadCache = data || null;
- var main = document.getElementById("main");
- if (!data) {
- main.innerHTML = '<div class="empty">对话内容不存在或链接已失效</div>';
- refreshWxLaunchTagAttrs();
- return;
- }
- var messages = resolveShareMessagesForDisplay(data);
- var firstQuestion =
- String(data.firstQuestion || "").trim() ||
- getFirstUserQuestion(messages) ||
- (function () {
- var text = String(data.content || "").trim();
- var m = text.match(/^我[::]([\s\S]+?)(?:\n\n|$)/);
- return m ? String(m[1] || "").trim() : "";
- })();
- var pageTitle = formatDiscussionTitle(firstQuestion);
- var dateText = formatDate(data.shareTime);
- document.title = pageTitle;
- var bodyHtml =
- '<section class="hero">' +
- '<h1 class="hero__title">' +
- escHtml(pageTitle) +
- "</h1>" +
- '<p class="hero__meta">' +
- escHtml(dateText) +
- " · 内容由AI生成,不能完全保障真实</p>" +
- '<div class="hero__divider"></div>' +
- "</section>";
- var convHtml = renderMessages(messages);
- if (convHtml) {
- bodyHtml +=
- '<section class="conversation">' +
- convHtml +
- '</section><div class="scroll-spacer" aria-hidden="true"></div>';
- } else {
- bodyHtml += '<div class="empty">暂无对话内容</div>';
- }
- main.innerHTML = bodyHtml;
- refreshWxLaunchTagAttrs();
- }
- function buildAiConsultOpenParams() {
- var params = new URLSearchParams();
- params.set("pageType", "home");
- params.set("fromShareAiConsult", "1");
- return params;
- }
- function buildAppDeepLink() {
- var path = APP_UNI_AI_PATH;
- var qs = buildAiConsultOpenParams().toString();
- var root = APP_IOS_URL_SCHEME.replace(/\/$/, "");
- return root + "/" + path + (qs ? "?" + qs : "");
- }
- function buildWeChatLaunchExtinfo(useBarePathOnly) {
- var path = APP_UNI_AI_PATH.replace(/^\//, "");
- if (useBarePathOnly) return path;
- var qs = buildAiConsultOpenParams().toString();
- var uniPage = qs ? path + "?" + qs : path;
- if (uniPage.length <= 1024) return uniPage;
- return path + "?pageType=home&fromShareAiConsult=1";
- }
- function isWeChatInAppBrowser() {
- return /MicroMessenger/i.test(navigator.userAgent || "");
- }
- function getWxShareEntryFrom() {
- var from = q("from");
- if (from) return String(from).trim().toLowerCase();
- try {
- var h = location.hash || "";
- var qi = h.indexOf("?");
- if (qi >= 0) {
- var hf = new URLSearchParams(h.slice(qi + 1)).get("from");
- if (hf) return String(hf).trim().toLowerCase();
- }
- } catch (eH) {}
- return "";
- }
- function logWxEntryDiagnostics() {
- if (!isWeChatInAppBrowser()) return;
- console.log("[wx-entry]", {
- entryFrom: getWxShareEntryFrom() || "(无)",
- wxJssdkReady: weChatJssdkConfigured,
- signUrl: getWxConfigSignUrl(),
- });
- }
- function isIOSWeChatBrowser() {
- var ua = navigator.userAgent || "";
- return /MicroMessenger/i.test(ua) && /iPhone|iPad|iPod/i.test(ua);
- }
- function isWxDebugOn() {
- return q("wxDebug") === "1";
- }
- function isWxForceDebug() {
- return q("wxForce") === "1";
- }
- function isWxConfigOnClickDebug() {
- return q("wxConfigOnClick") === "1";
- }
- function isWxPcAutoDebugHost() {
- var h = (location.hostname || "").toLowerCase();
- if (h === "localhost" || h === "127.0.0.1") return true;
- for (var i = 0; i < WECHAT_JS_SAFE_HOSTS.length; i++) {
- if (WECHAT_JS_SAFE_HOSTS[i] === h) return true;
- }
- return false;
- }
- function isWxPcBrowser() {
- return !isWeChatInAppBrowser();
- }
- function shouldInitWeChatJssdkOnLoad() {
- if (isWeChatInAppBrowser()) return true;
- return isWxForceDebug() || isWxPcAutoDebugHost();
- }
- function shouldFetchWxConfig(fromUserClick) {
- if (isWeChatInAppBrowser()) return true;
- if (fromUserClick) return true;
- return isWxForceDebug() || isWxPcAutoDebugHost();
- }
- function getWxHtmlUrl() {
- var forced = String(q("wxSignUrl") || "").trim();
- if (forced) return forced.split("#")[0];
- return String(location.href || "").split("#")[0];
- }
- function getWxSignPageUrlForApi() {
- var htmlUrl = getWxHtmlUrl();
- if (htmlUrl && /^https?:\/\//i.test(htmlUrl)) return htmlUrl;
- return WX_GET_CONFIG_SIGN_URL;
- }
- function getWxHtmlUrlBase() {
- var htmlUrl = getWxSignPageUrlForApi();
- try {
- var u = new URL(htmlUrl);
- return u.origin + u.pathname;
- } catch (eU) {
- return WX_GET_CONFIG_SIGN_URL;
- }
- }
- /** 与 secondShareGoods 一致:默认用当前页完整 URL 验签(须与微信地址栏一致,含 query) */
- function getWxConfigSignUrl() {
- if (String(q("wxSignBaseOnly") || "") === "1") return getWxHtmlUrlBase();
- return getWxSignPageUrlForApi();
- }
- function getWxGetConfigApiUrl() {
- return API_BASE.replace(/\/$/, "") + WECHAT_GET_WX_CONFIG_PATH;
- }
- function buildWxGetConfigRequestBody(htmlUrl) {
- return {
- url: String(htmlUrl || "").split("#")[0].trim(),
- };
- }
- function resolveWxConfigAppIdFromSignData(d) {
- if (!d || typeof d !== "object") return "";
- var mp =
- d.mpAppId ||
- d.mpAppid ||
- d.officialAppId ||
- d.gzhAppId ||
- d.serviceAppId;
- if (mp != null && String(mp).trim() !== "") return String(mp).trim();
- var fromQuery = String(q("wxMpAppId") || WECHAT_MP_APP_ID || "").trim();
- if (fromQuery) return fromQuery;
- var raw = d.appId || d.appid || d.wxAppId;
- return raw != null && String(raw).trim() !== "" ? String(raw).trim() : "";
- }
- function normalizeWxJssdkSignPayload(res, signUrlUsed) {
- if (!res || typeof res !== "object") return null;
- var d = res.data != null && typeof res.data === "object" ? res.data : res;
- if (!d || typeof d !== "object") return null;
- var appId = resolveWxConfigAppIdFromSignData(d);
- var timestamp = d.timestamp != null ? d.timestamp : d.timeStamp;
- var nonceStr =
- d.nonceStr != null && String(d.nonceStr) !== ""
- ? d.nonceStr
- : d.noncestr != null && String(d.noncestr) !== ""
- ? d.noncestr
- : d.nonce;
- var signature = d.signature || d.sign;
- if (!appId || timestamp == null || nonceStr == null || nonceStr === "" || !signature) {
- return null;
- }
- return {
- appId: String(appId),
- timestamp: Number(timestamp),
- nonceStr: String(nonceStr),
- signature: String(signature),
- signUrl: String(signUrlUsed || "")
- .split("#")[0]
- .trim(),
- };
- }
- function getWxErrMsg(err) {
- if (!err) return "";
- if (err.errMsg) return String(err.errMsg);
- if (typeof err === "string") return err;
- try {
- return JSON.stringify(err);
- } catch (e) {
- return String(err);
- }
- }
- function formatWxConfigErrorTip(err, signPageUrl) {
- var errMsg = getWxErrMsg(err);
- var tip = "微信 JSSDK 配置失败";
- if (/invalid signature/i.test(errMsg)) {
- return (
- tip +
- ":签名无效。请核对:①后端用与前端相同的 url 签名;②url=" +
- (signPageUrl || getWxHtmlUrl()) +
- ";③nonceStr/timestamp 与接口返回一致;④appId=" +
- WECHAT_MP_APP_ID
- );
- }
- if (/require\s*subscribe/i.test(errMsg)) {
- return tip + ":" + errMsg + "(服务号需用户已关注)";
- }
- return errMsg ? tip + ":" + errMsg : tip;
- }
- function setWxInitError(msg) {
- wxInitLastError = String(msg || "").trim();
- if (wxInitLastError) console.warn("[wx]", wxInitLastError);
- }
- function requestWeChatJssdkSignAndConfig(htmlUrlOptional) {
- var htmlUrl = String(htmlUrlOptional != null ? htmlUrlOptional : getWxConfigSignUrl())
- .split("#")[0]
- .trim();
- if (!htmlUrl || !/^https?:\/\//i.test(htmlUrl)) {
- htmlUrl = WX_GET_CONFIG_SIGN_URL;
- }
- if (isWxDebugOn()) {
- try {
- window.alert("htmlUrl(签名用,应与地址栏一致):\n" + htmlUrl);
- } catch (eDbg) {}
- }
- var requestUrl = getWxGetConfigApiUrl();
- var requestBody = buildWxGetConfigRequestBody(htmlUrl);
- console.log("[wx] htmlUrl=", htmlUrl);
- console.log("[wx] POST getWxConfig →", requestUrl, requestBody);
- return fetch(requestUrl, {
- method: "POST",
- mode: "cors",
- credentials: "omit",
- headers: {
- Accept: "application/json",
- "Content-Type": "application/json;charset=UTF-8",
- },
- body: JSON.stringify(requestBody),
- })
- .then(function (r) {
- if (r.ok) return r.json();
- return r
- .text()
- .catch(function () {
- return "";
- })
- .then(function (text) {
- var hint = "";
- try {
- var j = JSON.parse(text);
- hint = j.msg || j.message || "";
- } catch (eP) {
- if (text) hint = text.slice(0, 120);
- }
- throw new Error("getWxConfig HTTP " + r.status + (hint ? ":" + hint : ""));
- });
- })
- .then(function (res) {
- if (res && res.code != null) {
- var c = Number(res.code);
- if (c !== 200 && c !== 0 && res.success !== true) {
- throw new Error(res.msg || res.message || "getWxConfig code " + c);
- }
- }
- var sign = normalizeWxJssdkSignPayload(res, htmlUrl);
- if (!sign) {
- console.warn("[wx] getWxConfig 响应字段不全", res, "htmlUrl=", htmlUrl);
- throw new Error("getWxConfig 缺少 appId/timestamp/nonceStr/signature(见控制台)");
- }
- if (sign.appId !== WECHAT_MP_APP_ID) {
- console.warn(
- "[wx] 后端 appId=" + sign.appId + ",期望服务号 " + WECHAT_MP_APP_ID
- );
- }
- if (typeof wx === "undefined") {
- if (isWxPcBrowser()) {
- console.log("[wx] PC getWxConfig 成功(无 jweixin)", sign);
- return true;
- }
- setWxInitError("jweixin.js 未加载");
- return false;
- }
- return applyWxConfigFromSign(sign, htmlUrl);
- });
- }
- function applyWxConfigFromSign(sign, htmlUrl) {
- var wxConfigParams = {
- debug: isWxDebugOn(),
- appId: String(sign.appId),
- timestamp: sign.timestamp,
- nonceStr: String(sign.nonceStr),
- signature: String(sign.signature),
- jsApiList: [],
- openTagList: ["wx-open-launch-app"],
- };
- return new Promise(function (resolve) {
- wx.config(wxConfigParams);
- wx.ready(function () {
- weChatJssdkConfigured = true;
- document.body.classList.add("wx-jssdk-ready");
- refreshWxLaunchTagAttrs();
- console.log("[wx.config] ready, htmlUrl=", htmlUrl);
- resolve(true);
- });
- wx.error(function (err) {
- weChatJssdkConfigured = false;
- document.body.classList.remove("wx-jssdk-ready");
- wxJssdkInitPromise = null;
- var errMsg = getWxErrMsg(err);
- setWxInitError(formatWxConfigErrorTip(err, htmlUrl));
- if (isWxDebugOn()) window.alert(wxInitLastError);
- console.warn("[wx.config]", errMsg, "htmlUrl=", htmlUrl);
- var baseUrl = getWxHtmlUrlBase();
- var fullUrl = getWxSignPageUrlForApi();
- if (
- !/invalid signature/i.test(errMsg) ||
- wxConfigSignRetriedBaseUrl ||
- baseUrl === fullUrl ||
- htmlUrl === baseUrl
- ) {
- resolve(false);
- return;
- }
- wxConfigSignRetriedBaseUrl = true;
- requestWeChatJssdkSignAndConfig(baseUrl).then(resolve);
- });
- });
- }
- function refreshWxLaunchTagAttrs(useBarePathOnly) {
- var tag = document.getElementById("launch-btn");
- if (!tag) return;
- try {
- tag.setAttribute("appid", WECHAT_OPEN_APP_ID);
- tag.setAttribute("extinfo", buildWeChatLaunchExtinfo(!!useBarePathOnly));
- console.log("[wx-open-launch-app] extinfo=", tag.getAttribute("extinfo"));
- } catch (eA) {}
- }
- function bindWeChatLaunchTagEvents() {
- var tag = document.getElementById("launch-btn");
- if (!tag || tag._wxLaunchBound) return;
- tag._wxLaunchBound = true;
- refreshWxLaunchTagAttrs();
- tag.addEventListener("launch", function () {
- console.log("[wx-open-launch-app] launch ok");
- });
- tag.addEventListener("error", function (e) {
- var detail = e && e.detail;
- var errMsg =
- detail && detail.errMsg
- ? String(detail.errMsg)
- : detail && detail.errmsg
- ? String(detail.errmsg)
- : "";
- console.warn(
- "[wx-open-launch-app]",
- detail,
- "extinfo=",
- tag.getAttribute("extinfo")
- );
- if (/launch:fail_check/i.test(errMsg)) {
- showAppOpenFailTip(
- "请用微信分享卡片进入,或确认已安装最新版「U店在哪」"
- );
- return;
- }
- if (
- /launch:fail/i.test(errMsg) &&
- !tag._wxLaunchBareRetried &&
- tag.getAttribute("extinfo") !== buildWeChatLaunchExtinfo(true)
- ) {
- tag._wxLaunchBareRetried = true;
- refreshWxLaunchTagAttrs(true);
- showFabToast("请再点一次「和U宝继续聊」");
- return;
- }
- if (/launch:fail/i.test(errMsg) && !getWxShareEntryFrom()) {
- showAppOpenFailTip("请前往应用商店下载U店在哪app");
- return;
- }
- showAppOpenFailTip(
- errMsg
- ? "未能打开 App:" + errMsg
- : "未能打开 App,请确认已安装最新版「U店在哪」"
- );
- });
- }
- function initWeChatOpenLaunchApp(fromUserClick) {
- if (!shouldFetchWxConfig(!!fromUserClick)) {
- return Promise.resolve(false);
- }
- if (wxJssdkInitPromise && !fromUserClick) return wxJssdkInitPromise;
- wxConfigSignRetriedBaseUrl = false;
- wxInitLastError = "";
- var htmlUrl = getWxConfigSignUrl();
- bindWeChatLaunchTagEvents();
- wxJssdkInitPromise = requestWeChatJssdkSignAndConfig(htmlUrl)
- .then(function (ok) {
- if (ok === true) return true;
- if (!wxInitLastError) {
- setWxInitError("wx.config 失败,可加 ?wxDebug=1 查看 htmlUrl");
- }
- return false;
- })
- .catch(function (e) {
- var msg = e && e.message ? e.message : "getWxConfig 请求失败";
- setWxInitError(msg);
- console.warn("[wx] requestWeChatJssdkSignAndConfig failed", msg, "htmlUrl=", htmlUrl);
- if (isWeChatInAppBrowser() && isWxDebugOn()) window.alert(msg);
- return false;
- })
- .finally(function () {
- if (!weChatJssdkConfigured) wxJssdkInitPromise = null;
- });
- return wxJssdkInitPromise;
- }
- function scheduleWeChatJssdkBootstrap() {
- if (!shouldInitWeChatJssdkOnLoad()) return;
- var attempts = 0;
- function tick() {
- attempts += 1;
- if (weChatJssdkConfigured) return;
- initWeChatOpenLaunchApp();
- if (!weChatJssdkConfigured && attempts < 8 && typeof wx === "undefined") {
- setTimeout(tick, 400);
- }
- }
- if (isIOSWeChatBrowser()) {
- setTimeout(tick, 350);
- } else {
- tick();
- }
- }
- function showFabToast(msg, ms) {
- var tip = String(msg || "").trim();
- if (!tip) return;
- var el = document.getElementById("openAppToast");
- if (el) {
- el.textContent = tip;
- el.style.display = "block";
- if (showFabToast._t) clearTimeout(showFabToast._t);
- showFabToast._t = setTimeout(function () {
- el.style.display = "none";
- }, ms || 2800);
- }
- console.log("[openApp]", tip);
- }
- function showDownloadTip() {
- var msg = "请到应用商店下载「U店在哪」";
- if (typeof uni !== "undefined" && typeof uni.showToast === "function") {
- uni.showToast({ title: msg, icon: "none", duration: 2500 });
- } else {
- window.alert(msg);
- }
- }
- 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);
- } else {
- showFabToast(tip);
- }
- }
- function launchAppDeepLink(deepLink) {
- try {
- var a = document.createElement("a");
- a.href = deepLink;
- a.setAttribute("target", "_self");
- document.body.appendChild(a);
- a.click();
- document.body.removeChild(a);
- } catch (e1) {}
- try {
- window.location.href = deepLink;
- } catch (e2) {}
- }
- function tryOpenHBuilderAppViaScheme() {
- var deepLink = buildAppDeepLink();
- if (typeof plus !== "undefined" && plus.runtime) {
- var installed = null;
- try {
- if (typeof plus.runtime.isApplicationExist === "function") {
- installed = plus.runtime.isApplicationExist({
- pname: APP_ANDROID_PACKAGE,
- action: APP_IOS_URL_SCHEME,
- });
- }
- } catch (e) {
- console.warn(e);
- }
- if (installed === false) {
- showDownloadTip();
- return;
- }
- try {
- plus.runtime.openURL(deepLink);
- } catch (e2) {
- console.warn(e2);
- showDownloadTip();
- }
- return;
- }
- var done = false;
- function finish() {
- if (done) return;
- done = true;
- document.removeEventListener("visibilitychange", onVis);
- window.removeEventListener("pagehide", onHide);
- }
- function onVis() {
- if (document.visibilityState === "hidden") finish();
- }
- function onHide() {
- finish();
- }
- document.addEventListener("visibilitychange", onVis);
- window.addEventListener("pagehide", onHide);
- try {
- launchAppDeepLink(deepLink);
- } catch (e3) {
- finish();
- showDownloadTip();
- return;
- }
- window.setTimeout(function () {
- finish();
- }, 3200);
- }
- function tryFetchWxConfigOnPcClick() {
- if (!isWxPcBrowser()) return Promise.resolve(false);
- showFabToast("正在请求 getWxConfig…");
- wxJssdkInitPromise = null;
- return initWeChatOpenLaunchApp(true).then(function (ok) {
- if (ok) {
- showFabToast(
- weChatJssdkConfigured
- ? "getWxConfig 成功,wx.config 已就绪"
- : "getWxConfig 成功"
- );
- } else {
- showFabToast(wxInitLastError || "getWxConfig 失败");
- }
- return ok;
- });
- }
- function tryOpenHBuilderApp() {
- if (isWeChatInAppBrowser()) return;
- if (!isWxPcBrowser()) {
- tryOpenHBuilderAppViaScheme();
- return;
- }
- tryFetchWxConfigOnPcClick().then(function () {
- if (isWxConfigOnClickDebug() && !isWxForceDebug() && !isWxPcAutoDebugHost()) {
- return;
- }
- tryOpenHBuilderAppViaScheme();
- });
- }
- function boot() {
- var launchTag = document.getElementById("launch-btn");
- if (launchTag) launchTag.setAttribute("appid", WECHAT_OPEN_APP_ID);
- bindWeChatLaunchTagEvents();
- if (isWeChatInAppBrowser()) {
- document.body.classList.add("is-wechat");
- logWxEntryDiagnostics();
- }
- if (shouldInitWeChatJssdkOnLoad()) {
- if (isWxPcBrowser() && (isWxForceDebug() || isWxPcAutoDebugHost())) {
- document.body.classList.add("wx-pc-debug");
- }
- scheduleWeChatJssdkBootstrap();
- }
- document.addEventListener("WeixinOpenTagsError", function (e) {
- console.warn("[WeixinOpenTagsError]", e && e.detail);
- });
- if (isWeChatInAppBrowser()) {
- var openBtnWx = document.getElementById("openApp");
- if (openBtnWx) {
- openBtnWx.addEventListener("click", function () {
- if (!weChatJssdkConfigured) {
- showFabToast(
- wxInitLastError || "微信 SDK 初始化中,请稍候再点底部按钮"
- );
- }
- });
- }
- } else {
- var openAppBtn = document.getElementById("openApp");
- if (openAppBtn) {
- openAppBtn.addEventListener("click", tryOpenHBuilderApp);
- }
- }
- loadPageData();
- }
- if (document.readyState === "complete") {
- boot();
- } else {
- window.addEventListener("load", boot);
- }
- })();
- </script>
- </body>
- </html>
|