Authored by 沈志敏

下载链接 添加union_type

... ... @@ -119,6 +119,7 @@
<a class="yoho-coin" href="javascript:;" data-token="2aa1d0c6e83f027327d8461063f4ac58a6">
<img src="http://img02.yohoboys.com/staticimg/2016/04/22/14/02a8b1c09363f84c34aa56d11bb5cd7eb4.png">
</a>
<a class="anchor" href='http://union.yoho.cn/union/downapp.html'></a>
<input id="imgwh" type="hidden" name="" value="200x300">
<div class="feature-product-info">
<a class="product-brand" href="xxx">
... ...
... ... @@ -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">&times;</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 || '';
... ...