Authored by 盖剑秋

继续优化代码. reviewed by redding.

... ... @@ -44,7 +44,8 @@ export default class MsgCenterNormalCell extends React.Component {
render() {
let data = this.props.data.toJS();
let {user, title, timeago, post, subTitle} = data;
console.log(data);
let {user, title, timeago, post, subTitle, isRead} = data;
let postId = post.id;
return (
... ... @@ -60,7 +61,7 @@ export default class MsgCenterNormalCell extends React.Component {
<LittleRedDotImage
extra = {user.id}
iconTap={this.props.onPressAvatar}
isRedDot={true}
isRedDot={isRead === 'N'}
image={user.avatar}
/>
<View style={styles.topRight}>
... ...
... ... @@ -18,43 +18,11 @@ import SlicedImage from '../../../common/components/SlicedImage';
export default class SubjectPost extends Component {
constructor(props) {
super(props);
this.renderReplyContentWithPlaceholder = this.renderReplyContentWithPlaceholder.bind(this);
}
render() {
switch (this.props.replyState) {
case 0: {//none...
if (this.props.likeState == 'Y') {
iconSouce=require('../../images/home/like.png');
} else if (this.props.likeState == 'N'){
iconSouce=require('../../images/home/unlike.png');
}
return (
<View style={styles.toolContainer}>
<SlicedImage style={styles.imgIcon} source={this.props.iconSouce}/>
<TouchableOpacity style={styles.imgButton} onPress={this.props.onPressLikeOrDislike}>
</TouchableOpacity>
<View style={styles.rightContainer}>
<TouchableOpacity
style={styles.lzContainer}
onPress={
()=> {
this.props.onPressLZContainer&&this.props.onPressLZContainer()
}
}
>
<Text style={styles.fakePlaceHolder}>回复楼主:</Text>
<Text style={styles.replyCountText}>{'已有'+this.props.commentCount+'条回复'}</Text>
</TouchableOpacity>
</View>
<View style={styles.toolTopLine}/>
<View style={styles.toolBottomLine}/>
</View>
);
}
break;
case 1: {// 楼主
return (
renderReplyContentWithPlaceholder(placeholder) {
return(
<View style={styles.toolContainer}>
<SlicedImage style={styles.imgIcon} source={this.props.iconSouce}/>
<TouchableOpacity style={styles.imgButton} onPress={this.props.showImagePannel}>
... ... @@ -68,7 +36,7 @@ export default class SubjectPost extends Component {
ref='textInput'
style={styles.replyTextInput}
placeholderTextColor='#b0b0b0'
placeholder='回复楼主'
placeholder={placeholder}
multiline={true}
autoCapitalize={'none'}
autoCorrect={false}
... ... @@ -93,41 +61,33 @@ export default class SubjectPost extends Component {
</View>
);
}
break;
case 2: {// others...
render() {
switch (this.props.replyState) {
case 0: {//none...
if (this.props.likeState == 'Y') {
iconSouce=require('../../images/home/like.png');
} else if (this.props.likeState == 'N'){
iconSouce=require('../../images/home/unlike.png');
}
return (
<View style={styles.toolContainer}>
<SlicedImage style={styles.imgIcon} source={this.props.iconSouce}/>
<TouchableOpacity style={styles.imgButton} onPress={this.props.showImagePannel}>
</TouchableOpacity>
<TouchableOpacity style={styles.keyboardIcon} onPress={this.props.blurAll}>
<SlicedImage source={require('../../images/posting/jianpan1.png')} />
<TouchableOpacity style={styles.imgButton} onPress={this.props.onPressLikeOrDislike}>
</TouchableOpacity>
<View style={[styles.rightContainer]}>
<TextInput
ref='textInput'
style={styles.replyTextInput}
placeholderTextColor='#b0b0b0'
placeholder={'回复'+this.someOneToReply+':'}
multiline={true}
autoCapitalize={'none'}
selectionColor={'black'}
autoCorrect={false}
autoFocus={true}
maxLength={1000}
onChangeText={
(text)=>{
this.props.onReplyTextChange&&this.props.onReplyTextChange(text);
}
<View style={styles.rightContainer}>
<TouchableOpacity
style={styles.lzContainer}
onPress={
()=> {
this.props.onPressLZContainer&&this.props.onPressLZContainer()
}
onKeyPress={(event)=>{
if (this.replyContent >= 1000) {
NativeModules.YH_CommunityHelper.showText('超出1000字符最长限制');
}
}}
/>
<Text style={[styles.submitText, {color:this.props.replyTextColor}]} onPress={this.props.commitComment}>发送</Text>
>
<Text style={styles.fakePlaceHolder}>回复楼主:</Text>
<Text style={styles.replyCountText}>{'已有'+this.props.commentCount+'条回复'}</Text>
</TouchableOpacity>
</View>
<View style={styles.toolTopLine}/>
<View style={styles.toolBottomLine}/>
... ... @@ -135,6 +95,23 @@ export default class SubjectPost extends Component {
);
}
break;
case 1: {// 楼主
return (
<View >
{this.renderReplyContentWithPlaceholder('回复楼主:')}
</View>
)
}
break;
case 2: {// others...
return (
<View>
{this.renderReplyContentWithPlaceholder('回复'+this.someOneToReply+':')}
</View>
)
}
break;
default:
break;
}
... ...
... ... @@ -107,7 +107,6 @@ export default class SubjectPost extends Component {
}
blurAll() {
console.log('bbbbbbbbbbbbb');
this.setState({imageState:0, replyState:ReplyState.replyNone});
this.currentReplyState = ReplyState.replyLZ;
if (this.boardInView) {
... ... @@ -184,7 +183,6 @@ export default class SubjectPost extends Component {
}
onPressLZContainer() {
console.log('ccccccccccccccc');
this.cidTo = this.props.authorUid;
this.cnameTo = '';
this.commentId = '';
... ... @@ -226,8 +224,6 @@ export default class SubjectPost extends Component {
}
renderToolContainer() {
console.log('aaaaaaaaaaaaaaaaaaaaaaaa');
console.log('....................... '+this.state.replyState);
let picSource = (this.state.imageState>0?require('../../images/posting/pic1.png') : require('../../images/posting/pic_normal.png'));
let iconSouce = (this.state.replyState === ReplyState.replyNone)?require('../../images/home/like.png'):picSource;
return(
... ... @@ -411,18 +407,6 @@ const styles = StyleSheet.create({
flex: 1,
backgroundColor: 'white',
},
header: {
flexDirection: 'row',
paddingTop: 10,
paddingBottom: 10,
backgroundColor: 'white',
paddingLeft: 15,
},
headerRight: {
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-end',
},
title: {
backgroundColor: 'white',
fontSize: 17,
... ... @@ -430,42 +414,6 @@ const styles = StyleSheet.create({
paddingLeft: 15,
paddingRight: 15,
},
boardText: {
backgroundColor: '#e0e0e0',
height: 21,
fontSize:14,
textAlign: 'center',
paddingLeft: 10,
paddingRight:10,
paddingTop: 3,
marginRight:15,
fontWeight:'100',
},
shareGoodsContainer: {
flexDirection: 'row',
paddingLeft: 15,
paddingBottom: 10,
backgroundColor: 'white',
},
shareGoodsImage: {
width: 52,
height: 70,
backgroundColor:'gray',
},
shareGoodsRightPannel: {
flexDirection: 'column',
paddingLeft: 10,
paddingTop: 5,
},
productNameText: {
fontSize: 15,
width: width - 52 - 30,
},
productPriceText: {
top: 10,
fontSize: 12,
color: '#d0021b',
},
sofaContainer: {
flexDirection: 'column',
height: 190,
... ...