Authored by 毕凯

Merge branch 'feature/point' into 'master'

params-for-app



See merge request !4
1 { 1 {
2 "name": "yoho-js-sdk", 2 "name": "yoho-js-sdk",
3 - "version": "1.3.0", 3 + "version": "1.3.1",
4 "description": "YOHO!前端js的功能封装包,主要用于在活动页面中,对主要功能的封装。", 4 "description": "YOHO!前端js的功能封装包,主要用于在活动页面中,对主要功能的封装。",
5 "keywords": [ 5 "keywords": [
6 "YOHO!", 6 "YOHO!",
@@ -5,17 +5,32 @@ import utils from './utils'; @@ -5,17 +5,32 @@ import utils from './utils';
5 import cookies from './cookies'; 5 import cookies from './cookies';
6 6
7 let abTestFlag = false; // ab测试 7 let abTestFlag = false; // ab测试
  8 +let getPname = function () {
  9 + let pName = '';
  10 +
  11 + if (utils.isMobile.iOS()) {
  12 + pName = 'iFP_SalesPromotion_h5';
  13 + }
  14 +
  15 + if (utils.isMobile.Android()) {
  16 + pName = 'aFP_SalesPromotion_h5';
  17 + }
  18 +
  19 + return pName;
  20 +};
  21 +
8 let _replaceData = function(el, cond, data, wh, fp) { 22 let _replaceData = function(el, cond, data, wh, fp) {
9 if (!data) { 23 if (!data) {
10 return; 24 return;
11 } 25 }
12 26
13 el.find('.brand-name').html(data.brand_name); 27 el.find('.brand-name').html(data.brand_name);
14 - 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}}}`); 28 + 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]}"}}`);
15 el.find('.product-detail-img').attr('src', utils.image(data.default_images, wh.w, wh.h, 2, 75)); 29 el.find('.product-detail-img').attr('src', utils.image(data.default_images, wh.w, wh.h, 2, 75));
16 el.find('.product-name').html(data.product_name); 30 el.find('.product-name').html(data.product_name);
17 el.find('.vip-price-val').html(${data.vip_price}`); 31 el.find('.vip-price-val').html(${data.vip_price}`);
18 el.find('.sale-price').html(${data.sales_price}`); 32 el.find('.sale-price').html(${data.sales_price}`);
  33 + el.data('skn', data.product_skn);
19 if (data.sales_price === data.market_price) { 34 if (data.sales_price === data.market_price) {
20 el.find('.market-price').hide(); 35 el.find('.market-price').hide();
21 } else { 36 } else {
@@ -95,6 +95,7 @@ let _bindEvent = function() { @@ -95,6 +95,7 @@ let _bindEvent = function() {
95 95
96 export default { 96 export default {
97 queryString: _queryString, 97 queryString: _queryString,
  98 + isMobile: isMobile,
98 init() { 99 init() {
99 //发送活动页参数 100 //发送活动页参数
100 _sParamByIframe(); 101 _sParamByIframe();