Authored by 张文文

内容消息空页面

@@ -10,7 +10,6 @@ import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator'; @@ -10,7 +10,6 @@ import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
10 10
11 import ContentMessageTabView from "./ContentMessageTabView"; 11 import ContentMessageTabView from "./ContentMessageTabView";
12 import ContentMessageCell from "./ContentMessageCell"; 12 import ContentMessageCell from "./ContentMessageCell";
13 -import ContentEmptyView from './ContentEmptyView'  
14 import Prompt from '../../../common/components/Prompt'; 13 import Prompt from '../../../common/components/Prompt';
15 14
16 export default class ContentMessageView extends Component { 15 export default class ContentMessageView extends Component {
@@ -39,7 +38,7 @@ export default class ContentMessageView extends Component { @@ -39,7 +38,7 @@ export default class ContentMessageView extends Component {
39 38
40 _renderHeader() { 39 _renderHeader() {
41 let showStatus = this.props.contentTipFlag==='0' ? true : false; 40 let showStatus = this.props.contentTipFlag==='0' ? true : false;
42 - let tabStatus = this.props.tabButtons.length===0 ? false : true; 41 + let tabStatus = this.props.commentList.length===0 ? false : true;
43 42
44 function onNotifyPress() { 43 function onNotifyPress() {
45 NativeModules.YH_CommonHelper.jumpToUpdateNotificationStatus(); 44 NativeModules.YH_CommonHelper.jumpToUpdateNotificationStatus();
@@ -74,25 +73,28 @@ export default class ContentMessageView extends Component { @@ -74,25 +73,28 @@ export default class ContentMessageView extends Component {
74 ) 73 )
75 } 74 }
76 75
77 - _renderFooter(){ 76 + _renderFooter() {
  77 + let emptyViewShow = this.props.commentList.length===0 ? true : false;
78 return ( 78 return (
79 - <View style={[{height: 50}, {backgroundColor: 'white'}, {justifyContent:'center'}]}> 79 + <View>
  80 +
  81 + { emptyViewShow && this.props.isFetching === false ?
  82 + <View style={styles.emptyView}>
  83 + <Image
  84 + style={styles.iconStyle}
  85 + source={require('../../images/message_empty_ic.png')}
  86 + />
  87 + <Text style={styles.textStyle}>暂无更新的消息</Text>
  88 + </View>
  89 + :
  90 + <View style={[{height: 50}, {backgroundColor: 'white'}, {justifyContent:'center'}]}/> }
  91 +
80 </View> 92 </View>
81 ) 93 )
82 } 94 }
83 95
84 render() { 96 render() {
85 - let {commentList, isPullToRefresh, shouldShowEmpty, tipMessage} = this.props;  
86 -  
87 - if (shouldShowEmpty) {  
88 - return (  
89 - <View style={styles.container}>  
90 - <ContentEmptyView  
91 - listId={4}  
92 - />  
93 - </View>  
94 - );  
95 - } 97 + let {commentList, isPullToRefresh, tipMessage} = this.props;
96 98
97 return ( 99 return (
98 <View style={styles.container}> 100 <View style={styles.container}>
@@ -165,6 +167,7 @@ export default class ContentMessageView extends Component { @@ -165,6 +167,7 @@ export default class ContentMessageView extends Component {
165 167
166 let {width} = Dimensions.get('window'); 168 let {width} = Dimensions.get('window');
167 const ROW_COLUMN = 3 169 const ROW_COLUMN = 3
  170 +let scale = (width/375.0);
168 171
169 let styles = StyleSheet.create({ 172 let styles = StyleSheet.create({
170 container: { 173 container: {
@@ -244,4 +247,23 @@ let styles = StyleSheet.create({ @@ -244,4 +247,23 @@ let styles = StyleSheet.create({
244 height: 10 247 height: 10
245 }, 248 },
246 249
  250 + emptyView: {
  251 + flex: 1,
  252 + flexDirection: 'column',
  253 + justifyContent: 'center',
  254 + alignItems: 'center',
  255 + },
  256 + iconStyle: {
  257 + marginTop: Math.ceil(82*scale),
  258 + width: Math.ceil(96*scale),
  259 + height: Math.ceil(70*scale),
  260 + backgroundColor: 'transparent',
  261 + },
  262 + textStyle: {
  263 + marginTop: Math.ceil(28*scale),
  264 + color: '#444444',
  265 + backgroundColor: 'transparent',
  266 + fontSize: 15,
  267 + },
  268 +
247 }) 269 })
@@ -24,7 +24,7 @@ function mapStateToProps(state) { @@ -24,7 +24,7 @@ function mapStateToProps(state) {
24 tabButtons: state.content.contentType.get('list').toJS(), 24 tabButtons: state.content.contentType.get('list').toJS(),
25 commentList: state.content.commentList.get('list').toJS(), 25 commentList: state.content.commentList.get('list').toJS(),
26 isPullToRefresh: state.content.commentList.get('isPullToRefresh'), 26 isPullToRefresh: state.content.commentList.get('isPullToRefresh'),
27 - shouldShowEmpty: state.content.commentList.get('shouldShowEmpty'), 27 + isFetching: state.content.commentList.get('isFetching'),
28 contentTipFlag: state.content.contentTipFlag, 28 contentTipFlag: state.content.contentTipFlag,
29 tipMessage: state.content.tipMessage, 29 tipMessage: state.content.tipMessage,
30 communityHost: state.app.communityHost, 30 communityHost: state.app.communityHost,
@@ -172,7 +172,7 @@ class ContentMessageContainer extends Component { @@ -172,7 +172,7 @@ class ContentMessageContainer extends Component {
172 tabButtons, 172 tabButtons,
173 commentList, 173 commentList,
174 isPullToRefresh, 174 isPullToRefresh,
175 - shouldShowEmpty 175 + isFetching
176 } = this.props 176 } = this.props
177 177
178 return ( 178 return (
@@ -185,8 +185,8 @@ class ContentMessageContainer extends Component { @@ -185,8 +185,8 @@ class ContentMessageContainer extends Component {
185 tabButtons={tabButtons} 185 tabButtons={tabButtons}
186 commentList={commentList} 186 commentList={commentList}
187 isPullToRefresh={isPullToRefresh} 187 isPullToRefresh={isPullToRefresh}
  188 + isFetching={isFetching}
188 tipMessage={tipMessage} 189 tipMessage={tipMessage}
189 - shouldShowEmpty={shouldShowEmpty}  
190 onRefresh={this._onRefresh} 190 onRefresh={this._onRefresh}
191 onEndReached={this._onEndReached} 191 onEndReached={this._onEndReached}
192 onHiddenTipMessage={this._onHiddenTipMessage} 192 onHiddenTipMessage={this._onHiddenTipMessage}