...
|
...
|
@@ -4,13 +4,31 @@ |
|
|
const qs = require('yoho-qs');
|
|
|
|
|
|
const getAppPath = () => {
|
|
|
return document.getElementById('main-wrap').dataset.apppath || 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}';
|
|
|
let appPath = document.getElementById('main-wrap').dataset.apppath || 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}';
|
|
|
let ct = qs.mkt_code || qs.union_type;
|
|
|
|
|
|
if (ct) {
|
|
|
appPath = appPath.replace('goapp?', 'goapp?ct=' + ct + '&')
|
|
|
}
|
|
|
|
|
|
return appPath;
|
|
|
};
|
|
|
|
|
|
if (qs.openapp) {
|
|
|
const u = navigator.userAgent.toLowerCase();
|
|
|
const isiOS = u.indexOf('os') > -1 || u.indexOf('iphone') > -1 || u.indexOf('mac') > -1 || u.indexOf('ipad') > -1;
|
|
|
const u = navigator.userAgent;
|
|
|
const isFromYOHO = /m\.yohobuy\.com/i.test(document.referrer);
|
|
|
const isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
|
|
|
|
// const isAndroid = u.indexOf('Android') > -1; // android终端
|
|
|
// const iOSVersion = parseInt(u.match(/OS (\d+)_(\d+)_?(\d+)?/i)[1], 10);
|
|
|
|
|
|
|
|
|
/*
|
|
|
2.13 日要求,暂时不管通用链接,所有情况都尝试唤起 App
|
|
|
|
|
|
isAndroid || iOSVersion < 9 将来配合 通用链接使用
|
|
|
*/
|
|
|
|
|
|
if (!isFromYOHO) {
|
|
|
let appPath = getAppPath();
|
|
|
let ifr;
|
|
|
|
...
|
...
|
@@ -22,14 +40,4 @@ if (qs.openapp) { |
|
|
ifr.style.display = 'none';
|
|
|
document.body.appendChild(ifr);
|
|
|
}
|
|
|
|
|
|
// let time = Date.now();
|
|
|
|
|
|
// window.setTimeout(function() {
|
|
|
// document.body.removeChild(ifr);
|
|
|
// if (Date.now() - time < 2200) {
|
|
|
// window.location.href = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho';
|
|
|
// }
|
|
|
// }, 2000);
|
|
|
} |
|
|
|
...
|
...
|
|