Authored by 于良

Merge branch '5.8.0-0.44.0' of http://git.yoho.cn/mobile/YH_RNComponent into 5.8.0-0.44.0

'use strict';
'use strict';
import React from 'react';
import ReactNative from 'react-native';
... ... @@ -33,10 +33,10 @@ export default class BrandProductFilter extends React.Component {
key: 'default',
name: '默认',
value: {
asc: '',
desc: '',
normal: '',
popular: 'h_v_desc',
},
isAsc: false,
isPopular: false,
radio: true,
},
{
... ... @@ -47,7 +47,7 @@ export default class BrandProductFilter extends React.Component {
desc: 's_t_desc',
},
isAsc: false,
radio: true,
radio: false,
},
{
key: 'price',
... ... @@ -92,6 +92,8 @@ export default class BrandProductFilter extends React.Component {
down_normal:require('../../../../image/filter/brandstore_filter_arrow_down_normal.png'),
up:require('../../../../image/filter/brandstore_filter_arrow_up.png'),
up_normal:require('../../../../image/filter/brandstore_filter_arrow_up_normal.png'),
default_normal:require('../../../../image/filter/3_down_h.png'),
default_selected:require('../../../../image/filter/3_down.png'),
};
}
... ... @@ -105,13 +107,14 @@ export default class BrandProductFilter extends React.Component {
_renderImage(rowData, rowID) {
let img;
if(rowID==0||rowID==1){
// if (rowID == this.state.selectedIndex) {
// img = this.props.moreFilter ? this.images.up : this.images.down;
// }else{
// img = this.props.moreFilter ? this.images.up_normal : this.images.down_normal;
// }
img = null;
if(rowID==0){
if (rowID == this.state.selectedIndex) {
img = this.images.default_selected;
}else{
img = this.images.default_normal;
}
}else if(rowID==1){
return null;
}else if(rowID==4){
img = this.props.lastSelected ? this.images.up : this.images.down_normal;
}else{
... ... @@ -131,11 +134,13 @@ export default class BrandProductFilter extends React.Component {
}
if(rowID==0){
// if(this.props.selectOrder=='s_t_desc'){
// rowData.name='最新';
// }else{
// rowData.name='默认';
// }
if(this.props.selectOrder=='h_v_desc'){
this.lastSelectedPopular = true;
rowData.name='人气';
}else if (this.props.selectOrder == '') {
this.lastSelectedPopular = false;
rowData.name='默认';
}
}
return (
<View style={{backgroundColor: 'white'}}>
... ... @@ -143,10 +148,22 @@ export default class BrandProductFilter extends React.Component {
let filters = this.state.filters;
let filter = this.state.filters[rowID];
// if (filter.radio) {
// this.props.onPressFilter && this.props.onPressFilter(filters[0].key);
// return;
// }
if (rowID == 1 && this.state.selectedIndex == 1) {
return;
}
if (filter.radio) {
if (this.state.selectedIndex > 0) {
this.setState({
selectedIndex: rowID,
});
let value = this.lastSelectedPopular ? filter.value['popular'] : filter.value['normal'];
this.props.onPressFilter && this.props.onPressFilter(value);
} else {
this.props.onPressFilter && this.props.onPressFilter(filters[0].key);
}
return;
}
if (rowID == 4) {
let value = 'filter';
this.props.onPressFilter && this.props.onPressFilter(value);
... ...
... ... @@ -36,8 +36,8 @@ export default class BrandProductMoreFilter extends React.Component {
},
{
key: 'new',
name: '最新',
value:'s_t_desc',
name: '人气',
value:'h_v_desc',
},
],
};
... ... @@ -56,6 +56,10 @@ export default class BrandProductMoreFilter extends React.Component {
}
_renderRow(rowData, sectionID, rowID) {
let colorStyle = {};
if(rowData.value != this.props.productList.order){
colorStyle = {color: '#b0b0b0'};
}
return (
<TouchableOpacity onPress={() => {
let filters = this.state.filters;
... ... @@ -63,7 +67,7 @@ export default class BrandProductMoreFilter extends React.Component {
this.props.onPressMoreFilter && this.props.onPressMoreFilter(filter.value);
}}>
<View key={'row' + rowID} style={styles.rowContainer}>
<Text style={styles.name}>{rowData.name}</Text>
<Text style={[styles.name, colorStyle]}>{rowData.name}</Text>
{this._renderImage(rowData, rowID)}
</View>
</TouchableOpacity>
... ...
... ... @@ -61,7 +61,7 @@ export default class ProductCategoryList extends React.Component {
</View>
<View style={[styles.underline]}></View>
</View>
</View>
</TouchableOpacity>
);
}
... ... @@ -112,7 +112,7 @@ export default class ProductCategoryList extends React.Component {
<ListView
ref='subCategoryList'
style={styles.rightContentContainer}
dataSource={this.dataSourceR.cloneWithRows(subList.toArray())}
dataSource={this.dataSourceR.cloneWithRows(subList.size?subList.toArray():[])}
renderRow={this.rightRenderRow}
scrollsToTop={false}
/>
... ...
... ... @@ -145,9 +145,12 @@ export function getProductList(reload) {
: products.currentPage + 1;
let pageSize = products.pageSize;
Promise.all([ReactNative.NativeModules.YH_CommonHelper.currentGender(), ReactNative.NativeModules.RNNativeConfig.uid()]).then(result => {
Promise.all([ReactNative.NativeModules.YH_CommonHelper.currentGender(),
ReactNative.NativeModules.RNNativeConfig.uid(),
ReactNative.NativeModules.YH_CommonHelper.currentChannel()]).then(result => {
gender = result[0];
uid = result[1];
channel = result[2];
fetchList(channel, gender, uid, page, pageSize);
}).catch(error => {});
};
... ... @@ -209,14 +212,22 @@ export function fetchBanner() {
//区分资源位
let channel = app.channel;
dispatch(fetchBannerRequest());
return new ListService(app.serviceHost).fetchBannerData(channel).then(json => {
dispatch(logBanner(json));
dispatch(fetchBannerSuccess(json));
Promise.all([
ReactNative.NativeModules.YH_CommonHelper.currentChannel()
]).then(result => {
channel = result[0];
dispatch(fetchBannerRequest());
return new ListService(app.serviceHost).fetchBannerData(channel).then(json => {
dispatch(logBanner(json));
dispatch(fetchBannerSuccess(json));
}).catch(error => {
dispatch(fetchBannerFailure(error));
});
}).catch(error => {
dispatch(fetchBannerFailure(error));
});
}
}
... ...
... ... @@ -219,7 +219,7 @@ export default class Detail extends Component {
<View style={{width: width,height: 20,backgroundColor: 'white',}}/>
);
}
return null;
return (<View style={{height:1,width:width,backgroundColor:'white'}}/>);
}
render() {
... ...
... ... @@ -54,7 +54,7 @@ export default class DetailBrand extends React.Component {
render() {
let {data} = this.props.resource.toJS();
if (!data.length) {
return null;
return (<View style={{height:1,width:width,backgroundColor:'white'}}/>);
}
return(
<View style={styles.container}>
... ... @@ -72,7 +72,6 @@ export default class DetailBrand extends React.Component {
/>
</View>
);
return null;
}
};
... ...
... ... @@ -120,7 +120,6 @@ export default class DetailText extends React.Component {
</WebView>
</View>
);
return null;
}
};
... ...
... ... @@ -37,7 +37,7 @@ export default class GoodsCell extends React.Component {
let originList = resource.get('productList');
let listSize = originList?originList.size:0;
if (!originList || listSize == 0) {
return null;
return (<View style={{height:1,width:width,backgroundColor:'white'}}/>);
}
let list = originList;
if (this.state.moreProduct && listSize > 2) {
... ...
... ... @@ -70,7 +70,7 @@ export default class GoodsGroupHeader extends React.Component {
let list = resource?resource.get('data'):null;
if (!list || list.size == 0) {
return null;
return (<View style={{height:1,width:width,backgroundColor:'white'}}/>);
}
let arrow_up_offset = ((Math.ceil(this.selectedIndex)+1) *2 - 1)*10 + (itemW-20) * ((Math.ceil(this.selectedIndex)+1) - 0.5) - 8;
... ...
... ... @@ -68,7 +68,6 @@ export default class OtherArticle extends React.Component {
/>
</View>
);
return null;
}
};
... ...
... ... @@ -71,7 +71,7 @@ export default class RecommentProducts extends React.Component {
productList = productList.concat(dataLimit);
if (!productList || productList.size == 0) {
return null;
return (<View style={{height:1,width:width,backgroundColor:'white'}}/>);
}
return (
... ...
... ... @@ -50,7 +50,7 @@ export default class SmallPic extends React.Component {
let url1 = data?data[0].src:null;
let url2 = data?data[1].src:null;
if (!url1 || !url2) {
return null;
return (<View style={{height:1,width:width,backgroundColor:'white'}}/>);
}
let imageHeight0 = data?data[0].height:null;
... ...
... ... @@ -29,7 +29,7 @@ export default class Tags extends React.Component {
let tags = data ? data.tags : [];
if (!tags || !tags.length) {
return null;
return (<View style={{height:1,width:width,backgroundColor:'white'}}/>);
}
return (
... ...
... ... @@ -31,7 +31,7 @@ export default class WeChatPublic extends React.Component {
let error = data?data.error:'';
if (!data || error) {
return null;
return (<View style={{height:1,width:width,backgroundColor:'white'}}/>);
}
return (
... ...