...
|
...
|
@@ -59,13 +59,47 @@ export function selectCategoryB(category){ |
|
|
relation_parameter: category.relation_parameter,
|
|
|
node_count: category.node_count,
|
|
|
};
|
|
|
//设置当前的类别信息
|
|
|
//设置当前的类别信息
|
|
|
dispatch(setCurrentCateB(categoryId, categoryValue));
|
|
|
dispatch(jumpToCategory(all, 0, categoryB.currentChannelId));
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 点击More事件
|
|
|
**/
|
|
|
export function pressCategoryBMore(category_id){
|
|
|
return (dispatch, getState) => {
|
|
|
let {categoryB} = getState();
|
|
|
|
|
|
//获取当前频道下一级分类列表信息
|
|
|
let categoryData = categoryB.categoryList.get(categoryB.currentChannelValue);
|
|
|
|
|
|
//获取指定category_id分类信息
|
|
|
let category = null;
|
|
|
categoryData.map((item, i) => {
|
|
|
if(category_id == item.get('category_id')){
|
|
|
category = item;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
let all = {
|
|
|
category_name: "全部" + (category ? category.category_name : ""),
|
|
|
parent_id: category_id,
|
|
|
relation_parameter: category ? category.get('relation_parameter') : {},
|
|
|
node_count: category ? category.get('node_count') : 0,
|
|
|
};
|
|
|
|
|
|
console.log("chenlin", JSON.stringify(all));
|
|
|
|
|
|
//设置当前的类别信息
|
|
|
dispatch(setCurrentCateB(category_id, category.category_name));
|
|
|
dispatch(jumpToCategory(all, 0, categoryB.currentChannelId));
|
|
|
|
|
|
};
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取子分类的数据,逻辑上先判断缓存数据是否存在,不存在则从网络获取
|
...
|
...
|
@@ -178,32 +212,33 @@ function parseCategoryBSubDetail(channel_id, category_id, subcategory_data, prop |
|
|
return;
|
|
|
}
|
|
|
|
|
|
//分类信息不为空时,添加more
|
|
|
if(subcategory_data.sortInfo && subcategory_data.sortInfo.length > 0){
|
|
|
// 暂时不添加MORE,陈林修改 2017.1.13
|
|
|
// //分类信息不为空时,添加more
|
|
|
// if(subcategory_data.sortInfo && subcategory_data.sortInfo.length > 0){
|
|
|
|
|
|
//获取当前频道下一级分类列表信息
|
|
|
let categoryData = props_data.categoryList.get(props_data.currentChannelValue);
|
|
|
// //获取当前频道下一级分类列表信息
|
|
|
// let categoryData = props_data.categoryList.get(props_data.currentChannelValue);
|
|
|
|
|
|
//获取指定category_id分类信息
|
|
|
let category = null;
|
|
|
categoryData.map((item, i) => {
|
|
|
if(category_id == item.get('category_id')){
|
|
|
category = item;
|
|
|
}
|
|
|
});
|
|
|
// //获取指定category_id分类信息
|
|
|
// let category = null;
|
|
|
// categoryData.map((item, i) => {
|
|
|
// if(category_id == item.get('category_id')){
|
|
|
// category = item;
|
|
|
// }
|
|
|
// });
|
|
|
|
|
|
let more = {
|
|
|
show_category_name: 'MORE',
|
|
|
category_name: "全部" + (category ? category.get('category_name') : ''),
|
|
|
parent_id: category_id,
|
|
|
relation_parameter: category ? category.get('relation_parameter') : {},
|
|
|
node_count: category ? category.get('node_count') : 0,
|
|
|
data_type:'text',
|
|
|
};
|
|
|
// let more = {
|
|
|
// show_category_name: 'MORE',
|
|
|
// category_name: "全部" + (category ? category.get('category_name') : ''),
|
|
|
// parent_id: category_id,
|
|
|
// relation_parameter: category ? category.get('relation_parameter') : {},
|
|
|
// node_count: category ? category.get('node_count') : 0,
|
|
|
// data_type:'text',
|
|
|
// };
|
|
|
|
|
|
|
|
|
subcategory_data.sortInfo.push(more);
|
|
|
}
|
|
|
// subcategory_data.sortInfo.push(more);
|
|
|
// }
|
|
|
|
|
|
let key = getSubDetailCacheKey(channel_id, category_id);
|
|
|
|
...
|
...
|
@@ -281,4 +316,96 @@ export function jumpToCategory(value, index, channelId){ |
|
|
type: JUMP_TO_CATEGORY,
|
|
|
payload: value
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
function dataExposure(json) {
|
|
|
return (dispatch, getState) => {
|
|
|
if (!json) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
let {boy, girl, kids, lifestyle} = json;
|
|
|
|
|
|
let newBoy = [];
|
|
|
let newGirl = [];
|
|
|
let newKids = [];
|
|
|
let newLifestyle = [];
|
|
|
|
|
|
boy.map((item, i) => {
|
|
|
let subList = [];
|
|
|
item.sub && item.sub.map((sub, k) => {
|
|
|
subList.push({
|
|
|
I_INDEX: k + 1,
|
|
|
CAT_ID: sub.category_id,
|
|
|
});
|
|
|
});
|
|
|
|
|
|
newBoy.push({
|
|
|
I_INDEX: i + 1,
|
|
|
CAT_ID: item.category_id,
|
|
|
SUBLIST: subList,
|
|
|
});
|
|
|
});
|
|
|
|
|
|
girl.map((item, i) => {
|
|
|
let subList = [];
|
|
|
item.sub && item.sub.map((sub, k) => {
|
|
|
subList.push({
|
|
|
I_INDEX: k + 1,
|
|
|
CAT_ID: sub.category_id,
|
|
|
});
|
|
|
});
|
|
|
|
|
|
newGirl.push({
|
|
|
I_INDEX: i + 1,
|
|
|
CAT_ID: item.category_id,
|
|
|
SUBLIST: subList,
|
|
|
});
|
|
|
});
|
|
|
|
|
|
kids.map((item, i) => {
|
|
|
let subList = [];
|
|
|
item.sub && item.sub.map((sub, k) => {
|
|
|
subList.push({
|
|
|
I_INDEX: k + 1,
|
|
|
CAT_ID: sub.category_id,
|
|
|
});
|
|
|
});
|
|
|
|
|
|
newKids.push({
|
|
|
I_INDEX: i + 1,
|
|
|
CAT_ID: item.category_id,
|
|
|
SUBLIST: subList,
|
|
|
});
|
|
|
});
|
|
|
|
|
|
lifestyle.map((item, i) => {
|
|
|
let subList = [];
|
|
|
item.sub && item.sub.map((sub, k) => {
|
|
|
subList.push({
|
|
|
I_INDEX: k + 1,
|
|
|
CAT_ID: sub.category_id,
|
|
|
});
|
|
|
});
|
|
|
|
|
|
newLifestyle.push({
|
|
|
I_INDEX: i + 1,
|
|
|
CAT_ID: item.category_id,
|
|
|
SUBLIST: subList,
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
let params = {
|
|
|
YH_AppChannelBoy: newBoy,
|
|
|
YH_AppChannelGirl: newGirl,
|
|
|
YH_AppChannelKid: newKids,
|
|
|
YH_AppChannelLifeStyle: newLifestyle,
|
|
|
};
|
|
|
|
|
|
// console.log(params);
|
|
|
|
|
|
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_SHOW_CATEGORY', params);
|
|
|
};
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|