Authored by 于良

Merge branch '5.4.1' of http://git.yoho.cn/mobile/YH_RNComponent into 5.4.1

... ... @@ -78,7 +78,7 @@ export default class ActivityProductFloor extends Component {
let data = this.props.data;
let title = data.get('title').get('title');
let moreUrl = data.get('title').get('more_url');
let bgUrl = data.get('background').get('src');
let bgUrl = data.get('background') != null ? data.get('background').get('src'):null;
let visible = bgUrl ? true : false;
let bannerData = data.get('banner_image');
let productData = data.get('list');
... ... @@ -146,7 +146,7 @@ const styles = StyleSheet.create({
row: {
flexDirection: 'column',
width: cellWidth,
backgroundColor: 'white',
backgroundColor: '#f0f0f0',
borderRadius: 3,
justifyContent: 'center',
marginLeft: 6,
... ...
... ... @@ -20,45 +20,43 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import Immutable from 'immutable';
import SlicedImage from '../../../common/components/SlicedImage';
import HeadTitleCell from '../cell/HeadTitleCell';
import YH_Image from '../../../common/components/YH_Image';
export default class HotCategoryIndividualization extends Component {
constructor(props) {
super(props);
this._renderRow = this._renderRow.bind(this);
this._onPressItem = this._renderRow.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
});
}
_getImageUrl(rowId) {
return {uri: 'http://imgsrc.baidu.com/baike/pic/item/e61190ef76c6a7ef560572e1f8faaf51f2de66d2.jpg'};
}
_onPressItem() {
console.log('_onPressItem');
}
_renderRow(rowData, sectionID, rowID, highlightRow) {
let title = rowData.get('title');
let actionUrl = rowData.get('url');
let imgUrl = SlicedImage.getSlicedUrl(rowData.get('src'),imageWidth,imageHeight,2);
return (
<TouchableOpacity style={styles.cellContainer} onPress={this._onPressItem}>
<Image style={styles.image}
source={this._getImageUrl(rowID)}
resizeMode={'cover'}/>
<Text style={styles.text}>项目</Text>
<TouchableOpacity style={styles.cellContainer}
onPress={()=>this.props.onPressVipBannerItem&&this.props.onPressVipBannerItem(actionUrl,rowID)}>
<YH_Image style={styles.image}
url={imgUrl}/>
<Text style={styles.text}>{title}</Text>
</TouchableOpacity>
);
}
render() {
let data = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
let data = this.props.data;
let title = data.get('title').get('title');
let categoryData = data.get('list');
let rowH = 40 + 2 + cellHeight * 3;
return (
<View>
<HeadTitleCell title={'热门品类'}/>
<View style={{width:width,height:rowH}}>
<HeadTitleCell title={title}/>
<View style={styles.line}/>
<ListView
contentContainerStyle={styles.listContent}
dataSource={this.dataSource.cloneWithRows(data)}
dataSource={this.dataSource.cloneWithRows(categoryData.toArray())}
renderRow={this._renderRow}
initialListSize={12}
showsHorizontalScrollIndicator={false}
... ... @@ -70,9 +68,10 @@ export default class HotCategoryIndividualization extends Component {
}
let {width, height} = Dimensions.get('window');
let cellWidth = width / 4;
let imageWidth = (width - 14 * 8) / 4;
let cellWidth = width / 4-0.5;
let imageWidth = cellWidth - 14 * 2;
let imageHeight = imageWidth * 168 / 126;
let cellHeight = imageHeight + 20;
const styles = StyleSheet.create({
line: {
... ... @@ -80,7 +79,7 @@ const styles = StyleSheet.create({
backgroundColor: '#f7f7f7'
},
listContent: {
backgroundColor: 'transparent',
backgroundColor: '#e5e5e5',
flexDirection: 'row',
flexWrap: 'wrap',
justifyContent: 'flex-start',
... ... @@ -88,22 +87,22 @@ const styles = StyleSheet.create({
},
cellContainer: {
backgroundColor: '#f5f7f6',
flexDirection: 'column',
justifyContent: 'center',
width:cellWidth,
justifyContent:'center',
alignItems:'center',
marginRight:0.5,
marginBottom:0.5
},
image: {
width: imageWidth,
height: imageHeight,
marginLeft: 14,
marginRight: 14,
},
text: {
backgroundColor: 'transparent',
backgroundColor: '#f5f7f6',
fontSize: 12,
color: '#444444',
textAlign: 'center',
marginBottom: 7,
marginLeft: 14,
marginRight: 14
width:cellWidth,
height:20
}
});
... ...
... ... @@ -122,7 +122,7 @@ const styles = StyleSheet.create({
row: {
flexDirection: 'column',
width: cellWidth,
backgroundColor: 'white',
backgroundColor: '#f0f0f0',
borderRadius: 3,
justifyContent: 'center',
marginLeft: 6,
... ...
... ... @@ -53,7 +53,6 @@ export default class Home extends Component {
this.trigggePullToRefresh = this.trigggePullToRefresh.bind(this);
this._floorCellRender = this._floorCellRender.bind(this);
this._currentChannelData = this._currentChannelData.bind(this);
this._renderSectionHeader = this._renderSectionHeader.bind(this);
this.dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
... ... @@ -155,7 +154,7 @@ export default class Home extends Component {
}
case 'app_hot_brands': {
return (
<AppHotBrands
<AppHotBrands
data={rowData.get('data')}
onPressTitleMore={this.props.onPressTitleMore}
/>
... ... @@ -314,7 +313,7 @@ export default class Home extends Component {
<SixLinesFloor
data={rowData.get('data')}
onPressImageItem={this.props.onPressImageItem}
onPressTitleMore={this.props.onPressTitleMore}
onPressTitleMore={this.props.onPressTitleMore}
/>
)
}
... ... @@ -323,7 +322,7 @@ export default class Home extends Component {
<LivePicture
data={rowData.get('data')}
onPressImageItem={this.props.onPressImageItem}
onPressTitleMore={this.props.onPressTitleMore}
onPressTitleMore={this.props.onPressTitleMore}
/>
)
}
... ... @@ -346,6 +345,7 @@ export default class Home extends Component {
case 'hot_category_individualization':{
return <HotCategoryIndividualization
data = {rowData.get('data')}
onPressVipBannerItem = {this.props.onPressVipBannerItem}
onPressTitleMore={this.props.onPressTitleMore}/>
}
case 'new_user_floor':{
... ...
... ... @@ -116,7 +116,7 @@ export default class Header extends React.Component {
let brandName = data.is_show_shop_name?data.shop_name:'';
let num = data.favoriteCount;
let numberOfFav = '粉丝:'+ num;
let numberOfFav = '粉丝: '+ num;
let backgroundImage = data.shopBanner?data.shopBanner.module_data.data[0].pic:'null';
let brandIcon = getSlicedUrl(data.shop_logo, 60, 60, 2);
let isFav = data.is_addFav;
... ...
... ... @@ -81,6 +81,7 @@ export default class RedBrandStoreFilter extends React.Component {
render() {
return (
<View style={[styles.container]}>
<View style={styles.line}/>
<ListView
contentContainerStyle={[styles.contentContainer]}
enableEmptySections={true}
... ... @@ -90,6 +91,7 @@ export default class RedBrandStoreFilter extends React.Component {
scrollEnabled={false}
scrollsToTop={false}
/>
<View style={styles.line}/>
</View>
);
}
... ... @@ -102,16 +104,12 @@ let styles = StyleSheet.create({
marginLeft: -1,
width: width + 2,
height: 44,
borderTopColor: '#e5e5e5',
borderBottomColor: '#e5e5e5',
borderWidth: 0.5,
backgroundColor:'white',
},
contentContainer: {
flexDirection: 'row',
},
rowContainer: {
marginTop: 0.5,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
... ... @@ -128,4 +126,9 @@ let styles = StyleSheet.create({
height: 15,
backgroundColor: '#e5e5e5',
},
line: {
width: width,
height: 0.5,
backgroundColor: '#e5e5e5',
},
});
... ...
... ... @@ -86,7 +86,7 @@ let styles = StyleSheet.create({
justifyContent: 'center',
height: 39,
width: width,
backgroundColor: 'white',
backgroundColor: '#e5e5e5',
},
text: {
textAlign: 'left',
... ...
... ... @@ -70,24 +70,33 @@ export default class RedPersonPicThree extends Component{
<View style={{flexDirection: 'row',width:width,height: isModuleMargin=='1'?containerHeigth4+nullHeigth:containerHeigth4,backgroundColor: 'white'}}>
<TouchableOpacity style={styles.imagetype4} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType1,linkReource1)}} >
<YH_Image url={backgroundImage1} style={styles.imagetype4}/>
{saleAble1?<View style={styles.maskContainer4}>
<Text numberOfLines={1} style={styles.titleText4}>{name1}</Text>
<Text style={styles.price4}>{price1}</Text>
</View>:null}
{linkType1=='1'?<View style={styles.maskContainer4}>
<Text style={styles.titleText4}>{name1}</Text>
<View style={styles.saleView}>
<Text style={{marginTop: 2,marginLeft: 10,fontSize: 13,backgroundColor: 'transparent',color: saleAble1?'red':'white',}}>{price1}</Text>
{saleAble1?<Text style={styles.deleteSale}>{sale1}</Text>:null}
</View>
</View>:null}
</TouchableOpacity>
<TouchableOpacity style={styles.imagetype4} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType2,linkReource2)}} >
<YH_Image url={backgroundImage2} style={styles.imagetype4}/>
{saleAble2?<View style={styles.maskContainer4}>
<Text numberOfLines={1} style={styles.titleText4}>{name2}</Text>
<Text style={styles.price4}>{price2}</Text>
</View>:null}
{linkType2=='1'?<View style={styles.maskContainer4}>
<Text style={styles.titleText4}>{name2}</Text>
<View style={styles.saleView}>
<Text style={{marginTop: 2,marginLeft: 10,fontSize: 13,backgroundColor: 'transparent',color: saleAble2?'red':'white',}}>{price2}</Text>
{saleAble2?<Text style={styles.deleteSale}>{sale2}</Text>:null}
</View>
</View>:null}
</TouchableOpacity>
<TouchableOpacity style={styles.imagetype4} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType3,linkReource3)}} >
<YH_Image url={backgroundImage3} style={styles.imagetype4}/>
{saleAble3?<View style={styles.maskContainer4}>
<Text numberOfLines={1} style={styles.titleText4}>{name3}</Text>
<Text style={styles.price4}>{price3}</Text>
</View>:null}
{linkType3=='1'?<View style={styles.maskContainer4}>
<Text style={styles.titleText4}>{name3}</Text>
<View style={styles.saleView}>
<Text style={{marginTop: 2,marginLeft: 10,fontSize: 13,backgroundColor: 'transparent',color: saleAble3?'red':'white',}}>{price3}</Text>
{saleAble3?<Text style={styles.deleteSale}>{sale3}</Text>:null}
</View>
</View>:null}
</TouchableOpacity>
</View>
)
... ... @@ -97,21 +106,24 @@ export default class RedPersonPicThree extends Component{
<View style={{flexDirection: 'row',width:width,height: isModuleMargin=='1'?containerHeigth3+nullHeigth:containerHeigth3,backgroundColor: 'white'}}>
<TouchableOpacity style={styles.imagetype3} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType1,linkReource1)}} >
<YH_Image url={backgroundImage1} style={styles.imagetype3}/>
{saleAble1?<View style={styles.maskContainer3}>
<Text style={styles.price3}>{price1}</Text>
</View>:null}
{linkType1=='1'?<View style={styles.maskContainer3}>
<Text style={{marginTop: 2,marginLeft: 10,fontSize: 13,backgroundColor: 'transparent',color: saleAble1?'red':'white',}}>{price1}</Text>
{saleAble1?<Text style={styles.deleteSale}>{sale1}</Text>:null}
</View>:null}
</TouchableOpacity>
<TouchableOpacity style={styles.imagetype3} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType2,linkReource2)}} >
<YH_Image url={backgroundImage2} style={styles.imagetype3}/>
{saleAble2?<View style={styles.maskContainer3}>
<Text style={styles.price3}>{price2}</Text>
</View>:null}
{linkType2=='1'?<View style={styles.maskContainer3}>
<Text style={{marginTop: 2,marginLeft: 10,fontSize: 13,backgroundColor: 'transparent',color: saleAble2?'red':'white',}}>{price2}</Text>
{saleAble2?<Text style={styles.deleteSale}>{sale2}</Text>:null}
</View>:null}
</TouchableOpacity>
<TouchableOpacity style={styles.imagetype3} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType3,linkReource3)}} >
<YH_Image url={backgroundImage3} style={styles.imagetype3}/>
{saleAble3?<View style={styles.maskContainer3}>
<Text style={styles.price3}>{price3}</Text>
</View>:null}
{linkType3=='1'?<View style={styles.maskContainer3}>
<Text style={{marginTop: 2,marginLeft: 10,fontSize: 13,backgroundColor: 'transparent',color: saleAble3?'red':'white',}}>{price3}</Text>
{saleAble3?<Text style={styles.deleteSale}>{sale3}</Text>:null}
</View>:null}
</TouchableOpacity>
</View>
)
... ... @@ -122,25 +134,34 @@ export default class RedPersonPicThree extends Component{
<View style={styles.subContainer}>
<TouchableOpacity style={styles.image} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType1,linkReource1)}} >
<YH_Image url={backgroundImage1} style={styles.image}/>
{saleAble1?<View style={styles.maskContainer1}>
<Text numberOfLines={2} style={styles.titleText}>{name1}</Text>
<Text style={styles.price}>{price1}</Text>
</View>:null}
{linkType1=='1'?<View style={styles.maskContainer1}>
<Text style={styles.titleText} numberOfLines={2}>{name1}</Text>
<View style={{backgroundColor: 'transparent',flexDirection: 'row'}}>
<Text style={{fontSize: 15,backgroundColor: 'transparent',color: saleAble1?'red':'white'}}>{price1}</Text>
{saleAble1?<Text style={styles.deleteSale3}>{sale1}</Text>:null}
</View>
</View>:null}
</TouchableOpacity>
<TouchableOpacity style={styles.image} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType2,linkReource2)}} >
<YH_Image url={backgroundImage2} style={styles.image}/>
{saleAble2?<View style={styles.maskContainer1}>
<Text numberOfLines={2} style={styles.titleText}>{name2}</Text>
<Text style={styles.price}>{price2}</Text>
</View>:null}
{linkType2=='1'?<View style={styles.maskContainer1}>
<Text style={styles.titleText} numberOfLines={2}>{name2}</Text>
<View style={{backgroundColor: 'transparent',flexDirection: 'row'}}>
<Text style={{fontSize: 15,backgroundColor: 'transparent',color: saleAble2?'red':'white'}}>{price2}</Text>
{saleAble2?<Text style={styles.deleteSale3}>{sale2}</Text>:null}
</View>
</View>:null}
</TouchableOpacity>
</View>
<TouchableOpacity style={styles.imageBig} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType3,linkReource3)}} >
<YH_Image url={backgroundImage3} style={styles.imageBig}/>
{saleAble3?<View style={styles.maskContainer2}>
<Text numberOfLines={2} style={styles.titleText}>{name3}</Text>
<Text style={styles.price}>{price3}</Text>
</View>:null}
{linkType3=='1'?<View style={styles.maskContainer2}>
<Text style={styles.titleText} numberOfLines={2}>{name3}</Text>
<View style={{backgroundColor: 'transparent',flexDirection: 'row'}}>
<Text style={{fontSize: 15,backgroundColor: 'transparent',color: saleAble3?'red':'white'}}>{price3}</Text>
{saleAble3?<Text style={styles.deleteSale3}>{sale3}</Text>:null}
</View>
</View>:null}
</TouchableOpacity>
</View>
)
... ... @@ -151,26 +172,35 @@ export default class RedPersonPicThree extends Component{
<TouchableOpacity onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType1,linkReource1)}} >
<View style={styles.subContainer}>
<YH_Image url={backgroundImage1} style={styles.imageBig}/>
{saleAble1?<View style={styles.maskContainer2}>
<Text numberOfLines={2} style={styles.titleText}>{name1}</Text>
<Text style={styles.price}>{price1}</Text>
</View>:null}
{linkType1=='1'?<View style={styles.maskContainer2}>
<Text style={styles.titleText} numberOfLines={2}>{name1}</Text>
<View style={{backgroundColor: 'transparent',flexDirection: 'row'}}>
<Text style={{fontSize: 15,backgroundColor: 'transparent',color: saleAble1?'red':'white'}}>{price1}</Text>
{saleAble1?<Text style={styles.deleteSale3}>{sale1}</Text>:null}
</View>
</View>:null}
</View>
</TouchableOpacity>
<View style={styles.subContainer}>
<TouchableOpacity style={styles.image} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType2,linkReource2)}} >
<YH_Image url={backgroundImage2} style={styles.image}/>
{saleAble2?<View style={styles.maskContainer1}>
<Text numberOfLines={2} style={styles.titleText}>{name2}</Text>
<Text style={styles.price}>{price2}</Text>
</View>:null}
{linkType2=='1'?<View style={styles.maskContainer1}>
<Text style={styles.titleText} numberOfLines={2}>{name2}</Text>
<View style={{backgroundColor: 'transparent',flexDirection: 'row'}}>
<Text style={{fontSize: 15,backgroundColor: 'transparent',color: saleAble2?'red':'white'}}>{price2}</Text>
{saleAble2?<Text style={styles.deleteSale3}>{sale2}</Text>:null}
</View>
</View>:null}
</TouchableOpacity>
<TouchableOpacity style={styles.image} onPress={() => {this.props.onPressProduct && this.props.onPressProduct(linkType3,linkReource3)}} >
<YH_Image url={backgroundImage3} style={styles.image}/>
{saleAble3?<View style={styles.maskContainer1}>
<Text numberOfLines={2} style={styles.titleText}>{name3}</Text>
<Text style={styles.price}>{price3}</Text>
</View>:null}
{linkType3=='1'?<View style={styles.maskContainer1}>
<Text style={styles.titleText} numberOfLines={2}>{name3}</Text>
<View style={{backgroundColor: 'transparent',flexDirection: 'row'}}>
<Text style={{fontSize: 15,backgroundColor: 'transparent',color: saleAble3?'red':'white'}}>{price3}</Text>
{saleAble3?<Text style={styles.deleteSale3}>{sale3}</Text>:null}
</View>
</View>:null}
</TouchableOpacity>
</View>
</View>
... ... @@ -202,6 +232,7 @@ let styles = StyleSheet.create({
top: containerHeigth/2-maskHeight,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-around',
},
maskContainer2: {
position: 'absolute',
... ... @@ -211,6 +242,7 @@ let styles = StyleSheet.create({
top: containerHeigth-maskHeight,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-around',
},
maskContainer3:{
position: 'absolute',
... ... @@ -220,6 +252,7 @@ let styles = StyleSheet.create({
top: containerHeigth3-24,
flexDirection: 'row',
alignItems: 'center',
flexDirection: 'row',
},
maskContainer4: {
position: 'absolute',
... ... @@ -245,11 +278,11 @@ let styles = StyleSheet.create({
height: containerHeigth,
},
titleText: {
marginLeft: 10,
color:'white',
width : 80,
fontSize: 12,
textAlign :'left',
backgroundColor: 'transparent',
},
price: {
color:'white',
... ... @@ -283,4 +316,25 @@ let styles = StyleSheet.create({
textAlign :'left',
marginTop: 2,
},
deleteSale: {
marginLeft: 2,
marginTop: 4,
fontSize: 11,
backgroundColor: 'transparent',
color: 'white',
textDecorationLine: 'line-through',
},
deleteSale3: {
marginLeft: 2,
marginTop: 4,
fontSize: 11,
backgroundColor: 'transparent',
color: 'white',
textDecorationLine: 'line-through',
},
saleView:{
flexDirection: 'row',
},
});
... ...
... ... @@ -968,7 +968,7 @@ export function getFavoriteCount() {
return new RedBrandService(app.singleApiHost).getFavoriteCount(favIds)
.then(json => {
if (json) {
let count = json[0].count;
let count = json[0].approximateCount;
dispatch(getFavoriteCountSuccess(count));
}
})
... ...
... ... @@ -157,7 +157,7 @@ export default function redBrandReducer(state=initialState, action) {
case ADD_FAVORITE_SUCCESS: {
if (action.payload) {
return state.setIn(['shopIntro', 'is_addFav'], true)
.setIn(['shopIntro', 'favoriteCount'],parseInt(state.shopIntro.favoriteCount) +1);
// .setIn(['shopIntro', 'favoriteCount'],parseInt(state.shopIntro.favoriteCount) +1);
}else {
return state.setIn(['shopIntro', 'is_addFav'], true);
}
... ... @@ -170,7 +170,7 @@ export default function redBrandReducer(state=initialState, action) {
}
case CANCEL_FAVORITE_SUCCESS: {
return state.setIn(['shopIntro', 'is_addFav'], action.payload)
.setIn(['shopIntro', 'favoriteCount'],(parseInt(state.shopIntro.favoriteCount) -1)>0?(parseInt(state.shopIntro.favoriteCount) -1):0);
// .setIn(['shopIntro', 'favoriteCount'],(parseInt(state.shopIntro.favoriteCount) -1)>0?(parseInt(state.shopIntro.favoriteCount) -1):0);
}
case GET_FAVORITE_COUNT_SUCCESS: {
return state.setIn(['shopIntro', 'favoriteCount'], action.payload);
... ...