Authored by ccbikai(👎🏻🍜)

任何设备都唤起 App

... ... @@ -280,7 +280,7 @@ function ajaxResource() {
$.ajax({
method: 'get',
url: location.protocol + '//m.yohobuy.com/product/opt/favoriteBrand',
url: '/product/opt/favoriteBrand',
data: {
id: self.parent().attr('shopId'),
opt: opt,
... ... @@ -323,7 +323,7 @@ function ajaxResource() {
// vip专属等级查询
$.ajax({
method: 'POST',
url: location.protocol + '//m.yohobuy.com/channel/userVip',
url: '/channel/userVip',
data: {
channel: 1,
},
... ...
... ... @@ -4,13 +4,23 @@
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 isAndroid = u.indexOf('Android') > -1; // android终端
const isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
const iOSVersion = parseInt(u.match(/OS (\d+)_(\d+)_?(\d+)?/i)[1], 10);
if (isAndroid || iOSVersion < 90) {
let appPath = getAppPath();
let ifr;
... ... @@ -22,14 +32,5 @@ 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);
}
... ...