|
@@ -512,11 +512,11 @@
|
|
|
opacity: 1;
|
|
opacity: 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- body.is-wechat.wx-jssdk-ready #launch-btn {
|
|
|
|
|
|
|
+ body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #launch-btn {
|
|
|
display: block;
|
|
display: block;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- body.is-wechat.wx-jssdk-ready #openApp {
|
|
|
|
|
|
|
+ body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #openApp {
|
|
|
display: none !important;
|
|
display: none !important;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1359,7 +1359,10 @@
|
|
|
wx.ready(function () {
|
|
wx.ready(function () {
|
|
|
weChatJssdkConfigured = true;
|
|
weChatJssdkConfigured = true;
|
|
|
document.body.classList.add('wx-jssdk-ready');
|
|
document.body.classList.add('wx-jssdk-ready');
|
|
|
- refreshWxLaunchTagAttrs();
|
|
|
|
|
|
|
+ applyWxOpenLaunchSceneBodyClass();
|
|
|
|
|
+ if (isWxOpenLaunchAppSceneSupported()) {
|
|
|
|
|
+ refreshWxLaunchTagAttrs();
|
|
|
|
|
+ }
|
|
|
console.log('[wx.config] ready, htmlUrl=', htmlUrl);
|
|
console.log('[wx.config] ready, htmlUrl=', htmlUrl);
|
|
|
resolve(true);
|
|
resolve(true);
|
|
|
});
|
|
});
|
|
@@ -1415,6 +1418,10 @@
|
|
|
? String(detail.errmsg)
|
|
? String(detail.errmsg)
|
|
|
: '';
|
|
: '';
|
|
|
console.warn('[wx-open-launch-app]', detail);
|
|
console.warn('[wx-open-launch-app]', detail);
|
|
|
|
|
+ if (/launch:fail/i.test(errMsg) && !isWxOpenLaunchAppSceneSupported()) {
|
|
|
|
|
+ showWxCopyLinkEntryTip();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
showAppOpenFailTip(
|
|
showAppOpenFailTip(
|
|
|
errMsg
|
|
errMsg
|
|
|
? '未能唤起 App:' + errMsg
|
|
? '未能唤起 App:' + errMsg
|
|
@@ -1523,6 +1530,46 @@
|
|
|
return /MicroMessenger/i.test(navigator.userAgent || '');
|
|
return /MicroMessenger/i.test(navigator.userAgent || '');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function getWxShareEntryFrom() {
|
|
|
|
|
+ var from = q('from');
|
|
|
|
|
+ return from ? String(from).trim().toLowerCase() : '';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function isWxOpenLaunchAppSceneSupported() {
|
|
|
|
|
+ if (!isWeChatInAppBrowser()) return false;
|
|
|
|
|
+ if (readQueryParam('wxOpenTag') === '1' || readQueryParam('wxForceOpenTag') === '1') {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ var from = getWxShareEntryFrom();
|
|
|
|
|
+ return (
|
|
|
|
|
+ from === 'singlemessage' ||
|
|
|
|
|
+ from === 'groupmessage' ||
|
|
|
|
|
+ from === 'timeline'
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function applyWxOpenLaunchSceneBodyClass() {
|
|
|
|
|
+ if (!isWeChatInAppBrowser()) return;
|
|
|
|
|
+ var ok = isWxOpenLaunchAppSceneSupported();
|
|
|
|
|
+ document.body.classList.toggle('wx-open-tag-scene', ok);
|
|
|
|
|
+ document.body.classList.toggle('wx-copy-link-entry', !ok);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function logWxEntryDiagnostics() {
|
|
|
|
|
+ if (!isWeChatInAppBrowser()) return;
|
|
|
|
|
+ console.log('[wx-entry]', {
|
|
|
|
|
+ entryFrom: getWxShareEntryFrom() || '(无,多为复制链接进入)',
|
|
|
|
|
+ openLaunchTagScene: isWxOpenLaunchAppSceneSupported(),
|
|
|
|
|
+ signUrl: getWxConfigSignUrl()
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function showWxCopyLinkEntryTip() {
|
|
|
|
|
+ showFabToast(
|
|
|
|
|
+ '当前为复制链接进入,微信不支持直接打开 App。请使用 App「分享到微信」发送卡片后,从卡片进入。'
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/** 微信内置浏览器、iOS:OSS 截图/封面易因 Referer 被拒;video 首帧不可靠 */
|
|
/** 微信内置浏览器、iOS:OSS 截图/封面易因 Referer 被拒;video 首帧不可靠 */
|
|
|
function preferStaticStillOverVideo() {
|
|
function preferStaticStillOverVideo() {
|
|
|
return isIOSVideoEnv() || isWeChatInAppBrowser();
|
|
return isIOSVideoEnv() || isWeChatInAppBrowser();
|
|
@@ -3098,13 +3145,22 @@
|
|
|
if (launchTag) launchTag.setAttribute('appid', WECHAT_OPEN_APP_ID);
|
|
if (launchTag) launchTag.setAttribute('appid', WECHAT_OPEN_APP_ID);
|
|
|
bindWeChatLaunchTagEvents();
|
|
bindWeChatLaunchTagEvents();
|
|
|
if (shouldInitWeChatJssdkOnLoad()) {
|
|
if (shouldInitWeChatJssdkOnLoad()) {
|
|
|
- if (isWeChatInAppBrowser()) document.body.classList.add('is-wechat');
|
|
|
|
|
|
|
+ if (isWeChatInAppBrowser()) {
|
|
|
|
|
+ document.body.classList.add('is-wechat');
|
|
|
|
|
+ applyWxOpenLaunchSceneBodyClass();
|
|
|
|
|
+ logWxEntryDiagnostics();
|
|
|
|
|
+ }
|
|
|
if (isWxPcBrowser() && (isWxForceDebug() || isWxPcAutoDebugHost())) {
|
|
if (isWxPcBrowser() && (isWxForceDebug() || isWxPcAutoDebugHost())) {
|
|
|
document.body.classList.add('wx-pc-debug');
|
|
document.body.classList.add('wx-pc-debug');
|
|
|
}
|
|
}
|
|
|
scheduleWeChatJssdkBootstrap();
|
|
scheduleWeChatJssdkBootstrap();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ document.addEventListener('WeixinOpenTagsError', function (e) {
|
|
|
|
|
+ console.warn('[WeixinOpenTagsError]', e && e.detail);
|
|
|
|
|
+ applyWxOpenLaunchSceneBodyClass();
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
fetchGetDeleteFlagByIdIfId().then(function (res) {
|
|
fetchGetDeleteFlagByIdIfId().then(function (res) {
|
|
|
if (isGetOneBusinessStatus99(res)) {
|
|
if (isGetOneBusinessStatus99(res)) {
|
|
|
applyShareDynamicClosedMerchantUi(true);
|
|
applyShareDynamicClosedMerchantUi(true);
|
|
@@ -3128,6 +3184,10 @@
|
|
|
showFabToast(
|
|
showFabToast(
|
|
|
wxInitLastError || '微信 SDK 初始化中,请稍候再点底部按钮'
|
|
wxInitLastError || '微信 SDK 初始化中,请稍候再点底部按钮'
|
|
|
);
|
|
);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!isWxOpenLaunchAppSceneSupported()) {
|
|
|
|
|
+ showWxCopyLinkEntryTip();
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|