|
|
@@ -192,7 +192,6 @@
|
|
|
}
|
|
|
|
|
|
.fab-dock__slot {
|
|
|
- position: relative;
|
|
|
width: 100%;
|
|
|
max-width: 280px;
|
|
|
height: 48px;
|
|
|
@@ -230,10 +229,6 @@
|
|
|
|
|
|
#launch-btn {
|
|
|
display: none;
|
|
|
- position: absolute;
|
|
|
- left: 0;
|
|
|
- top: 0;
|
|
|
- z-index: 2;
|
|
|
width: 100%;
|
|
|
height: 48px;
|
|
|
min-height: 48px;
|
|
|
@@ -242,11 +237,22 @@
|
|
|
opacity: 1;
|
|
|
}
|
|
|
|
|
|
- /* 与 secondShareGoods 一致:微信就绪后显示开放标签;openApp 保持可见作兜底 */
|
|
|
body.is-wechat.wx-jssdk-ready #launch-btn {
|
|
|
display: block;
|
|
|
}
|
|
|
|
|
|
+ body.is-wechat.wx-jssdk-ready #openApp {
|
|
|
+ display: none !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ body.is-wechat.wx-open-tag-broken #launch-btn {
|
|
|
+ display: none !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ body.is-wechat.wx-open-tag-broken #openApp {
|
|
|
+ display: flex !important;
|
|
|
+ }
|
|
|
+
|
|
|
.fab-wrap .fab {
|
|
|
pointer-events: auto;
|
|
|
}
|
|
|
@@ -385,6 +391,12 @@
|
|
|
var wxJssdkInitPromise = null;
|
|
|
var wxOpenTagBroken = false;
|
|
|
|
|
|
+ function markWxOpenTagBroken() {
|
|
|
+ wxOpenTagBroken = true;
|
|
|
+ document.body.classList.add("wx-open-tag-broken");
|
|
|
+ document.body.classList.remove("wx-jssdk-ready");
|
|
|
+ }
|
|
|
+
|
|
|
function escHtml(s) {
|
|
|
return String(s || "")
|
|
|
.replace(/&/g, "&")
|
|
|
@@ -1001,7 +1013,11 @@
|
|
|
wx.config(wxConfigParams);
|
|
|
wx.ready(function () {
|
|
|
weChatJssdkConfigured = true;
|
|
|
- if (!wxOpenTagBroken) {
|
|
|
+ if (wxOpenTagBroken) {
|
|
|
+ document.body.classList.add("wx-open-tag-broken");
|
|
|
+ document.body.classList.remove("wx-jssdk-ready");
|
|
|
+ } else {
|
|
|
+ document.body.classList.remove("wx-open-tag-broken");
|
|
|
document.body.classList.add("wx-jssdk-ready");
|
|
|
}
|
|
|
refreshWxLaunchTagAttrs();
|
|
|
@@ -1033,11 +1049,6 @@
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- function disableWxLaunchTagUi() {
|
|
|
- wxOpenTagBroken = true;
|
|
|
- document.body.classList.remove("wx-jssdk-ready");
|
|
|
- }
|
|
|
-
|
|
|
function refreshWxLaunchTagAttrs(useBarePathOnly) {
|
|
|
var tag = document.getElementById("launch-btn");
|
|
|
if (!tag) return;
|
|
|
@@ -1064,16 +1075,42 @@
|
|
|
: detail && detail.errmsg
|
|
|
? String(detail.errmsg)
|
|
|
: "";
|
|
|
- console.warn("[wx-open-launch-app]", detail);
|
|
|
- if (/launch:fail/i.test(errMsg) && !getWxShareEntryFrom()) {
|
|
|
- showAppOpenFailTip("请前往应用商店下载U店在哪app");
|
|
|
- } else {
|
|
|
+ console.warn(
|
|
|
+ "[wx-open-launch-app]",
|
|
|
+ detail,
|
|
|
+ "extinfo=",
|
|
|
+ tag.getAttribute("extinfo")
|
|
|
+ );
|
|
|
+
|
|
|
+ if (/launch:fail_check/i.test(errMsg)) {
|
|
|
+ markWxOpenTagBroken();
|
|
|
showAppOpenFailTip(
|
|
|
- errMsg
|
|
|
- ? "未能打开 App:" + errMsg
|
|
|
- : "未能打开 App,请确认已安装最新版「U店在哪」"
|
|
|
+ "请用微信分享卡片进入,或确认已安装最新版「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店在哪」"
|
|
|
+ );
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -1254,6 +1291,10 @@
|
|
|
|
|
|
function tryOpenHBuilderApp() {
|
|
|
if (isWeChatInAppBrowser()) return;
|
|
|
+ if (!isWxPcBrowser()) {
|
|
|
+ tryOpenHBuilderAppViaScheme();
|
|
|
+ return;
|
|
|
+ }
|
|
|
tryFetchWxConfigOnPcClick().then(function () {
|
|
|
if (isWxConfigOnClickDebug() && !isWxForceDebug() && !isWxPcAutoDebugHost()) {
|
|
|
return;
|
|
|
@@ -1280,7 +1321,7 @@
|
|
|
}
|
|
|
|
|
|
document.addEventListener("WeixinOpenTagsError", function (e) {
|
|
|
- disableWxLaunchTagUi();
|
|
|
+ markWxOpenTagBroken();
|
|
|
console.warn("[WeixinOpenTagsError]", e && e.detail);
|
|
|
});
|
|
|
|
|
|
@@ -1292,6 +1333,13 @@
|
|
|
showFabToast(
|
|
|
wxInitLastError || "微信 SDK 初始化中,请稍候再点底部按钮"
|
|
|
);
|
|
|
+ initWeChatOpenLaunchApp(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (wxOpenTagBroken) {
|
|
|
+ showAppOpenFailTip(
|
|
|
+ "请使用 App「分享到微信」后点分享卡片进入,或确认已安装最新版「U店在哪」"
|
|
|
+ );
|
|
|
}
|
|
|
});
|
|
|
}
|