Authored by chenl

Merge branch 'local' into 5.4

... ... @@ -63,7 +63,11 @@ export default function native(platform) {
_renderContainer() {
if (this.props.type == 0) {
return <CategoryBContainer />;
//如果是B版,则打开B版品类
if (this.props.abversion == "B")
return <CategoryBContainer />;
else
return <CategoryContainer />;
} else if (this.props.type == 1) {
return <BrandContainer />;
} else if (this.props.type == 2) {
... ...
... ... @@ -103,6 +103,7 @@ export default class HotCategoryList extends Component{
return(
<View style={styles.container}>
<ListView
pageSize={9}
contentContainerStyle={styles.contentContainer}
dataSource={this.dataSource.cloneWithRows(data)}
enableEmptySections={true}
... ...
... ... @@ -344,7 +344,7 @@ export function getBrandResource(channel) {
content_code = 'f1aa914fd23cbcda71a87de6f5416c75';
}
return new BrandService(app.serviceHost).getBrandResource(content_code)
return new BrandService(app.serviceHost).getBrandResource(channel, content_code)
.then(json => {
let payload = parseResourceResources(json);
if (channel == 1) {
... ...
... ... @@ -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};
}
... ...
... ... @@ -29,10 +29,11 @@ export default class BrandService {
});
}
async getBrandResource(content_code,fromPage='iFP_Brand'){
async getBrandResource(channel_id, content_code,fromPage='iFP_Brand'){
return await this.api.get({
url: '/operations/api/v5/resource/get',
body: {
channel_id,
content_code,
fromPage,
}
... ...
... ... @@ -29,13 +29,15 @@ export default class CategoryBService {
});
}
async getCategoryBSubDetail(yh_channel, yh_sort, fromPage='aFP_Category'){
async getCategoryBSubDetail(yh_channel, yh_sort, content_code, fromPage='aFP_Category'){
return await this.api.get({
url: '',
body: {
method: 'app.sort.fromBigData',
channel_id: yh_channel,
msort: yh_sort,
contentCode: content_code,
fromPage,
}
})
... ...