|
@@ -472,6 +472,7 @@
|
|
|
margin: 0 auto;
|
|
margin: 0 auto;
|
|
|
height: 48px;
|
|
height: 48px;
|
|
|
flex-shrink: 0;
|
|
flex-shrink: 0;
|
|
|
|
|
+ pointer-events: auto;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.fab-slot .fab {
|
|
.fab-slot .fab {
|
|
@@ -488,7 +489,7 @@
|
|
|
top: 0;
|
|
top: 0;
|
|
|
right: 0;
|
|
right: 0;
|
|
|
bottom: 0;
|
|
bottom: 0;
|
|
|
- z-index: 5;
|
|
|
|
|
|
|
+ z-index: 10;
|
|
|
pointer-events: none;
|
|
pointer-events: none;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1042,7 +1043,10 @@
|
|
|
var API_BASE = 'https://test.ailien.shop/alienStore';
|
|
var API_BASE = 'https://test.ailien.shop/alienStore';
|
|
|
/** 公众号内 JS-SDK 签名:GET …/alienStore/wx/getWxConfig?url=当前页地址(不含 #) */
|
|
/** 公众号内 JS-SDK 签名:GET …/alienStore/wx/getWxConfig?url=当前页地址(不含 #) */
|
|
|
var WX_CONFIG_API = 'https://test.ailien.shop/alienStore/wx/getWxConfig';
|
|
var WX_CONFIG_API = 'https://test.ailien.shop/alienStore/wx/getWxConfig';
|
|
|
- /** 微信开放平台「移动应用」AppID(wx-open-launch-app 的 appid);接口未返回 launchAppId 时用此值 */
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * wx-open-launch-app 的 appid:须为微信开放平台「移动应用」AppID(≠ 公众号 appId)。
|
|
|
|
|
+ * 请让 getWxConfig 返回 launchAppId,或在此填写正确的移动应用 AppID。
|
|
|
|
|
+ */
|
|
|
var WX_LAUNCH_APP_ID = 'wxf5f1efe3a9f5012e';
|
|
var WX_LAUNCH_APP_ID = 'wxf5f1efe3a9f5012e';
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1209,22 +1213,6 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function tryClickWxLaunchButton() {
|
|
|
|
|
- var host = document.getElementById('openAppWxLaunchHost');
|
|
|
|
|
- if (!host) return false;
|
|
|
|
|
- var inner = host.querySelector('.wx-fab-inner');
|
|
|
|
|
- var tag = host.querySelector('wx-open-launch-app');
|
|
|
|
|
- if (inner && typeof inner.click === 'function') {
|
|
|
|
|
- inner.click();
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- if (tag && typeof tag.click === 'function') {
|
|
|
|
|
- tag.click();
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
function loadWxJssdk() {
|
|
function loadWxJssdk() {
|
|
|
if (typeof wx !== 'undefined' && typeof wx.config === 'function') {
|
|
if (typeof wx !== 'undefined' && typeof wx.config === 'function') {
|
|
|
return Promise.resolve();
|
|
return Promise.resolve();
|
|
@@ -1330,8 +1318,11 @@
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /** 传给 App 的 extinfo:path + query(勿用 shopro://,开放标签由微信唤起原生 App) */
|
|
|
function buildAppExtInfo() {
|
|
function buildAppExtInfo() {
|
|
|
- return buildAppDeepLink();
|
|
|
|
|
|
|
+ var path = getAppUniPathForBusinessSection().replace(/^\//, '');
|
|
|
|
|
+ var qs = buildAppOpenQueryString();
|
|
|
|
|
+ return path + (qs || '');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function escapeHtmlAttr(s) {
|
|
function escapeHtmlAttr(s) {
|
|
@@ -1354,7 +1345,7 @@
|
|
|
|
|
|
|
|
wxTagReady = false;
|
|
wxTagReady = false;
|
|
|
var extinfo = escapeHtmlAttr(buildAppExtInfo());
|
|
var extinfo = escapeHtmlAttr(buildAppExtInfo());
|
|
|
- var appid = escapeHtmlAttr(launchAppId);
|
|
|
|
|
|
|
+ var appid = "wxf5f1efe3a9f5012e";
|
|
|
var imgUrl = escapeHtmlAttr(getPageAssetUrl('images/uBtn.png'));
|
|
var imgUrl = escapeHtmlAttr(getPageAssetUrl('images/uBtn.png'));
|
|
|
host.innerHTML =
|
|
host.innerHTML =
|
|
|
'<wx-open-launch-app id="wxOpenLaunchApp" appid="' +
|
|
'<wx-open-launch-app id="wxOpenLaunchApp" appid="' +
|
|
@@ -1514,10 +1505,12 @@
|
|
|
showWxLaunchTip(msg);
|
|
showWxLaunchTip(msg);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /** 微信内点击「APP内打开」:就绪则触发开放标签,否则先 prepare 再触发 */
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 微信内仅初始化;真正唤起须用户直接点击 wx-open-launch-app(微信禁止脚本模拟点击)。
|
|
|
|
|
+ * 初始化完成后再点一次底部按钮即可。
|
|
|
|
|
+ */
|
|
|
function onWeChatOpenAppClick() {
|
|
function onWeChatOpenAppClick() {
|
|
|
if (wxLaunchMounted && wxConfigReady && wxTagReady) {
|
|
if (wxLaunchMounted && wxConfigReady && wxTagReady) {
|
|
|
- tryClickWxLaunchButton();
|
|
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
setOpenAppWeChatPending(true);
|
|
setOpenAppWeChatPending(true);
|
|
@@ -1530,10 +1523,8 @@
|
|
|
chain
|
|
chain
|
|
|
.then(function () {
|
|
.then(function () {
|
|
|
setOpenAppWeChatPending(false);
|
|
setOpenAppWeChatPending(false);
|
|
|
- if (wxTagReady) {
|
|
|
|
|
- tryClickWxLaunchButton();
|
|
|
|
|
- } else {
|
|
|
|
|
- showWxLaunchTip('开放标签未就绪,请再点一次按钮');
|
|
|
|
|
|
|
+ if (wxLaunchMounted && wxTagReady) {
|
|
|
|
|
+ showWxLaunchTip('请再次点击「APP内打开」');
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
.catch(function (e) {
|
|
.catch(function (e) {
|
|
@@ -2833,35 +2824,24 @@
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ document.addEventListener('WeixinOpenTagsError', function (e) {
|
|
|
|
|
+ console.warn('[WeixinOpenTagsError]', e && e.detail);
|
|
|
|
|
+ showWxLaunchTip('当前微信版本不支持打开 App,请升级微信后重试');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
function boot() {
|
|
function boot() {
|
|
|
run();
|
|
run();
|
|
|
bindMarketingMore();
|
|
bindMarketingMore();
|
|
|
bindStaffSection();
|
|
bindStaffSection();
|
|
|
var openBtn = document.getElementById('openApp');
|
|
var openBtn = document.getElementById('openApp');
|
|
|
- var wxHost = document.getElementById('openAppWxLaunchHost');
|
|
|
|
|
- function handleOpenAppClick(e) {
|
|
|
|
|
- if (isWeChatInAppBrowser()) {
|
|
|
|
|
- if (
|
|
|
|
|
- wxLaunchMounted &&
|
|
|
|
|
- wxConfigReady &&
|
|
|
|
|
- wxTagReady &&
|
|
|
|
|
- e &&
|
|
|
|
|
- e.target &&
|
|
|
|
|
- wxHost &&
|
|
|
|
|
- wxHost.contains(e.target)
|
|
|
|
|
- ) {
|
|
|
|
|
|
|
+ if (openBtn) {
|
|
|
|
|
+ openBtn.addEventListener('click', function () {
|
|
|
|
|
+ if (isWeChatInAppBrowser()) {
|
|
|
|
|
+ onWeChatOpenAppClick();
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- onWeChatOpenAppClick();
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- tryOpenHBuilderApp();
|
|
|
|
|
- }
|
|
|
|
|
- if (openBtn) {
|
|
|
|
|
- openBtn.addEventListener('click', handleOpenAppClick);
|
|
|
|
|
- }
|
|
|
|
|
- if (wxHost) {
|
|
|
|
|
- wxHost.addEventListener('click', handleOpenAppClick);
|
|
|
|
|
|
|
+ tryOpenHBuilderApp();
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|