Authored by 孙凯

add 资源 review by zhanglixia

@@ -47,9 +47,9 @@ export default class Detail extends Component { @@ -47,9 +47,9 @@ export default class Detail extends Component {
47 47
48 renderHeader() { 48 renderHeader() {
49 let {resource} = this.props; 49 let {resource} = this.props;
50 - let {author} = resource; 50 + let {author,article} = resource;
51 return( 51 return(
52 - <Header resource={author}/> 52 + <Header resource={{author,article}} />
53 ); 53 );
54 } 54 }
55 55
@@ -79,6 +79,7 @@ export default class GoodsCell extends React.Component { @@ -79,6 +79,7 @@ export default class GoodsCell extends React.Component {
79 dataSource={this.dataSource.cloneWithRows(list.toArray())} 79 dataSource={this.dataSource.cloneWithRows(list.toArray())}
80 renderHeader={this.renderHeader} 80 renderHeader={this.renderHeader}
81 enableEmptySections={true} 81 enableEmptySections={true}
  82 + renderRow={this.renderRow}
82 scrollEnabled={false} 83 scrollEnabled={false}
83 scrollsToTop={false} 84 scrollsToTop={false}
84 /> 85 />
@@ -31,24 +31,40 @@ export default class Header extends React.Component { @@ -31,24 +31,40 @@ export default class Header extends React.Component {
31 31
32 32
33 render() { 33 render() {
  34 +
34 let {resource} = this.props; 35 let {resource} = this.props;
35 - let data = resource.get('data');  
36 - if (!data) { 36 + let {author,article} = resource;
  37 +
  38 + let author_data = author.get('data');
  39 + let article_data = article.get('data');
  40 + if (!author_data || !article_data) {
37 return null; 41 return null;
38 } 42 }
39 - let author_desc = data.get('author_desc');  
40 - let avatar = data.get('avatar');  
41 - let name = data.get('name');  
42 - let url = data.get('url'); 43 +
  44 + let author_desc = author_data.get('author_desc');
  45 + let author_avatar = author_data.get('avatar');
  46 + let author_name = author_data.get('name');
  47 + let author_url = author_data.get('url');
  48 +
  49 + let article_title = article_data.get('article_title');
  50 + let pageViews = article_data.get('pageViews');
  51 + let publishTime = article_data.get('publishTime');
43 52
44 return( 53 return(
45 - <View style={styles.header}>  
46 - <View style={styles.contentContainer}>  
47 - <Image source={{uri: avatar}} style={styles.thumb}></Image>  
48 - <Text style={styles.name}>{name}</Text> 54 + <View style={styles.contentContainer}>
  55 + <View style={styles.header}>
  56 + <Image source={{uri: author_avatar}} style={styles.thumb}></Image>
  57 + <Text style={styles.name}>{author_name}</Text>
49 <Text style={styles.desc}>{author_desc}</Text> 58 <Text style={styles.desc}>{author_desc}</Text>
50 </View> 59 </View>
51 <View style={{width: width,height: 0.5,backgroundColor: '#e5e5e5',}}/> 60 <View style={{width: width,height: 0.5,backgroundColor: '#e5e5e5',}}/>
  61 + <Text style={styles.article_title}>{article_title}</Text>
  62 + <View style={styles.time}>
  63 + <Image source={require('../../image/time_icon.png')} style={styles.timeThumb}></Image>
  64 + <Text style={styles.text}>{publishTime}</Text>
  65 + <Image source={require('../../image/time_icon.png')} style={styles.timeThumb}></Image>
  66 + <Text style={styles.text}>{pageViews}</Text>
  67 + </View>
52 </View> 68 </View>
53 ); 69 );
54 } 70 }
@@ -59,15 +75,14 @@ let {width, height} = Dimensions.get('window'); @@ -59,15 +75,14 @@ let {width, height} = Dimensions.get('window');
59 75
60 let styles = StyleSheet.create({ 76 let styles = StyleSheet.create({
61 contentContainer: { 77 contentContainer: {
  78 + width:width,
  79 + backgroundColor: 'white',
  80 + },
  81 + header: {
62 flexDirection: 'row', 82 flexDirection: 'row',
63 height: 47.5, 83 height: 47.5,
64 width:width, 84 width:width,
65 alignItems: 'center', 85 alignItems: 'center',
66 - },  
67 - header: {  
68 - height: 48,  
69 - width:width,  
70 - backgroundColor: 'white',  
71 }, 86 },
72 thumb: { 87 thumb: {
73 width: 25, 88 width: 25,
@@ -82,4 +97,28 @@ let styles = StyleSheet.create({ @@ -82,4 +97,28 @@ let styles = StyleSheet.create({
82 marginLeft: 20, 97 marginLeft: 20,
83 color: '#e5e5e5', 98 color: '#e5e5e5',
84 }, 99 },
  100 + article_title: {
  101 + marginLeft: 20,
  102 + marginRight: 10,
  103 + fontSize: 23,
  104 + fontWeight: 'bold',
  105 + lineHeight: 35,
  106 + },
  107 + time: {
  108 + flexDirection: 'row',
  109 + height: 20,
  110 + width:width,
  111 + alignItems: 'center',
  112 + marginTop: 5,
  113 + },
  114 + timeThumb: {
  115 + marginLeft: 20,
  116 + height: 12,
  117 + width:12,
  118 + },
  119 + text: {
  120 + marginLeft: 5,
  121 + fontSize: 12,
  122 + color: 'gray'
  123 + },
85 }); 124 });