Authored by 盖剑秋

继续优化代码. reviewed by redding.

@@ -44,7 +44,8 @@ export default class MsgCenterNormalCell extends React.Component { @@ -44,7 +44,8 @@ export default class MsgCenterNormalCell extends React.Component {
44 44
45 render() { 45 render() {
46 let data = this.props.data.toJS(); 46 let data = this.props.data.toJS();
47 - let {user, title, timeago, post, subTitle} = data; 47 + console.log(data);
  48 + let {user, title, timeago, post, subTitle, isRead} = data;
48 let postId = post.id; 49 let postId = post.id;
49 return ( 50 return (
50 51
@@ -60,7 +61,7 @@ export default class MsgCenterNormalCell extends React.Component { @@ -60,7 +61,7 @@ export default class MsgCenterNormalCell extends React.Component {
60 <LittleRedDotImage 61 <LittleRedDotImage
61 extra = {user.id} 62 extra = {user.id}
62 iconTap={this.props.onPressAvatar} 63 iconTap={this.props.onPressAvatar}
63 - isRedDot={true} 64 + isRedDot={isRead === 'N'}
64 image={user.avatar} 65 image={user.avatar}
65 /> 66 />
66 <View style={styles.topRight}> 67 <View style={styles.topRight}>
@@ -18,6 +18,48 @@ import SlicedImage from '../../../common/components/SlicedImage'; @@ -18,6 +18,48 @@ import SlicedImage from '../../../common/components/SlicedImage';
18 export default class SubjectPost extends Component { 18 export default class SubjectPost extends Component {
19 constructor(props) { 19 constructor(props) {
20 super(props); 20 super(props);
  21 + this.renderReplyContentWithPlaceholder = this.renderReplyContentWithPlaceholder.bind(this);
  22 + }
  23 +
  24 + renderReplyContentWithPlaceholder(placeholder) {
  25 + return(
  26 + <View style={styles.toolContainer}>
  27 + <SlicedImage style={styles.imgIcon} source={this.props.iconSouce}/>
  28 + <TouchableOpacity style={styles.imgButton} onPress={this.props.showImagePannel}>
  29 + </TouchableOpacity>
  30 +
  31 + <TouchableOpacity style={styles.keyboardIcon} onPress={this.props.blurAll}>
  32 + <SlicedImage source={require('../../images/posting/jianpan1.png')} />
  33 + </TouchableOpacity>
  34 + <View style={[styles.rightContainer]}>
  35 + <TextInput
  36 + ref='textInput'
  37 + style={styles.replyTextInput}
  38 + placeholderTextColor='#b0b0b0'
  39 + placeholder={placeholder}
  40 + multiline={true}
  41 + autoCapitalize={'none'}
  42 + autoCorrect={false}
  43 + selectionColor={'black'}
  44 + autoFocus={true}
  45 + maxLength={1000}
  46 + onChangeText={
  47 + (text)=>{
  48 + this.props.onReplyTextChange&&this.props.onReplyTextChange(text);
  49 + }
  50 + }
  51 + onKeyPress={(event)=>{
  52 + if (this.props.replyContent >= 1000) {
  53 + NativeModules.YH_CommunityHelper.showText('超出1000字符最长限制');
  54 + }
  55 + }}
  56 + />
  57 + <Text style={[styles.submitText, {color:this.props.replyTextColor}]} onPress={this.props.commitComment}>发送</Text>
  58 + </View>
  59 + <View style={styles.toolTopLine}/>
  60 + <View style={styles.toolBottomLine}/>
  61 + </View>
  62 + );
21 } 63 }
22 64
23 render() { 65 render() {
@@ -55,84 +97,19 @@ export default class SubjectPost extends Component { @@ -55,84 +97,19 @@ export default class SubjectPost extends Component {
55 break; 97 break;
56 case 1: {// 楼主 98 case 1: {// 楼主
57 return ( 99 return (
58 - <View style={styles.toolContainer}>  
59 - <SlicedImage style={styles.imgIcon} source={this.props.iconSouce}/>  
60 - <TouchableOpacity style={styles.imgButton} onPress={this.props.showImagePannel}>  
61 - </TouchableOpacity>  
62 -  
63 - <TouchableOpacity style={styles.keyboardIcon} onPress={this.props.blurAll}>  
64 - <SlicedImage source={require('../../images/posting/jianpan1.png')} />  
65 - </TouchableOpacity>  
66 - <View style={[styles.rightContainer]}>  
67 - <TextInput  
68 - ref='textInput'  
69 - style={styles.replyTextInput}  
70 - placeholderTextColor='#b0b0b0'  
71 - placeholder='回复楼主'  
72 - multiline={true}  
73 - autoCapitalize={'none'}  
74 - autoCorrect={false}  
75 - selectionColor={'black'}  
76 - autoFocus={true}  
77 - maxLength={1000}  
78 - onChangeText={  
79 - (text)=>{  
80 - this.props.onReplyTextChange&&this.props.onReplyTextChange(text);  
81 - }  
82 - }  
83 - onKeyPress={(event)=>{  
84 - if (this.props.replyContent >= 1000) {  
85 - NativeModules.YH_CommunityHelper.showText('超出1000字符最长限制');  
86 - }  
87 - }}  
88 - />  
89 - <Text style={[styles.submitText, {color:this.props.replyTextColor}]} onPress={this.props.commitComment}>发送</Text>  
90 - </View>  
91 - <View style={styles.toolTopLine}/>  
92 - <View style={styles.toolBottomLine}/> 100 + <View >
  101 + {this.renderReplyContentWithPlaceholder('回复楼主:')}
93 </View> 102 </View>
94 - ); 103 + )
95 } 104 }
96 break; 105 break;
97 case 2: {// others... 106 case 2: {// others...
98 return ( 107 return (
99 - <View style={styles.toolContainer}>  
100 - <SlicedImage style={styles.imgIcon} source={this.props.iconSouce}/>  
101 - <TouchableOpacity style={styles.imgButton} onPress={this.props.showImagePannel}>  
102 - </TouchableOpacity>  
103 -  
104 - <TouchableOpacity style={styles.keyboardIcon} onPress={this.props.blurAll}>  
105 - <SlicedImage source={require('../../images/posting/jianpan1.png')} />  
106 - </TouchableOpacity>  
107 - <View style={[styles.rightContainer]}>  
108 - <TextInput  
109 - ref='textInput'  
110 - style={styles.replyTextInput}  
111 - placeholderTextColor='#b0b0b0'  
112 - placeholder={'回复'+this.someOneToReply+':'}  
113 - multiline={true}  
114 - autoCapitalize={'none'}  
115 - selectionColor={'black'}  
116 - autoCorrect={false}  
117 - autoFocus={true}  
118 - maxLength={1000}  
119 - onChangeText={  
120 - (text)=>{  
121 - this.props.onReplyTextChange&&this.props.onReplyTextChange(text);  
122 - }  
123 - }  
124 - onKeyPress={(event)=>{  
125 - if (this.replyContent >= 1000) {  
126 - NativeModules.YH_CommunityHelper.showText('超出1000字符最长限制');  
127 - }  
128 - }}  
129 - />  
130 - <Text style={[styles.submitText, {color:this.props.replyTextColor}]} onPress={this.props.commitComment}>发送</Text>  
131 - </View>  
132 - <View style={styles.toolTopLine}/>  
133 - <View style={styles.toolBottomLine}/> 108 + <View>
  109 + {this.renderReplyContentWithPlaceholder('回复'+this.someOneToReply+':')}
134 </View> 110 </View>
135 - ); 111 + )
  112 +
136 } 113 }
137 break; 114 break;
138 default: 115 default:
@@ -107,7 +107,6 @@ export default class SubjectPost extends Component { @@ -107,7 +107,6 @@ export default class SubjectPost extends Component {
107 } 107 }
108 108
109 blurAll() { 109 blurAll() {
110 - console.log('bbbbbbbbbbbbb');  
111 this.setState({imageState:0, replyState:ReplyState.replyNone}); 110 this.setState({imageState:0, replyState:ReplyState.replyNone});
112 this.currentReplyState = ReplyState.replyLZ; 111 this.currentReplyState = ReplyState.replyLZ;
113 if (this.boardInView) { 112 if (this.boardInView) {
@@ -184,7 +183,6 @@ export default class SubjectPost extends Component { @@ -184,7 +183,6 @@ export default class SubjectPost extends Component {
184 } 183 }
185 184
186 onPressLZContainer() { 185 onPressLZContainer() {
187 - console.log('ccccccccccccccc');  
188 this.cidTo = this.props.authorUid; 186 this.cidTo = this.props.authorUid;
189 this.cnameTo = ''; 187 this.cnameTo = '';
190 this.commentId = ''; 188 this.commentId = '';
@@ -226,8 +224,6 @@ export default class SubjectPost extends Component { @@ -226,8 +224,6 @@ export default class SubjectPost extends Component {
226 } 224 }
227 225
228 renderToolContainer() { 226 renderToolContainer() {
229 - console.log('aaaaaaaaaaaaaaaaaaaaaaaa');  
230 - console.log('....................... '+this.state.replyState);  
231 let picSource = (this.state.imageState>0?require('../../images/posting/pic1.png') : require('../../images/posting/pic_normal.png')); 227 let picSource = (this.state.imageState>0?require('../../images/posting/pic1.png') : require('../../images/posting/pic_normal.png'));
232 let iconSouce = (this.state.replyState === ReplyState.replyNone)?require('../../images/home/like.png'):picSource; 228 let iconSouce = (this.state.replyState === ReplyState.replyNone)?require('../../images/home/like.png'):picSource;
233 return( 229 return(
@@ -411,18 +407,6 @@ const styles = StyleSheet.create({ @@ -411,18 +407,6 @@ const styles = StyleSheet.create({
411 flex: 1, 407 flex: 1,
412 backgroundColor: 'white', 408 backgroundColor: 'white',
413 }, 409 },
414 - header: {  
415 - flexDirection: 'row',  
416 - paddingTop: 10,  
417 - paddingBottom: 10,  
418 - backgroundColor: 'white',  
419 - paddingLeft: 15,  
420 - },  
421 - headerRight: {  
422 - flex: 1,  
423 - flexDirection: 'row',  
424 - justifyContent: 'flex-end',  
425 - },  
426 title: { 410 title: {
427 backgroundColor: 'white', 411 backgroundColor: 'white',
428 fontSize: 17, 412 fontSize: 17,
@@ -430,42 +414,6 @@ const styles = StyleSheet.create({ @@ -430,42 +414,6 @@ const styles = StyleSheet.create({
430 paddingLeft: 15, 414 paddingLeft: 15,
431 paddingRight: 15, 415 paddingRight: 15,
432 }, 416 },
433 - boardText: {  
434 - backgroundColor: '#e0e0e0',  
435 - height: 21,  
436 - fontSize:14,  
437 - textAlign: 'center',  
438 - paddingLeft: 10,  
439 - paddingRight:10,  
440 - paddingTop: 3,  
441 - marginRight:15,  
442 - fontWeight:'100',  
443 - },  
444 - shareGoodsContainer: {  
445 - flexDirection: 'row',  
446 - paddingLeft: 15,  
447 - paddingBottom: 10,  
448 - backgroundColor: 'white',  
449 - },  
450 - shareGoodsImage: {  
451 - width: 52,  
452 - height: 70,  
453 - backgroundColor:'gray',  
454 - },  
455 - shareGoodsRightPannel: {  
456 - flexDirection: 'column',  
457 - paddingLeft: 10,  
458 - paddingTop: 5,  
459 - },  
460 - productNameText: {  
461 - fontSize: 15,  
462 - width: width - 52 - 30,  
463 - },  
464 - productPriceText: {  
465 - top: 10,  
466 - fontSize: 12,  
467 - color: '#d0021b',  
468 - },  
469 sofaContainer: { 417 sofaContainer: {
470 flexDirection: 'column', 418 flexDirection: 'column',
471 height: 190, 419 height: 190,