|
|
@@ -310,90 +310,6 @@
|
|
|
word-break: break-all;
|
|
|
}
|
|
|
|
|
|
- .api-debug-mask {
|
|
|
- display: none;
|
|
|
- position: fixed;
|
|
|
- inset: 0;
|
|
|
- z-index: 10050;
|
|
|
- background: rgba(0, 0, 0, 0.45);
|
|
|
- align-items: flex-end;
|
|
|
- justify-content: center;
|
|
|
- padding: 0;
|
|
|
- }
|
|
|
-
|
|
|
- .api-debug-mask.is-open {
|
|
|
- display: flex;
|
|
|
- }
|
|
|
-
|
|
|
- .api-debug-sheet {
|
|
|
- width: 100%;
|
|
|
- max-height: 78vh;
|
|
|
- background: #fff;
|
|
|
- border-radius: 16px 16px 0 0;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- overflow: hidden;
|
|
|
- padding-bottom: var(--safe-bottom);
|
|
|
- }
|
|
|
-
|
|
|
- .api-debug-sheet__head {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
- padding: 16px 16px 10px;
|
|
|
- border-bottom: 1px solid rgba(170, 170, 170, 0.25);
|
|
|
- flex-shrink: 0;
|
|
|
- }
|
|
|
-
|
|
|
- .api-debug-sheet__title {
|
|
|
- font-size: 16px;
|
|
|
- font-weight: 700;
|
|
|
- color: var(--text);
|
|
|
- }
|
|
|
-
|
|
|
- .api-debug-sheet__close {
|
|
|
- width: 32px;
|
|
|
- height: 32px;
|
|
|
- border: none;
|
|
|
- background: transparent;
|
|
|
- font-size: 22px;
|
|
|
- line-height: 1;
|
|
|
- color: #999;
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
-
|
|
|
- .api-debug-sheet__body {
|
|
|
- flex: 1;
|
|
|
- min-height: 0;
|
|
|
- overflow-y: auto;
|
|
|
- -webkit-overflow-scrolling: touch;
|
|
|
- padding: 12px 16px 20px;
|
|
|
- }
|
|
|
-
|
|
|
- .api-debug-block {
|
|
|
- margin-bottom: 14px;
|
|
|
- }
|
|
|
-
|
|
|
- .api-debug-block__label {
|
|
|
- font-size: 13px;
|
|
|
- font-weight: 600;
|
|
|
- color: var(--text);
|
|
|
- margin-bottom: 6px;
|
|
|
- }
|
|
|
-
|
|
|
- .api-debug-block__content {
|
|
|
- font-size: 12px;
|
|
|
- line-height: 1.55;
|
|
|
- color: #444;
|
|
|
- background: #f7f8fa;
|
|
|
- border-radius: 8px;
|
|
|
- padding: 10px 12px;
|
|
|
- white-space: pre-wrap;
|
|
|
- word-break: break-all;
|
|
|
- font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
|
- max-height: 240px;
|
|
|
- overflow-y: auto;
|
|
|
- }
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
@@ -403,29 +319,6 @@
|
|
|
|
|
|
<div id="openAppToast" role="status" aria-live="polite"></div>
|
|
|
|
|
|
- <div class="api-debug-mask" id="apiDebugMask" aria-hidden="true">
|
|
|
- <div class="api-debug-sheet" role="dialog" aria-labelledby="apiDebugTitle">
|
|
|
- <div class="api-debug-sheet__head">
|
|
|
- <span class="api-debug-sheet__title" id="apiDebugTitle">接口调试信息</span>
|
|
|
- <button type="button" class="api-debug-sheet__close" id="apiDebugClose" aria-label="关闭">×</button>
|
|
|
- </div>
|
|
|
- <div class="api-debug-sheet__body">
|
|
|
- <div class="api-debug-block">
|
|
|
- <div class="api-debug-block__label">接口完整地址</div>
|
|
|
- <pre class="api-debug-block__content" id="apiDebugUrl"></pre>
|
|
|
- </div>
|
|
|
- <div class="api-debug-block">
|
|
|
- <div class="api-debug-block__label">请求参数</div>
|
|
|
- <pre class="api-debug-block__content" id="apiDebugParams"></pre>
|
|
|
- </div>
|
|
|
- <div class="api-debug-block">
|
|
|
- <div class="api-debug-block__label">接口返回数据</div>
|
|
|
- <pre class="api-debug-block__content" id="apiDebugResponse"></pre>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
<div class="fab-wrap">
|
|
|
<div class="fab-dock__slot">
|
|
|
<!-- 与 secondShareGoods 相同顺序:openApp 在下,launch-btn 在上,避免挡住点击 -->
|
|
|
@@ -504,7 +397,6 @@
|
|
|
var wxConfigSignRetriedBaseUrl = false;
|
|
|
var wxInitLastError = "";
|
|
|
var wxJssdkInitPromise = null;
|
|
|
- var lastApiDebugInfo = null;
|
|
|
|
|
|
function escHtml(s) {
|
|
|
return String(s || "")
|
|
|
@@ -686,44 +578,6 @@
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- function showApiDebugPopup(info) {
|
|
|
- lastApiDebugInfo = info || null;
|
|
|
- var mask = document.getElementById("apiDebugMask");
|
|
|
- var urlEl = document.getElementById("apiDebugUrl");
|
|
|
- var paramsEl = document.getElementById("apiDebugParams");
|
|
|
- var respEl = document.getElementById("apiDebugResponse");
|
|
|
- if (!mask || !urlEl || !paramsEl || !respEl) return;
|
|
|
- urlEl.textContent = info && info.url ? String(info.url) : "";
|
|
|
- paramsEl.textContent = info && info.params
|
|
|
- ? JSON.stringify(info.params, null, 2)
|
|
|
- : "";
|
|
|
- respEl.textContent = info && info.response != null
|
|
|
- ? JSON.stringify(info.response, null, 2)
|
|
|
- : "";
|
|
|
- mask.classList.add("is-open");
|
|
|
- mask.setAttribute("aria-hidden", "false");
|
|
|
- }
|
|
|
-
|
|
|
- function hideApiDebugPopup() {
|
|
|
- var mask = document.getElementById("apiDebugMask");
|
|
|
- if (!mask) return;
|
|
|
- mask.classList.remove("is-open");
|
|
|
- mask.setAttribute("aria-hidden", "true");
|
|
|
- }
|
|
|
-
|
|
|
- function bindApiDebugPopupEvents() {
|
|
|
- var closeBtn = document.getElementById("apiDebugClose");
|
|
|
- var mask = document.getElementById("apiDebugMask");
|
|
|
- if (closeBtn) {
|
|
|
- closeBtn.addEventListener("click", hideApiDebugPopup);
|
|
|
- }
|
|
|
- if (mask) {
|
|
|
- mask.addEventListener("click", function (e) {
|
|
|
- if (e.target === mask) hideApiDebugPopup();
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
function normalizeConversationRole(raw) {
|
|
|
var role = String(raw || "").trim().toLowerCase();
|
|
|
if (
|
|
|
@@ -887,24 +741,11 @@
|
|
|
});
|
|
|
})
|
|
|
.then(function (result) {
|
|
|
- showApiDebugPopup({
|
|
|
- url: requestUrl,
|
|
|
- params: requestParams,
|
|
|
- response: result.json,
|
|
|
- });
|
|
|
var data = normalizeConversationApiPayload(result.json);
|
|
|
if (!data) {
|
|
|
throw new Error("对话接口返回数据为空或格式无法解析");
|
|
|
}
|
|
|
return data;
|
|
|
- })
|
|
|
- .catch(function (err) {
|
|
|
- showApiDebugPopup({
|
|
|
- url: requestUrl,
|
|
|
- params: requestParams,
|
|
|
- response: { error: err && err.message ? err.message : String(err || "请求失败") },
|
|
|
- });
|
|
|
- throw err;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -1758,7 +1599,6 @@
|
|
|
var launchTag = document.getElementById("launch-btn");
|
|
|
if (launchTag) launchTag.setAttribute("appid", WECHAT_OPEN_APP_ID);
|
|
|
bindWeChatLaunchTagEvents();
|
|
|
- bindApiDebugPopupEvents();
|
|
|
|
|
|
if (isWeChatInAppBrowser()) {
|
|
|
document.body.classList.add("is-wechat");
|