...
|
...
|
@@ -32,8 +32,10 @@ export default class BrandArticleCell extends Component { |
|
|
}
|
|
|
|
|
|
|
|
|
//内容
|
|
|
_renderTimeAndVisit(time, visit, likeNum, isliked){
|
|
|
//时间和访问次数以及是否喜欢
|
|
|
_renderTimeAndVisit(time, visit, likeNum, id, isliked){
|
|
|
|
|
|
let likeicon = isliked ? require("../../images/like_on.png") : require("../../images/like_off.png");
|
|
|
|
|
|
return (
|
|
|
<View style={styles.timebar}>
|
...
|
...
|
@@ -41,7 +43,15 @@ export default class BrandArticleCell extends Component { |
|
|
|
|
|
<Text style={styles.time} numberOfLines={1}>{visit} </Text>
|
|
|
|
|
|
<Text style={styles.time} numberOfLines={1}>{likeNum}</Text>
|
|
|
<TouchableOpacity
|
|
|
activeOpacity={1}
|
|
|
onPress={()=>{
|
|
|
this.props.onPressArticleLike && this.props.onPressArticleLike(id, !isliked)
|
|
|
}}>
|
|
|
<Image style={styles.likeicon} source={likeicon} />
|
|
|
|
|
|
<Text style={styles.time} numberOfLines={1}>{likeNum}</Text>
|
|
|
</TouchableOpacity>
|
|
|
|
|
|
|
|
|
</View>
|
...
|
...
|
@@ -52,11 +62,16 @@ export default class BrandArticleCell extends Component { |
|
|
|
|
|
render() {
|
|
|
let {rowData} = this.props;
|
|
|
//url跳转地址
|
|
|
let url = rowData.get('url');
|
|
|
//id
|
|
|
let id = rowData.get('id');
|
|
|
//标题
|
|
|
let title = rowData.get('title');
|
|
|
//图片
|
|
|
let imgUrl = rowData.get('src').replace('{mode}', 2).replace('{width}', 290).replace('{height}', 386);
|
|
|
//imgUrl = SlicedImage.getSlicedUrl(rowData.get('src'), 290, 386, 2);
|
|
|
//let brandIconUrl = SlicedImage.getSlicedUrl(data.get('brand_img', ''), 150, 80, 2);
|
|
|
//介绍
|
|
|
let intro = rowData.get('intro');
|
|
|
//发布时间
|
...
|
...
|
@@ -70,10 +85,6 @@ export default class BrandArticleCell extends Component { |
|
|
//喜欢人数
|
|
|
let likeCount = like.get("count");
|
|
|
|
|
|
//console.log("chenlin444", JSON.stringify(rowData));
|
|
|
//console.log("chenlin444", "isLiked" + isLiked + "----likeCount" + likeCount);
|
|
|
|
|
|
|
|
|
return (
|
|
|
<View style={styles.cellContainer}>
|
|
|
|
...
|
...
|
@@ -81,7 +92,7 @@ export default class BrandArticleCell extends Component { |
|
|
style={[styles.touchableContainer]}
|
|
|
activeOpacity={1}
|
|
|
onPress={()=>{
|
|
|
this.props.onPressTopic && this.props.onPressTopic()
|
|
|
this.props.onPressArticle && this.props.onPressArticle(url)
|
|
|
}}>
|
|
|
|
|
|
<Image style={styles.image} source={{uri:imgUrl}} />
|
...
|
...
|
@@ -92,7 +103,7 @@ export default class BrandArticleCell extends Component { |
|
|
|
|
|
<Text style={styles.content} numberOfLines={4}>{intro}</Text>
|
|
|
|
|
|
{this._renderTimeAndVisit(publishTime, viewsNum, likeCount, isLiked)}
|
|
|
{this._renderTimeAndVisit(publishTime, viewsNum, likeCount, id, isLiked)}
|
|
|
|
|
|
|
|
|
</View>
|
...
|
...
|
@@ -141,7 +152,11 @@ let styles = StyleSheet.create({ |
|
|
paddingBottom:5,
|
|
|
},
|
|
|
time:{
|
|
|
fontSize: 9,
|
|
|
fontSize: 15,
|
|
|
color: '#b0b0b0',
|
|
|
},
|
|
|
likeicon:{
|
|
|
width: 20,
|
|
|
height:20,
|
|
|
},
|
|
|
}); |
...
|
...
|
|