|
@@ -48,19 +48,20 @@ export default class Header extends React.Component { |
|
@@ -48,19 +48,20 @@ export default class Header extends React.Component { |
48
|
|
48
|
|
49
|
let author_data = author.get('data');
|
49
|
let author_data = author.get('data');
|
50
|
let article_data = article.get('data');
|
50
|
let article_data = article.get('data');
|
|
|
51
|
+ let hasData = true;
|
51
|
if (!author_data || !article_data) {
|
52
|
if (!author_data || !article_data) {
|
52
|
- return null;
|
53
|
+ hasData = false;
|
53
|
}
|
54
|
}
|
54
|
|
55
|
|
55
|
- let author_desc = author_data.get('author_desc');
|
|
|
56
|
- let author_avatar = author_data.get('avatar');
|
|
|
57
|
- let author_name = author_data.get('name');
|
|
|
58
|
- let author_url = author_data.get('url');
|
56
|
+ let author_desc = hasData?author_data.get('author_desc'):'';
|
|
|
57
|
+ let author_avatar = hasData?author_data.get('avatar'):'';
|
|
|
58
|
+ let author_name = hasData?author_data.get('name'):'';
|
|
|
59
|
+ let author_url = hasData?author_data.get('url'):'';
|
59
|
let num = this.getStrSize(author_desc);
|
60
|
let num = this.getStrSize(author_desc);
|
60
|
|
61
|
|
61
|
- let article_title = article_data.get('article_title');
|
|
|
62
|
- let pageViews = article_data.get('pageViews');
|
|
|
63
|
- let publishTime = article_data.get('publishTime');
|
62
|
+ let article_title = hasData?article_data.get('article_title'):'';
|
|
|
63
|
+ let pageViews = hasData?article_data.get('pageViews'):'99999';
|
|
|
64
|
+ let publishTime = hasData?article_data.get('publishTime'):'12月12日 12:00';
|
64
|
return(
|
65
|
return(
|
65
|
<View style={styles.contentContainer}>
|
66
|
<View style={styles.contentContainer}>
|
66
|
<TouchableOpacity activeOpacity={0.5} onPress={() => {
|
67
|
<TouchableOpacity activeOpacity={0.5} onPress={() => {
|