...
|
...
|
@@ -23,7 +23,33 @@ const mycurrency = isMobile.any() ? '//m.yohobuy.com/home/mycurrency' : '//www.y |
|
|
const $tipTmpl = $('<div class="featuretip tip-wrap"><div class="tip"><div class="title"></div><div class="content"></div><a class="button" href="">返回</a></div></div>'); // eslint-disable-line
|
|
|
const $cointipTmpl = $('<div class="feature-coin tip-wrap"><div class="tip"><div class="tip-close">×</div><div class="title"></div><div class="content"></div><div class="bottom-button"><a class="button" href="">去逛逛</a><a class="coin" href=\'' + mycurrency + '?openby:yohobuy={"action":"go.mine"}\'>查看有货币</a></div></div></div>'); // eslint-disable-line
|
|
|
|
|
|
let _initEvent = function() {
|
|
|
let _queryString = function() {
|
|
|
if (!window._jssdkQS) {
|
|
|
let vars = {},
|
|
|
hash,
|
|
|
i,
|
|
|
hashes = window.location.search.slice(1).split('&');
|
|
|
|
|
|
for (i = 0; i < hashes.length; i++) {
|
|
|
hash = hashes[i].split('=');
|
|
|
vars[hash[0]] = hash[1];
|
|
|
}
|
|
|
|
|
|
window._jssdkQS = vars;
|
|
|
}
|
|
|
|
|
|
return window._jssdkQS;
|
|
|
};
|
|
|
|
|
|
let _sParamByIframe = function() {
|
|
|
let search = window.location.search;
|
|
|
if (search.indexOf('&expires=') === -1) {
|
|
|
search = search + '&expires=' + (24 * 60 * 60 * 1000);
|
|
|
}
|
|
|
$('<iframe style="display:none;" src="//m.yohobuy.com/activity/wechat/1111' + search + '"></iframe>').prependTo('body');
|
|
|
};
|
|
|
|
|
|
let _bindEvent = function() {
|
|
|
let $body = $('body');
|
|
|
$body.on('click', '.feature-coin .close,.feature-coin .tip-close', function(e) {
|
|
|
$cointipTmpl.fadeOut();
|
...
|
...
|
@@ -47,41 +73,39 @@ let _initEvent = function() { |
|
|
});
|
|
|
};
|
|
|
|
|
|
let _bindUnionType = function() {
|
|
|
let qs = _queryString();
|
|
|
let union_type = qs.mkt_code || qs.union_type;
|
|
|
|
|
|
if (union_type) {
|
|
|
$('a').each(function(indx, el) {
|
|
|
el = $(el);
|
|
|
let h = el.attr('href');
|
|
|
if (h.indexOf('union.yoho.cn/union/downapp.html') > -1) {
|
|
|
el.attr('href', h + '?union_type=' + union_type);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
export default {
|
|
|
queryString: _queryString,
|
|
|
init() {
|
|
|
//发送活动页参数
|
|
|
let search = window.location.search;
|
|
|
if (search.indexOf('&expires=') === -1) {
|
|
|
search = search + '&expires=' + (24 * 60 * 60 * 1000);
|
|
|
}
|
|
|
$('<iframe style="display:none;" src="//m.yohobuy.com/activity/wechat/1111' + search + '"></iframe>').prependTo('body');
|
|
|
_sParamByIframe();
|
|
|
|
|
|
// 绑定事件
|
|
|
_initEvent();
|
|
|
_bindEvent();
|
|
|
|
|
|
// 下载链接绑定union_type
|
|
|
_bindUnionType();
|
|
|
},
|
|
|
isApp() {
|
|
|
let qs = this.queryString();
|
|
|
let qs = _queryString();
|
|
|
let isApp = !!qs.app_version || (qs.openrefer === 'app' && qs.uid);
|
|
|
|
|
|
return !!isApp;
|
|
|
},
|
|
|
queryString() {
|
|
|
if (!window._jssdkQS) {
|
|
|
let vars = {},
|
|
|
hash,
|
|
|
i,
|
|
|
hashes = window.location.search.slice(1).split('&');
|
|
|
|
|
|
for (i = 0; i < hashes.length; i++) {
|
|
|
hash = hashes[i].split('=');
|
|
|
vars[hash[0]] = hash[1];
|
|
|
}
|
|
|
|
|
|
window._jssdkQS = vars;
|
|
|
}
|
|
|
|
|
|
return window._jssdkQS;
|
|
|
},
|
|
|
image(url, width, height, mode, quality) {
|
|
|
mode = !isNaN(Number(mode)) ? mode : 2;
|
|
|
url = url || '';
|
...
|
...
|
|