Authored by chenl

Merge branch 'local' into 5.4

@@ -63,7 +63,11 @@ export default function native(platform) { @@ -63,7 +63,11 @@ export default function native(platform) {
63 63
64 _renderContainer() { 64 _renderContainer() {
65 if (this.props.type == 0) { 65 if (this.props.type == 0) {
66 - return <CategoryBContainer />; 66 + //如果是B版,则打开B版品类
  67 + if (this.props.abversion == "B")
  68 + return <CategoryBContainer />;
  69 + else
  70 + return <CategoryContainer />;
67 } else if (this.props.type == 1) { 71 } else if (this.props.type == 1) {
68 return <BrandContainer />; 72 return <BrandContainer />;
69 } else if (this.props.type == 2) { 73 } else if (this.props.type == 2) {
@@ -103,6 +103,7 @@ export default class HotCategoryList extends Component{ @@ -103,6 +103,7 @@ export default class HotCategoryList extends Component{
103 return( 103 return(
104 <View style={styles.container}> 104 <View style={styles.container}>
105 <ListView 105 <ListView
  106 + pageSize={9}
106 contentContainerStyle={styles.contentContainer} 107 contentContainerStyle={styles.contentContainer}
107 dataSource={this.dataSource.cloneWithRows(data)} 108 dataSource={this.dataSource.cloneWithRows(data)}
108 enableEmptySections={true} 109 enableEmptySections={true}
@@ -344,7 +344,7 @@ export function getBrandResource(channel) { @@ -344,7 +344,7 @@ export function getBrandResource(channel) {
344 content_code = 'f1aa914fd23cbcda71a87de6f5416c75'; 344 content_code = 'f1aa914fd23cbcda71a87de6f5416c75';
345 } 345 }
346 346
347 - return new BrandService(app.serviceHost).getBrandResource(content_code) 347 + return new BrandService(app.serviceHost).getBrandResource(channel, content_code)
348 .then(json => { 348 .then(json => {
349 let payload = parseResourceResources(json); 349 let payload = parseResourceResources(json);
350 if (channel == 1) { 350 if (channel == 1) {
@@ -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
@@ -29,10 +29,11 @@ export default class BrandService { @@ -29,10 +29,11 @@ export default class BrandService {
29 }); 29 });
30 } 30 }
31 31
32 - async getBrandResource(content_code,fromPage='iFP_Brand'){ 32 + async getBrandResource(channel_id, content_code,fromPage='iFP_Brand'){
33 return await this.api.get({ 33 return await this.api.get({
34 url: '/operations/api/v5/resource/get', 34 url: '/operations/api/v5/resource/get',
35 body: { 35 body: {
  36 + channel_id,
36 content_code, 37 content_code,
37 fromPage, 38 fromPage,
38 } 39 }
@@ -29,13 +29,15 @@ export default class CategoryBService { @@ -29,13 +29,15 @@ export default class CategoryBService {
29 }); 29 });
30 } 30 }
31 31
32 - async getCategoryBSubDetail(yh_channel, yh_sort, fromPage='aFP_Category'){ 32 + async getCategoryBSubDetail(yh_channel, yh_sort, content_code, fromPage='aFP_Category'){
  33 +
33 return await this.api.get({ 34 return await this.api.get({
34 url: '', 35 url: '',
35 body: { 36 body: {
36 method: 'app.sort.fromBigData', 37 method: 'app.sort.fromBigData',
37 channel_id: yh_channel, 38 channel_id: yh_channel,
38 msort: yh_sort, 39 msort: yh_sort,
  40 + contentCode: content_code,
39 fromPage, 41 fromPage,
40 } 42 }
41 }) 43 })