Authored by 孙凯

add 资源 review by zhanglixia

... ... @@ -47,9 +47,9 @@ export default class Detail extends Component {
renderHeader() {
let {resource} = this.props;
let {author} = resource;
let {author,article} = resource;
return(
<Header resource={author}/>
<Header resource={{author,article}} />
);
}
... ...
... ... @@ -79,6 +79,7 @@ export default class GoodsCell extends React.Component {
dataSource={this.dataSource.cloneWithRows(list.toArray())}
renderHeader={this.renderHeader}
enableEmptySections={true}
renderRow={this.renderRow}
scrollEnabled={false}
scrollsToTop={false}
/>
... ...
... ... @@ -31,24 +31,40 @@ export default class Header extends React.Component {
render() {
let {resource} = this.props;
let data = resource.get('data');
if (!data) {
let {author,article} = resource;
let author_data = author.get('data');
let article_data = article.get('data');
if (!author_data || !article_data) {
return null;
}
let author_desc = data.get('author_desc');
let avatar = data.get('avatar');
let name = data.get('name');
let url = data.get('url');
let author_desc = author_data.get('author_desc');
let author_avatar = author_data.get('avatar');
let author_name = author_data.get('name');
let author_url = author_data.get('url');
let article_title = article_data.get('article_title');
let pageViews = article_data.get('pageViews');
let publishTime = article_data.get('publishTime');
return(
<View style={styles.header}>
<View style={styles.contentContainer}>
<Image source={{uri: avatar}} style={styles.thumb}></Image>
<Text style={styles.name}>{name}</Text>
<View style={styles.contentContainer}>
<View style={styles.header}>
<Image source={{uri: author_avatar}} style={styles.thumb}></Image>
<Text style={styles.name}>{author_name}</Text>
<Text style={styles.desc}>{author_desc}</Text>
</View>
<View style={{width: width,height: 0.5,backgroundColor: '#e5e5e5',}}/>
<Text style={styles.article_title}>{article_title}</Text>
<View style={styles.time}>
<Image source={require('../../image/time_icon.png')} style={styles.timeThumb}></Image>
<Text style={styles.text}>{publishTime}</Text>
<Image source={require('../../image/time_icon.png')} style={styles.timeThumb}></Image>
<Text style={styles.text}>{pageViews}</Text>
</View>
</View>
);
}
... ... @@ -59,15 +75,14 @@ let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
contentContainer: {
width:width,
backgroundColor: 'white',
},
header: {
flexDirection: 'row',
height: 47.5,
width:width,
alignItems: 'center',
},
header: {
height: 48,
width:width,
backgroundColor: 'white',
},
thumb: {
width: 25,
... ... @@ -82,4 +97,28 @@ let styles = StyleSheet.create({
marginLeft: 20,
color: '#e5e5e5',
},
article_title: {
marginLeft: 20,
marginRight: 10,
fontSize: 23,
fontWeight: 'bold',
lineHeight: 35,
},
time: {
flexDirection: 'row',
height: 20,
width:width,
alignItems: 'center',
marginTop: 5,
},
timeThumb: {
marginLeft: 20,
height: 12,
width:12,
},
text: {
marginLeft: 5,
fontSize: 12,
color: 'gray'
},
});
... ...