|
@@ -64,7 +64,7 @@ export function getCategoryBSubCategoryDetail(category_id, category_value){ |
|
@@ -64,7 +64,7 @@ export function getCategoryBSubCategoryDetail(category_id, category_value){ |
64
|
//未命中,访问网络数据
|
64
|
//未命中,访问网络数据
|
65
|
if (!categoryData) {
|
65
|
if (!categoryData) {
|
66
|
// console.log("chenlin", "未命中缓存,调用接口访问数据:" + key);
|
66
|
// console.log("chenlin", "未命中缓存,调用接口访问数据:" + key);
|
67
|
- dispatch(getCategoryBSubDetail(currentChannelId, category_id, category_value));
|
67
|
+ dispatch(getCategoryBSubDetail(currentChannelId, category_id));
|
68
|
}
|
68
|
}
|
69
|
//已命中,展示缓存数据
|
69
|
//已命中,展示缓存数据
|
70
|
else{
|
70
|
else{
|
|
@@ -87,15 +87,30 @@ function getSubDetailCacheKey(channel_id, category_id){ |
|
@@ -87,15 +87,30 @@ function getSubDetailCacheKey(channel_id, category_id){ |
87
|
/**
|
87
|
/**
|
88
|
* 网络获取子分类的数据
|
88
|
* 网络获取子分类的数据
|
89
|
**/
|
89
|
**/
|
90
|
-export function getCategoryBSubDetail(channel_id, category_id, category_value) {
|
90
|
+export function getCategoryBSubDetail(channel_id, category_id) {
|
91
|
return (dispatch, getState) => {
|
91
|
return (dispatch, getState) => {
|
92
|
- let {app} = getState();
|
92
|
+ let {app, categoryB} = getState();
|
|
|
93
|
+
|
|
|
94
|
+ //各频道固定资源位
|
|
|
95
|
+ let content_code = '';
|
|
|
96
|
+ if(channel_id == '1'){
|
|
|
97
|
+ content_code = 'daaa8b1a5103a30419ebd79c06e6feac';
|
|
|
98
|
+ }
|
|
|
99
|
+ else if(channel_id == '2'){
|
|
|
100
|
+ content_code = '1a18449fa785631b302dc6d27388bf93';
|
|
|
101
|
+ }
|
|
|
102
|
+ else if(channel_id == '3'){
|
|
|
103
|
+ content_code = '591152bee9fddcb0b4f793aa38304cb5';
|
|
|
104
|
+ }
|
|
|
105
|
+ else if(channel_id == '4'){
|
|
|
106
|
+ content_code = 'e823582db5ead63c82e0d348c4e6a6bb';
|
|
|
107
|
+ }
|
93
|
|
108
|
|
94
|
dispatch(getCategoryBSubDetailRequest());
|
109
|
dispatch(getCategoryBSubDetailRequest());
|
95
|
|
110
|
|
96
|
- return new CategoryBService(app.host).getCategoryBSubDetail(channel_id, category_id)
|
111
|
+ return new CategoryBService(app.host).getCategoryBSubDetail(channel_id, category_id, content_code)
|
97
|
.then(json => {
|
112
|
.then(json => {
|
98
|
- let payload = parseCategoryBSubDetail(channel_id, category_id, json);
|
113
|
+ let payload = parseCategoryBSubDetail(channel_id, category_id, json, categoryB);
|
99
|
dispatch(getCategoryBSubDetailSuccess(payload));
|
114
|
dispatch(getCategoryBSubDetailSuccess(payload));
|
100
|
})
|
115
|
})
|
101
|
.catch(error => {
|
116
|
.catch(error => {
|
|
@@ -133,34 +148,45 @@ export function getCategoryBFirstSubCategoryDetail(channel_id) { |
|
@@ -133,34 +148,45 @@ export function getCategoryBFirstSubCategoryDetail(channel_id) { |
133
|
|
148
|
|
134
|
|
149
|
|
135
|
/**
|
150
|
/**
|
136
|
- *在尾部添加一个MORE
|
151
|
+ *在子分类的数据尾部添加一个MORE,因为需要获取relation_parameter 和 node_count数据,所以不得不从分类列表中筛选找出
|
137
|
**/
|
152
|
**/
|
138
|
-function parseCategoryBSubDetail(channel_id, category_id, data) {
|
|
|
139
|
- if(!data){
|
153
|
+function parseCategoryBSubDetail(channel_id, category_id, subcategory_data, props_data) {
|
|
|
154
|
+ if(!subcategory_data || !props_data){
|
140
|
return;
|
155
|
return;
|
141
|
}
|
156
|
}
|
142
|
|
157
|
|
143
|
- if(data.sortInfo){
|
158
|
+ //分类信息不为空时,添加more
|
|
|
159
|
+ if(subcategory_data.sortInfo){
|
|
|
160
|
+
|
|
|
161
|
+ //获取当前频道下一级分类列表信息
|
|
|
162
|
+ let categoryData = props_data.categoryList.get(props_data.currentChannelValue);
|
|
|
163
|
+
|
|
|
164
|
+ //获取指定category_id分类信息
|
|
|
165
|
+ let category = null;
|
|
|
166
|
+ categoryData.map((item, i) => {
|
|
|
167
|
+ if(category_id == item.get('category_id')){
|
|
|
168
|
+ category = item;
|
|
|
169
|
+ }
|
|
|
170
|
+ });
|
|
|
171
|
+
|
144
|
let more = {
|
172
|
let more = {
|
145
|
category_name: 'more',
|
173
|
category_name: 'more',
|
146
|
parent_id: category_id,
|
174
|
parent_id: category_id,
|
147
|
- relation_parameter:{},
|
175
|
+ relation_parameter: category ? category.get('relation_parameter') : {},
|
|
|
176
|
+ node_count: category ? category.get('node_count') : 0,
|
148
|
data_type:'text',
|
177
|
data_type:'text',
|
149
|
};
|
178
|
};
|
150
|
- data.sortInfo.push(more);
|
179
|
+
|
|
|
180
|
+
|
|
|
181
|
+ subcategory_data.sortInfo.push(more);
|
151
|
}
|
182
|
}
|
152
|
|
183
|
|
153
|
let key = getSubDetailCacheKey(channel_id, category_id);
|
184
|
let key = getSubDetailCacheKey(channel_id, category_id);
|
154
|
- // let newData = {
|
|
|
155
|
- // bannerInfo: data.bannerInfo,
|
|
|
156
|
- // sortInfo: data.sortInfo,
|
|
|
157
|
- // brandInfo: data.brandInfo,
|
|
|
158
|
- // }
|
|
|
159
|
|
185
|
|
160
|
// console.log("chenlin", "parseCategoryBSubDetail处理后的JSON数据:" + JSON.stringify(data));
|
186
|
// console.log("chenlin", "parseCategoryBSubDetail处理后的JSON数据:" + JSON.stringify(data));
|
161
|
|
187
|
|
162
|
|
188
|
|
163
|
- return {key: key, data: data};
|
189
|
+ return {key: key, data: subcategory_data};
|
164
|
|
190
|
|
165
|
}
|
191
|
}
|
166
|
|
192
|
|