|
@@ -447,6 +447,10 @@
|
|
|
pointer-events: none;
|
|
pointer-events: none;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ .fab-dock__slot {
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
#launch-btn {
|
|
#launch-btn {
|
|
|
display: none;
|
|
display: none;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
@@ -455,28 +459,49 @@
|
|
|
border-radius: 24px;
|
|
border-radius: 24px;
|
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
|
opacity: 1;
|
|
opacity: 1;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ z-index: 2;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- body.is-wechat.wx-jssdk-ready #launch-btn {
|
|
|
|
|
- display: block;
|
|
|
|
|
|
|
+ /* 微信内:仅 wx.config 成功后展示开放标签,避免被 #openApp 挡住 */
|
|
|
|
|
+ body.is-wechat.wx-jssdk-ready #launch-btn,
|
|
|
|
|
+ body.wx-jssdk-ready #launch-btn {
|
|
|
|
|
+ display: block !important;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- body.is-wechat.wx-jssdk-ready #openApp {
|
|
|
|
|
|
|
+ body.is-wechat.wx-jssdk-ready #openApp,
|
|
|
|
|
+ body.wx-jssdk-ready #openApp {
|
|
|
display: none !important;
|
|
display: none !important;
|
|
|
|
|
+ visibility: hidden !important;
|
|
|
|
|
+ pointer-events: none !important;
|
|
|
|
|
+ position: absolute !important;
|
|
|
|
|
+ width: 0 !important;
|
|
|
|
|
+ height: 0 !important;
|
|
|
|
|
+ overflow: hidden !important;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- .fab-wrap .fab,
|
|
|
|
|
- #openApp {
|
|
|
|
|
|
|
+ body.is-wechat:not(.wx-jssdk-ready) #launch-btn {
|
|
|
|
|
+ display: none !important;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ body.is-wechat:not(.wx-jssdk-ready) #openApp {
|
|
|
display: block;
|
|
display: block;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
touch-action: manipulation;
|
|
touch-action: manipulation;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#openApp {
|
|
#openApp {
|
|
|
|
|
+ display: block;
|
|
|
|
|
+ width: 100%;
|
|
|
padding: 0;
|
|
padding: 0;
|
|
|
border: none;
|
|
border: none;
|
|
|
background: transparent;
|
|
background: transparent;
|
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
|
|
|
+ touch-action: manipulation;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ body:not(.is-wechat) #launch-btn {
|
|
|
|
|
+ display: none !important;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#openAppToast {
|
|
#openAppToast {
|
|
@@ -559,11 +584,7 @@
|
|
|
<div id="openAppToast" role="status" aria-live="polite"></div>
|
|
<div id="openAppToast" role="status" aria-live="polite"></div>
|
|
|
<div class="fab-wrap">
|
|
<div class="fab-wrap">
|
|
|
<div class="fab-dock__slot">
|
|
<div class="fab-dock__slot">
|
|
|
- <!-- 非微信 / 微信 JSSDK 未就绪:scheme 唤起 -->
|
|
|
|
|
- <button type="button" class="fab" id="openApp">
|
|
|
|
|
- <img src="images/ubtn.png" alt="APP内打开" decoding="async">
|
|
|
|
|
- </button>
|
|
|
|
|
- <!-- 微信内 wx.config 成功后:仅此按钮可唤起 App(须用户直接点击) -->
|
|
|
|
|
|
|
+ <!-- 微信内 wx.config 成功后:开放标签须在顶层,避免被 #openApp 遮挡 -->
|
|
|
<wx-open-launch-app id="launch-btn" appid="wxf5f1efe3a9f5012e" extinfo="">
|
|
<wx-open-launch-app id="launch-btn" appid="wxf5f1efe3a9f5012e" extinfo="">
|
|
|
<script type="text/wxtag-template">
|
|
<script type="text/wxtag-template">
|
|
|
<style>
|
|
<style>
|
|
@@ -591,11 +612,15 @@
|
|
|
-webkit-user-drag: none;
|
|
-webkit-user-drag: none;
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|
|
|
- <button class="wx-open-app-btn" aria-label="APP内打开">
|
|
|
|
|
|
|
+ <button type="button" class="wx-open-app-btn" aria-label="APP内打开">
|
|
|
<img src="https://test.ailien.shop/h5/HBuilderProjects/images/uBtn.png" alt="APP内打开" width="198" height="48" />
|
|
<img src="https://test.ailien.shop/h5/HBuilderProjects/images/uBtn.png" alt="APP内打开" width="198" height="48" />
|
|
|
</button>
|
|
</button>
|
|
|
</script>
|
|
</script>
|
|
|
</wx-open-launch-app>
|
|
</wx-open-launch-app>
|
|
|
|
|
+ <!-- 非微信 / 微信 JSSDK 未就绪:scheme 唤起 -->
|
|
|
|
|
+ <button type="button" class="fab" id="openApp">
|
|
|
|
|
+ <img src="images/uBtn.png" alt="APP内打开" decoding="async">
|
|
|
|
|
+ </button>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="home-indicator" aria-hidden="true"></div>
|
|
<div class="home-indicator" aria-hidden="true"></div>
|
|
|
</div>
|
|
</div>
|
|
@@ -969,6 +994,8 @@
|
|
|
|
|
|
|
|
function getWxConfigSignUrl() {
|
|
function getWxConfigSignUrl() {
|
|
|
if (String(q('wxSignBaseOnly') || '') === '1') return getWxHtmlUrlBase();
|
|
if (String(q('wxSignBaseOnly') || '') === '1') return getWxHtmlUrlBase();
|
|
|
|
|
+ /* 微信分享链 query 较长时用 pathname 签名,避免 invalid signature 导致开放标签不可用 */
|
|
|
|
|
+ if (isWeChatInAppBrowser()) return getWxHtmlUrlBase();
|
|
|
return getWxSignPageUrlForApi();
|
|
return getWxSignPageUrlForApi();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1150,7 +1177,12 @@
|
|
|
wx.ready(function () {
|
|
wx.ready(function () {
|
|
|
weChatJssdkConfigured = true;
|
|
weChatJssdkConfigured = true;
|
|
|
document.body.classList.add('wx-jssdk-ready');
|
|
document.body.classList.add('wx-jssdk-ready');
|
|
|
|
|
+ var launchEl = document.getElementById('launch-btn');
|
|
|
|
|
+ if (launchEl) {
|
|
|
|
|
+ launchEl._wxLaunchBound = false;
|
|
|
|
|
+ }
|
|
|
refreshWxLaunchTagAttrs(false);
|
|
refreshWxLaunchTagAttrs(false);
|
|
|
|
|
+ bindWeChatLaunchTagEvents();
|
|
|
console.log('[wx.config] ready, htmlUrl=', htmlUrl);
|
|
console.log('[wx.config] ready, htmlUrl=', htmlUrl);
|
|
|
resolve(true);
|
|
resolve(true);
|
|
|
});
|
|
});
|
|
@@ -1198,7 +1230,7 @@
|
|
|
tag.addEventListener('launch', function () {
|
|
tag.addEventListener('launch', function () {
|
|
|
tag._wxLaunchBareRetried = false;
|
|
tag._wxLaunchBareRetried = false;
|
|
|
console.log('[wx-open-launch-app] launch ok');
|
|
console.log('[wx-open-launch-app] launch ok');
|
|
|
- // showFabToast('正在打开 U店在哪…');
|
|
|
|
|
|
|
+ showFabToast('正在打开 U店在哪…');
|
|
|
});
|
|
});
|
|
|
tag.addEventListener('error', function (e) {
|
|
tag.addEventListener('error', function (e) {
|
|
|
var detail = e && e.detail;
|
|
var detail = e && e.detail;
|
|
@@ -1212,7 +1244,7 @@
|
|
|
|
|
|
|
|
if (/launch:fail_check/i.test(errMsg)) {
|
|
if (/launch:fail_check/i.test(errMsg)) {
|
|
|
showAppOpenFailTip(
|
|
showAppOpenFailTip(
|
|
|
- '请确复制链接进入U店在哪'
|
|
|
|
|
|
|
+ '请用微信分享卡片进入,或确认已安装最新版「U店在哪」'
|
|
|
);
|
|
);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -1229,7 +1261,9 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
showAppOpenFailTip(
|
|
showAppOpenFailTip(
|
|
|
- '请确复制链接进入U店在哪'
|
|
|
|
|
|
|
+ errMsg
|
|
|
|
|
+ ? '未能打开 App:' + errMsg
|
|
|
|
|
+ : '未能打开 App,请确认已安装最新版「U店在哪」'
|
|
|
);
|
|
);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -1276,10 +1310,17 @@
|
|
|
if (!shouldInitWeChatJssdkOnLoad()) return;
|
|
if (!shouldInitWeChatJssdkOnLoad()) return;
|
|
|
var attempts = 0;
|
|
var attempts = 0;
|
|
|
function tick() {
|
|
function tick() {
|
|
|
- attempts += 1;
|
|
|
|
|
if (weChatJssdkConfigured) return;
|
|
if (weChatJssdkConfigured) return;
|
|
|
- initWeChatOpenLaunchApp();
|
|
|
|
|
- if (!weChatJssdkConfigured && attempts < 8 && typeof wx === 'undefined') {
|
|
|
|
|
|
|
+ attempts += 1;
|
|
|
|
|
+ var pending = initWeChatOpenLaunchApp();
|
|
|
|
|
+ if (pending && typeof pending.then === 'function') {
|
|
|
|
|
+ pending.then(function () {
|
|
|
|
|
+ if (!weChatJssdkConfigured && attempts < 10) {
|
|
|
|
|
+ setTimeout(tick, 500);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!weChatJssdkConfigured && attempts < 10 && typeof wx === 'undefined') {
|
|
|
setTimeout(tick, 400);
|
|
setTimeout(tick, 400);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1935,6 +1976,14 @@
|
|
|
|
|
|
|
|
document.addEventListener('WeixinOpenTagsError', function (e) {
|
|
document.addEventListener('WeixinOpenTagsError', function (e) {
|
|
|
console.warn('[WeixinOpenTagsError]', e && e.detail);
|
|
console.warn('[WeixinOpenTagsError]', e && e.detail);
|
|
|
|
|
+ var d = e && e.detail;
|
|
|
|
|
+ var em =
|
|
|
|
|
+ d && d.errMsg
|
|
|
|
|
+ ? String(d.errMsg)
|
|
|
|
|
+ : d && d.errmsg
|
|
|
|
|
+ ? String(d.errmsg)
|
|
|
|
|
+ : '';
|
|
|
|
|
+ showFabToast(em || '微信开放标签不可用,请升级微信后重试');
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
run();
|
|
run();
|