...
|
...
|
@@ -64,7 +64,7 @@ export function getCategoryBSubCategoryDetail(category_id, category_value){ |
|
|
//未命中,访问网络数据
|
|
|
if (!categoryData) {
|
|
|
// console.log("chenlin", "未命中缓存,调用接口访问数据:" + key);
|
|
|
dispatch(getCategoryBSubDetail(currentChannelId, category_id, category_value));
|
|
|
dispatch(getCategoryBSubDetail(currentChannelId, category_id));
|
|
|
}
|
|
|
//已命中,展示缓存数据
|
|
|
else{
|
...
|
...
|
@@ -87,15 +87,30 @@ function getSubDetailCacheKey(channel_id, category_id){ |
|
|
/**
|
|
|
* 网络获取子分类的数据
|
|
|
**/
|
|
|
export function getCategoryBSubDetail(channel_id, category_id, category_value) {
|
|
|
export function getCategoryBSubDetail(channel_id, category_id) {
|
|
|
return (dispatch, getState) => {
|
|
|
let {app} = getState();
|
|
|
let {app, categoryB} = getState();
|
|
|
|
|
|
//各频道固定资源位
|
|
|
let content_code = '';
|
|
|
if(channel_id == '1'){
|
|
|
content_code = 'daaa8b1a5103a30419ebd79c06e6feac';
|
|
|
}
|
|
|
else if(channel_id == '2'){
|
|
|
content_code = '1a18449fa785631b302dc6d27388bf93';
|
|
|
}
|
|
|
else if(channel_id == '3'){
|
|
|
content_code = '591152bee9fddcb0b4f793aa38304cb5';
|
|
|
}
|
|
|
else if(channel_id == '4'){
|
|
|
content_code = 'e823582db5ead63c82e0d348c4e6a6bb';
|
|
|
}
|
|
|
|
|
|
dispatch(getCategoryBSubDetailRequest());
|
|
|
|
|
|
return new CategoryBService(app.host).getCategoryBSubDetail(channel_id, category_id)
|
|
|
return new CategoryBService(app.host).getCategoryBSubDetail(channel_id, category_id, content_code)
|
|
|
.then(json => {
|
|
|
let payload = parseCategoryBSubDetail(channel_id, category_id, json);
|
|
|
let payload = parseCategoryBSubDetail(channel_id, category_id, json, categoryB);
|
|
|
dispatch(getCategoryBSubDetailSuccess(payload));
|
|
|
})
|
|
|
.catch(error => {
|
...
|
...
|
@@ -133,34 +148,45 @@ export function getCategoryBFirstSubCategoryDetail(channel_id) { |
|
|
|
|
|
|
|
|
/**
|
|
|
*在尾部添加一个MORE
|
|
|
*在子分类的数据尾部添加一个MORE,因为需要获取relation_parameter 和 node_count数据,所以不得不从分类列表中筛选找出
|
|
|
**/
|
|
|
function parseCategoryBSubDetail(channel_id, category_id, data) {
|
|
|
if(!data){
|
|
|
function parseCategoryBSubDetail(channel_id, category_id, subcategory_data, props_data) {
|
|
|
if(!subcategory_data || !props_data){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if(data.sortInfo){
|
|
|
//分类信息不为空时,添加more
|
|
|
if(subcategory_data.sortInfo){
|
|
|
|
|
|
//获取当前频道下一级分类列表信息
|
|
|
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;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
let more = {
|
|
|
category_name: 'more',
|
|
|
parent_id: category_id,
|
|
|
relation_parameter:{},
|
|
|
relation_parameter: category ? category.get('relation_parameter') : {},
|
|
|
node_count: category ? category.get('node_count') : 0,
|
|
|
data_type:'text',
|
|
|
};
|
|
|
data.sortInfo.push(more);
|
|
|
|
|
|
|
|
|
subcategory_data.sortInfo.push(more);
|
|
|
}
|
|
|
|
|
|
let key = getSubDetailCacheKey(channel_id, category_id);
|
|
|
// let newData = {
|
|
|
// bannerInfo: data.bannerInfo,
|
|
|
// sortInfo: data.sortInfo,
|
|
|
// brandInfo: data.brandInfo,
|
|
|
// }
|
|
|
|
|
|
// console.log("chenlin", "parseCategoryBSubDetail处理后的JSON数据:" + JSON.stringify(data));
|
|
|
|
|
|
|
|
|
return {key: key, data: data};
|
|
|
return {key: key, data: subcategory_data};
|
|
|
|
|
|
}
|
|
|
|
...
|
...
|
|