Authored by 毕凯

Merge branch 'feature/point' into 'master'

params-for-app



See merge request !4
{
"name": "yoho-js-sdk",
"version": "1.3.0",
"version": "1.3.1",
"description": "YOHO!前端js的功能封装包,主要用于在活动页面中,对主要功能的封装。",
"keywords": [
"YOHO!",
... ...
... ... @@ -5,21 +5,36 @@ import utils from './utils';
import cookies from './cookies';
let abTestFlag = false; // ab测试
let getPname = function () {
let pName = '';
if (utils.isMobile.iOS()) {
pName = 'iFP_SalesPromotion_h5';
}
if (utils.isMobile.Android()) {
pName = 'aFP_SalesPromotion_h5';
}
return pName;
};
let _replaceData = function(el, cond, data, wh, fp) {
if (!data) {
return;
}
el.find('.brand-name').html(data.brand_name);
el.find('.product-detail').attr('href', `//m.yohobuy.com/product/${data.product_skn}.html?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${data.product_skn}}}`);
el.find('.product-detail').attr('href', `//m.yohobuy.com/product/${data.product_skn}.html?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${data.product_skn},"from_page_name":"${getPname()}","from_page_param":"${location.href.split('?')[0]}"}}`);
el.find('.product-detail-img').attr('src', utils.image(data.default_images, wh.w, wh.h, 2, 75));
el.find('.product-name').html(data.product_name);
el.find('.vip-price-val').html(${data.vip_price}`);
el.find('.sale-price').html(${data.sales_price}`);
el.data('skn', data.product_skn);
if (data.sales_price === data.market_price) {
el.find('.market-price').hide();
} else {
el.find('.market-price').html(${data.market_price}`).show();
el.find('.market-price').html(${data.market_price}`).show();
}
let brandDom = el.find('.product-brand');
... ... @@ -41,7 +56,7 @@ let _replaceData = function(el, cond, data, wh, fp) {
fp.I_INDEX++;
brandDom.attr('fp', JSON.stringify(fp));
}
}
}
let listDom = el.find('.list-product');
if (listDom) {
... ... @@ -159,7 +174,7 @@ let _jsonp = function(el, param, cond){
}
let $newGoods = el.find('.feature-product-info');
$newGoods.each(function(indx, perProduct) {
let $perProduct = $(perProduct);
_replaceData($perProduct, cond, _getProductData(res), wh, fp);
... ... @@ -243,8 +258,8 @@ let _getProduct = function(param) {
let yh_channel = utils.queryString().yh_channel;
if (cond.abtest) {
abTestFlag = true;
}
}
if (yh_channel) {
cond.yh_channel = yh_channel;
}
... ... @@ -288,4 +303,4 @@ export default {
});
}
}
};
\ No newline at end of file
};
... ...
... ... @@ -95,6 +95,7 @@ let _bindEvent = function() {
export default {
queryString: _queryString,
isMobile: isMobile,
init() {
//发送活动页参数
_sParamByIframe();
... ... @@ -168,4 +169,4 @@ export default {
$('body').append($cointipTmpl);
$cointipTmpl.show();
}
};
\ No newline at end of file
};
... ...