Authored by 于良

Merge branch '5.4' of http://git.yoho.cn/mobile/YH_RNComponent into 5.4

@@ -50,7 +50,7 @@ export default class HotCategoryList extends Component{ @@ -50,7 +50,7 @@ export default class HotCategoryList extends Component{
50 return null; 50 return null;
51 } 51 }
52 52
53 - let imageUrl = SlicedImage.getSlicedUrl(rowData.get("default_images"), 82, 110, 2); 53 + let imageUrl = SlicedImage.getSlicedUrl(rowData.get("default_images"), 82, 109, 2);
54 // let categoryName = rowData.get("category_name"); 54 // let categoryName = rowData.get("category_name");
55 55
56 //数据类型,纯文字型和图片型,列表中会出现纯文本的情况,比如MORE 56 //数据类型,纯文字型和图片型,列表中会出现纯文本的情况,比如MORE
@@ -165,11 +165,12 @@ let styles = StyleSheet.create({ @@ -165,11 +165,12 @@ let styles = StyleSheet.create({
165 paddingRight: 8.5 * DEVICE_WIDTH_RATIO, 165 paddingRight: 8.5 * DEVICE_WIDTH_RATIO,
166 justifyContent: 'center', 166 justifyContent: 'center',
167 alignItems: 'center', 167 alignItems: 'center',
  168 + backgroundColor: '#f5f7f6',
168 }, 169 },
169 170
170 rowThumbnail:{ 171 rowThumbnail:{
171 width: 41 * DEVICE_WIDTH_RATIO, 172 width: 41 * DEVICE_WIDTH_RATIO,
172 - height: 55 * DEVICE_WIDTH_RATIO, 173 + height: 56 * DEVICE_WIDTH_RATIO,
173 }, 174 },
174 175
175 rowTextContainer:{ 176 rowTextContainer:{
@@ -62,10 +62,27 @@ class NewArrivalContainer extends Component { @@ -62,10 +62,27 @@ class NewArrivalContainer extends Component {
62 let { 62 let {
63 shop_name, 63 shop_name,
64 shops_id, 64 shops_id,
  65 + brand_id,
  66 + F_ID,
  67 + F_INDEX,
  68 + F_NM,
  69 + I_INDEX,
65 } = data; 70 } = data;
66 if (!shops_id||!shop_name) { 71 if (!shops_id||!shop_name) {
67 return; 72 return;
68 } 73 }
  74 +
  75 + let param = {
  76 + F_ID,
  77 + F_NM,
  78 + F_INDEX,
  79 + I_INDEX,
  80 + BRAND_ID: brand_id,
  81 + SHOP_ID: shops_id,
  82 + }
  83 + ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_NEW_ARRIVAL_FLR_C', param);
  84 +
  85 +
69 let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.shop","params":{"shop_id":"${shops_id}","shop_template_type":"1","shop_name":"${shop_name}"}}`; 86 let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.shop","params":{"shop_id":"${shops_id}","shop_template_type":"1","shop_name":"${shop_name}"}}`;
70 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); 87 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
71 } 88 }
@@ -77,7 +77,7 @@ export function getTopInfo() { @@ -77,7 +77,7 @@ export function getTopInfo() {
77 I_INDEX ++; 77 I_INDEX ++;
78 } 78 }
79 logData.push({ 79 logData.push({
80 - F_ID: 1, 80 + F_ID: 1001,
81 F_NM: 'BANNER', 81 F_NM: 'BANNER',
82 F_INDEX, 82 F_INDEX,
83 LIST, 83 LIST,
@@ -99,7 +99,7 @@ export function getTopInfo() { @@ -99,7 +99,7 @@ export function getTopInfo() {
99 I_INDEX ++; 99 I_INDEX ++;
100 } 100 }
101 logData.push({ 101 logData.push({
102 - F_ID: 2, 102 + F_ID: 1002,
103 F_NM: '为您推荐', 103 F_NM: '为您推荐',
104 F_INDEX, 104 F_INDEX,
105 LIST, 105 LIST,
@@ -121,7 +121,7 @@ export function getTopInfo() { @@ -121,7 +121,7 @@ export function getTopInfo() {
121 I_INDEX ++; 121 I_INDEX ++;
122 } 122 }
123 logData.push({ 123 logData.push({
124 - F_ID: 3, 124 + F_ID: 1003,
125 F_NM: '精选抢先看', 125 F_NM: '精选抢先看',
126 F_INDEX, 126 F_INDEX,
127 LIST, 127 LIST,
@@ -193,11 +193,16 @@ export function getProductList(reload=false) { @@ -193,11 +193,16 @@ export function getProductList(reload=false) {
193 return new NewArrivalService(app.host).fetchProductList(channel, order, page, pageSize, allFilterFactors) 193 return new NewArrivalService(app.host).fetchProductList(channel, order, page, pageSize, allFilterFactors)
194 .then(json => { 194 .then(json => {
195 let payload = parseProductList(json); 195 let payload = parseProductList(json);
  196 +
196 payload.endReached = payload.currentPage == payload.pageCount; 197 payload.endReached = payload.currentPage == payload.pageCount;
197 let LIST = []; 198 let LIST = [];
198 for (var i = 0; i < payload.list.length; i++) { 199 for (var i = 0; i < payload.list.length; i++) {
199 let item = payload.list[i] 200 let item = payload.list[i]
200 - let KEYWORD = ''; 201 + let ListItem = {
  202 + I_INDEX: productList.list.size + i + 1,
  203 + RECOMMEND_TYPE: item.recommend_type,
  204 + };
  205 + let KEYWORD_WORD = '';
201 if (item.recommend_type == 'hotSearchTerm'&&item.data.length) { 206 if (item.recommend_type == 'hotSearchTerm'&&item.data.length) {
202 KEYWORD = item.data.join(','); 207 KEYWORD = item.data.join(',');
203 } 208 }
@@ -219,16 +224,20 @@ export function getProductList(reload=false) { @@ -219,16 +224,20 @@ export function getProductList(reload=false) {
219 } 224 }
220 CATE_ID = tempAry.join(','); 225 CATE_ID = tempAry.join(',');
221 } 226 }
222 - LIST.push({  
223 - I_INDEX: productList.list.size + i + 1,  
224 - RECOMMEND_TYPE: item.recommend_type,  
225 - PRD_SKN: item.product_skn,  
226 - BRAND_ID: item.brand_id,  
227 - CATE_ID,  
228 - ARTICLE_ID,  
229 - SHOP_ID,  
230 - KEYWORD,  
231 - }) 227 + if (item.product_skn) {
  228 + ListItem.PRD_SKN = item.product_skn;
  229 + } else if (item.brand_id) {
  230 + ListItem.BRAND_ID = item.brand_id;
  231 + } else if (CATE_ID && CATE_ID!= '') {
  232 + ListItem.CATE_ID = CATE_ID;
  233 + } else if (ARTICLE_ID && ARTICLE_ID != 0) {
  234 + ListItem.ARTICLE_ID = ARTICLE_ID;
  235 + } else if (SHOP_ID && SHOP_ID != 0) {
  236 + ListItem.SHOP_ID = SHOP_ID;
  237 + } else if (KEYWORD_WORD && KEYWORD_WORD != '') {
  238 + ListItem.KEYWORD_WORD = KEYWORD_WORD;
  239 + }
  240 + LIST.push(ListItem);
232 } 241 }
233 let F_INDEX = 1; 242 let F_INDEX = 1;
234 if (topPart.topList.size) { 243 if (topPart.topList.size) {
@@ -400,9 +409,93 @@ export function getRecommendBrand() { @@ -400,9 +409,93 @@ export function getRecommendBrand() {
400 dispatch(recommendBrandRequest()); 409 dispatch(recommendBrandRequest());
401 return new NewArrivalService(app.host).fetchRecommendBrand(channel) 410 return new NewArrivalService(app.host).fetchRecommendBrand(channel)
402 .then(json => { 411 .then(json => {
403 - let hotBrandList = json.hot_brand_list;  
404 let browseBrandList = json.browse_brand_list; 412 let browseBrandList = json.browse_brand_list;
  413 + let hotBrandList = json.hot_brand_list;
405 let newBrandList = json.new_brand_list; 414 let newBrandList = json.new_brand_list;
  415 + /**
  416 + 数据曝光
  417 + */
  418 + let logData = [];
  419 + let F_INDEX = 1;
  420 + if (browseBrandList && browseBrandList.length) {
  421 + let LIST = [];
  422 + let I_INDEX = 1;
  423 + for (var i = 0; i < browseBrandList.length; i++) {
  424 + browseBrandList[i].F_ID = 1001;
  425 + browseBrandList[i].F_INDEX = F_INDEX;
  426 + browseBrandList[i].F_NM = '浏览过的品牌';
  427 + browseBrandList[i].I_INDEX = I_INDEX;
  428 + let item = browseBrandList[i];
  429 + LIST.push({
  430 + I_INDEX,
  431 + BRAND_ID: item.brand_id,
  432 + SHOP_ID: item.shops_id,
  433 + });
  434 + I_INDEX ++;
  435 + }
  436 + logData.push({
  437 + F_ID: 1001,
  438 + F_NM: '浏览过的品牌',
  439 + F_INDEX,
  440 + LIST,
  441 + });
  442 + F_INDEX ++;
  443 + }
  444 +
  445 + if (hotBrandList && hotBrandList.length) {
  446 + let LIST = [];
  447 + let I_INDEX = 1;
  448 + for (var i = 0; i < hotBrandList.length; i++) {
  449 + let item = hotBrandList[i];
  450 + hotBrandList[i].F_ID = 1002;
  451 + hotBrandList[i].F_INDEX = F_INDEX;
  452 + hotBrandList[i].F_NM = '热门品牌';
  453 + hotBrandList[i].I_INDEX = I_INDEX;
  454 + LIST.push({
  455 + I_INDEX,
  456 + BRAND_ID: item.brand_id,
  457 + SHOP_ID: item.shops_id,
  458 + });
  459 + I_INDEX ++;
  460 + }
  461 + logData.push({
  462 + F_ID: 1002,
  463 + F_NM: '热门品牌',
  464 + F_INDEX,
  465 + LIST,
  466 + });
  467 + F_INDEX ++;
  468 + }
  469 +
  470 + if (newBrandList && newBrandList.length) {
  471 + let LIST = [];
  472 + let I_INDEX = 1;
  473 + for (var i = 0; i < newBrandList.length; i++) {
  474 + let item = hotBrandList[i];
  475 + hotBrandList[i].F_ID = 1003;
  476 + hotBrandList[i].F_INDEX = F_INDEX;
  477 + hotBrandList[i].F_NM = '新入驻品牌';
  478 + hotBrandList[i].I_INDEX = I_INDEX;
  479 + LIST.push({
  480 + I_INDEX,
  481 + BRAND_ID: item.brand_id,
  482 + SHOP_ID: item.shops_id,
  483 + });
  484 + I_INDEX ++;
  485 + }
  486 + logData.push({
  487 + F_ID: 1003,
  488 + F_NM: '新入驻品牌',
  489 + F_INDEX,
  490 + LIST,
  491 + });
  492 + F_INDEX ++;
  493 + }
  494 + let params = {
  495 + DATA: logData,
  496 + };
  497 + ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_SHOW_NEW_ARRIVAL_RECOMMEND', params);
  498 +
406 dispatch(recommendBrandSuccess({hotBrandList, browseBrandList, newBrandList})); 499 dispatch(recommendBrandSuccess({hotBrandList, browseBrandList, newBrandList}));
407 }) 500 })
408 .catch(error => { 501 .catch(error => {
@@ -413,7 +506,25 @@ export function getRecommendBrand() { @@ -413,7 +506,25 @@ export function getRecommendBrand() {
413 506
414 export function goToRecommendForYou() { 507 export function goToRecommendForYou() {
415 return (dispatch, getState) => { 508 return (dispatch, getState) => {
  509 + let {app, newArrival} = getState();
  510 + let { productList, filterFactors, topPart} = newArrival;
  511 +
  512 + let I_INDEX = "0";
  513 + let F_INDEX = 1;
  514 + if (newArrival.topPart.topList.size) {
  515 + F_INDEX = 2;
  516 + }
  517 + F_INDEX = F_INDEX.toString();
  518 + let param = {
  519 + F_ID: "1002",
  520 + F_NM: '为您推荐',
  521 + F_INDEX,
  522 + I_INDEX,
  523 + }
  524 + ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_NEW_ARRIVAL_FLR_C', param);
  525 +
416 ReactNative.NativeModules.YH_NewArrivalHelper.goToRecommendForYou(); 526 ReactNative.NativeModules.YH_NewArrivalHelper.goToRecommendForYou();
  527 +
417 }; 528 };
418 } 529 }
419 530