Authored by 孙凯

add 曝光数据组装 review by hongmo

'use strict';
import ReactNative from 'react-native';
import Immutable, {Map} from 'immutable';
const {
Dimensions,
... ... @@ -264,7 +265,9 @@ function heightForFloor(item, immutable=false) {
function homeDataParse(data, channel) {
let {list, cached, isFetching, isFirstLoad, endReached, favorite, bottomBanner, hotList, newList, selectIndex} = data;
let floorList = list.size > 0 ? list.toArray() : cached.get('list').toArray();
let floorListData = list.size > 0 ? list : cached.get('list');
let homeAutoReportList = homeFloorAutoReportData(floorListData,channel);
let floorList = homeAutoReportList?homeAutoReportList.toArray():[];
let dataSource = {};
if (channel == '4') {
let favlist = selectIndex == 0 ? newList : hotList;
... ... @@ -691,3 +694,172 @@ module.exports = {
parseReportData,
parseReportProductList
};
function homePruductListAutoReportData(list,channel) {
}
function homeFloorAutoReportData(list,channel) {
if (!list) {
return 0;
}
let pageName = 'iFP_Home'
let channlStr = 'boy';
if (channel == 1) {
channlStr = 'boy';
}else if (channel == 2){
channlStr = 'girl';
}else if (channel == 3){
channlStr = 'kid';
}else if (channel == 4){
channlStr = 'lifestyle';
}
let listData = list.toJS();
// console.log(listData);
// console.log('listData');
for (var i = 0; i < listData.length; i++) {
let item = listData[i];
let floorName = item.template_name;
let floorID = item.template_id;
let floorIndex = i;
switch(floorName) {
case 'focus': {
break;
}
case 'app_icon_list': {
let focueList = item.data?item.data:[];
for (var j = 0; j < focueList.length; j++) {
let fcoueItem = focueList[j];
let inFloorIndex = j;
let actionUrl = fcoueItem.url;
let param = autoReportData(channlStr,floorName,floorID,floorIndex,inFloorIndex,actionUrl);
fcoueItem.yh_exposureData = param;
}
break;
}
case 'app_hot_brands': {
break;
}
case 'announcement': {
break;
}
case 'single_image': {
break;
}
case 'single_name_image': {
break;
}
case 'recommend_content_one': {
break;
}
case 'recommend_content_two': {
break;
}
case 'recommend_content_three': {
break;
}
case 'recommend_content_five': {
break;
}
case 'trendsetter_collocation': {
break;
}
case 'trendgoods_topic': {
break;
}
case 'custom_brands': {
break;
}
case 'kids_brands':{
break;
}
case 'small_pic': {
break;
}
case 'divideImage': {
break;
}
case 'NewProductFloor': {
break;
}
case 'popular_single_product': {
break;
}
case 'shopRecommend': {
break;
}
case 'sixLinesFloor': {
break;
}
case 'livePicture': {
break;
}
case 'sale-1t-1l-4r': {
break;
}
case 'vipUse': {
break;
}
case 'activityProductFloor': {
break;
}
case 'hot_category_individualization': {
break;
}
case 'new_user_floor': {
break;
}
}
}
console.log(listData);
return Immutable.fromJS(listData);
}
function autoReportData(channlStr,floorName,floorID,floorIndex,inFloorIndex,actionUrl,skn)
{
let param;
if (!skn && !actionUrl) {
return null;
}
if (skn) {
param = {
P_NAME : "iFP_Home",
P_PARAM : channlStr,
I_INDEX : inFloorIndex,
PRD_SKN : skn
}
}else {
param = {
P_NAME : "iFP_Home",
P_PARAM : channlStr,
F_NAME : floorName,
F_ID : floorID,
F_INDEX : floorIndex,
I_INDEX : inFloorIndex,
ACTION_URL : actionUrl,
}
}
return param;
}
... ...