Authored by yaya2212

Merge remote-tracking branch 'origin/5.5.0' into 5.5.0

... ... @@ -180,7 +180,7 @@ class HomeContainer extends Component {
rec_pose = '100011';
}
if (app.channel != 4) {
if (app.channel == 1 || app.channel == 2) {
rec_id = data.favorite.get('rec_id','');
let chooseForYouParam = {
... ... @@ -238,12 +238,12 @@ class HomeContainer extends Component {
'I_INDEX': parseInt(index)+1
};
NativeModules.YH_CommonHelper.logEvent('YB_MY_NOTICE_C', param);
NativeModules.YH_CommonHelper.logEvent('YB_MAIN_EVENT', param);
}
onPressAnnounceItem(jumpUrl, imageUrl, index, floorData, floorIndex) {
this.jumpWithUrl(jumpUrl, imageUrl, index, floorData, floorIndex);
NativeModules.YH_CommonHelper.logEvent('YB_MAIN_EVENT', {'POS_ID': '2'});
NativeModules.YH_CommonHelper.logEvent('YB_MY_NOTICE_C', {'POS_ID': '2'});
}
onPressShopFavorite(shopId, index) {
... ...
... ... @@ -201,6 +201,19 @@ function reportHomeData(payload) {
}
}
function reportFavoriteData(payload) {
return (dispatch) => {
try {
let reportData = floorParser.parseReportProductList(payload);
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_SHOW_MAIN_RECOMMEND', {'DATA': reportData});
} catch (e) {
__DEV__ && console.error(e);
} finally {
}
}
}
export function fetchHomeFavoriteList() {
return (dispatch, getState) => {
let {app, home} = getState();
... ... @@ -239,7 +252,7 @@ export function fetchBoyGirlFavoriteList() {
return new HomeService(app.host).fetchHomeFavoriteData(channel, contentCode, gender, fromPage, page)
.then(json =>{
let payload = floorParser.parseBoyGirlFavorite(json);
dispatch(reportFavoriteData(payload));
if (payload.currentPage > 1) {
let oldList = currentChannelData.favorite.get('list').toJS();
let newList = [...oldList, ...payload.list];
... ... @@ -306,6 +319,7 @@ export function fetchKidsFavoriteList() {
return new HomeService(app.host).fetchHomeKidFavoriteData(fromPage, page)
.then(json =>{
let payload = floorParser.parseKidsFavorite(json);
dispatch(reportFavoriteData(payload));
if (payload.currentPage > 1) {
let oldList = kid.favorite.get('list').toJS();
let newList = [...oldList, ...payload.list];
... ...
... ... @@ -260,6 +260,8 @@ function heightForFloor(item, immutable=false) {
return floorHeight;
}
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();
... ... @@ -646,6 +648,34 @@ function parseReportData(list) {
return reportData;
}
function parseReportProductList(json) {
let reportData = [];
let productData = {};
let productList = [];
let list = json && json.list ? json.list : [];
let page = json && json.currentPage ? json.currentPage : 1;
let index = 1;
if (page >= 1) {
index = (page-1)*50 +1;
}
for (var i = 0; i < list.length; i++) {
let product = list[i];
let param = {
'I_INDEX': i + index,
'IMAGE_URL': product&&product.default_images ? product.default_images : '',
'PRD_SKN': product&&product.product_skn ? product.product_skn : ''
}
productList.push(param);
}
productData.LIST = productList;
reportData.push(productData);
return reportData;
}
module.exports = {
calcluateFloorHeight,
heightForFloor,
... ... @@ -658,5 +688,6 @@ module.exports = {
parseBottomBanner,
parseShopInfo,
parseRecommendPop,
parseReportData
parseReportData,
parseReportProductList
};
... ...