|
|
@@ -160,8 +160,6 @@
|
|
|
box-shadow: 0 4px 16px rgba(255, 107, 62, 0.32);
|
|
|
touch-action: manipulation;
|
|
|
-webkit-tap-highlight-color: transparent;
|
|
|
- position: relative;
|
|
|
- z-index: 1;
|
|
|
}
|
|
|
|
|
|
.continue-btn__label {
|
|
|
@@ -175,22 +173,23 @@
|
|
|
|
|
|
#launch-btn {
|
|
|
display: none;
|
|
|
- position: absolute;
|
|
|
- left: 0;
|
|
|
- top: 0;
|
|
|
width: 100%;
|
|
|
- height: 100%;
|
|
|
+ height: 48px;
|
|
|
min-height: 48px;
|
|
|
border-radius: 999px;
|
|
|
overflow: hidden;
|
|
|
- z-index: 2;
|
|
|
}
|
|
|
|
|
|
+ /* 微信 SDK 就绪:仅显示开放标签(与 secondShareGoods 一致,须直接点开放标签) */
|
|
|
body.is-wechat.wx-jssdk-ready #launch-btn {
|
|
|
display: block;
|
|
|
pointer-events: auto;
|
|
|
}
|
|
|
|
|
|
+ body.is-wechat.wx-jssdk-ready #btnContinue {
|
|
|
+ display: none !important;
|
|
|
+ }
|
|
|
+
|
|
|
#openAppToast {
|
|
|
display: none;
|
|
|
position: fixed;
|
|
|
@@ -520,24 +519,14 @@
|
|
|
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 path = String(APP_UNI_AI_PATH || "pages/aiSearchResult/index").replace(/^\//, "");
|
|
|
var root = APP_IOS_URL_SCHEME.replace(/\/$/, "");
|
|
|
- return root + "/" + path + (qs ? "?" + qs : "");
|
|
|
+ return root + "/" + path;
|
|
|
}
|
|
|
|
|
|
function buildWeChatLaunchExtinfo() {
|
|
|
- var qs = buildAiConsultOpenParams().toString();
|
|
|
- var uniPage = qs ? APP_UNI_AI_PATH + "?" + qs : APP_UNI_AI_PATH;
|
|
|
- return uniPage.length <= 1024 ? uniPage : APP_UNI_AI_PATH + "?pageType=home&fromShareAiConsult=1";
|
|
|
+ return String(APP_UNI_AI_PATH || "pages/aiSearchResult/index").replace(/^\//, "");
|
|
|
}
|
|
|
|
|
|
function isWeChatInAppBrowser() {
|
|
|
@@ -805,6 +794,10 @@
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ function hideWxLaunchOverlay() {
|
|
|
+ document.body.classList.remove("wx-jssdk-ready");
|
|
|
+ }
|
|
|
+
|
|
|
function refreshWxLaunchTagAttrs() {
|
|
|
var tag = document.getElementById("launch-btn");
|
|
|
if (!tag) return;
|
|
|
@@ -830,7 +823,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)) {
|
|
|
+ hideWxLaunchOverlay();
|
|
|
+ showAppOpenFailTip(
|
|
|
+ "请用微信分享卡片进入,或确认已安装最新版「U店在哪」"
|
|
|
+ );
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (/launch:fail/i.test(errMsg)) {
|
|
|
+ hideWxLaunchOverlay();
|
|
|
+ showAppOpenFailTip("未能打开 App,请确认已安装最新版「U店在哪」");
|
|
|
+ return;
|
|
|
+ }
|
|
|
showAppOpenFailTip(
|
|
|
errMsg
|
|
|
? "未能打开 App:" + errMsg
|
|
|
@@ -917,11 +922,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);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -996,7 +999,14 @@
|
|
|
|
|
|
function tryOpenApp() {
|
|
|
if (isWeChatInAppBrowser()) {
|
|
|
+ if (weChatJssdkConfigured && !document.body.classList.contains("wx-jssdk-ready")) {
|
|
|
+ document.body.classList.add("wx-jssdk-ready");
|
|
|
+ refreshWxLaunchTagAttrs();
|
|
|
+ showFabToast("请再次点击底部按钮");
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (!weChatJssdkConfigured) {
|
|
|
+ showFabToast("微信 SDK 初始化中,请稍候再点");
|
|
|
initWeChatOpenLaunchApp(true).then(function (ok) {
|
|
|
if (!ok) {
|
|
|
showAppOpenFailTip(wxInitLastError || "微信唤起 App 初始化失败");
|
|
|
@@ -1014,13 +1024,16 @@
|
|
|
|
|
|
document.addEventListener("WeixinOpenTagsError", function (e) {
|
|
|
console.warn("[WeixinOpenTagsError]", e && e.detail);
|
|
|
- document.body.classList.remove("wx-jssdk-ready");
|
|
|
+ hideWxLaunchOverlay();
|
|
|
showFabToast("微信开放标签加载失败,请稍候再试");
|
|
|
});
|
|
|
|
|
|
var sharePayload = parsePayload();
|
|
|
stripPayloadQueryFromUrl();
|
|
|
|
|
|
+ var launchTagBoot = document.getElementById("launch-btn");
|
|
|
+ if (launchTagBoot) launchTagBoot.setAttribute("appid", WECHAT_OPEN_APP_ID);
|
|
|
+
|
|
|
bindWeChatLaunchTagEvents();
|
|
|
document.getElementById("btnContinue").addEventListener("click", tryOpenApp);
|
|
|
render(sharePayload);
|