...
|
...
|
@@ -24,6 +24,9 @@ import PostingService from '../../services/PostingService'; |
|
|
import SPHeaderCell from './SPHeaderCell';
|
|
|
import SubjectContent from './SubjectContent';
|
|
|
import SPLikeCell from './SPLikeCell';
|
|
|
import SPShareGoodsCell from './SPShareGoodsCell';
|
|
|
import SPCommentCell from './SPCommentCell';
|
|
|
import LoadingIndicator from '../../../common/components/LoadingIndicator';
|
|
|
import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
|
|
|
import AssertsPicker from '../posting/AssertsPicker';
|
|
|
import SlicedImage from '../../../common/components/SlicedImage';
|
...
|
...
|
@@ -64,12 +67,14 @@ export default class SubjectPost extends Component { |
|
|
this.renderToolContainer = this.renderToolContainer.bind(this);
|
|
|
this.someOneToReply = '';
|
|
|
this.replyToSomeOneElse = this.replyToSomeOneElse.bind(this);
|
|
|
this.renderDeleteCommentButton = this.renderDeleteCommentButton.bind(this);
|
|
|
|
|
|
this.commentId = '';
|
|
|
this.cidTo = '';
|
|
|
this.replyContent='';
|
|
|
this.commitComment = this.commitComment.bind(this);
|
|
|
this.cnameTo = '';
|
|
|
|
|
|
this.onPressComment = this.onPressComment.bind(this);
|
|
|
}
|
|
|
|
|
|
componentDidMount(){
|
...
|
...
|
@@ -120,7 +125,15 @@ export default class SubjectPost extends Component { |
|
|
let targetHeight = height-navbarHeight-0.5- this.boardHeight;
|
|
|
this.stretchContentInputToHeight(targetHeight, 250);
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
|
|
|
if (this.props.isContentFetching) {
|
|
|
return <LoadingIndicator
|
|
|
isVisible={this.props.isContentFetching}
|
|
|
/>
|
|
|
}
|
|
|
|
|
|
return(
|
|
|
<View style={styles.container}>
|
|
|
<Animated.View
|
...
|
...
|
@@ -374,6 +387,7 @@ export default class SubjectPost extends Component { |
|
|
this.replyContent = '';
|
|
|
this.blurAll();
|
|
|
}
|
|
|
|
|
|
renderRow(rowData, sectionId) {
|
|
|
switch (sectionId) {
|
|
|
case 'header':
|
...
|
...
|
@@ -407,15 +421,10 @@ export default class SubjectPost extends Component { |
|
|
break;
|
|
|
case 'shareGoods':
|
|
|
return (
|
|
|
<TouchableOpacity onPress={this.props.onPressShareGoods}>
|
|
|
<View style={styles.shareGoodsContainer}>
|
|
|
<SlicedImage style={styles.shareGoodsImage} source={{uri:rowData.goodsImage}}/>
|
|
|
<View style={styles.shareGoodsRightPannel}>
|
|
|
<Text style={styles.productNameText}>{rowData.productName}</Text>
|
|
|
<Text style={styles.productPriceText}>{'¥'+rowData.salesPrice}</Text>
|
|
|
</View>
|
|
|
</View>
|
|
|
</TouchableOpacity>
|
|
|
<SPShareGoodsCell
|
|
|
data={rowData}
|
|
|
onPressShareGoods={this.props.onPressShareGoods}
|
|
|
/>
|
|
|
);
|
|
|
break;
|
|
|
case 'like':
|
...
|
...
|
@@ -432,23 +441,36 @@ export default class SubjectPost extends Component { |
|
|
break;
|
|
|
case 'comments':
|
|
|
return (
|
|
|
<TouchableOpacity
|
|
|
style={styles.commentContainer}
|
|
|
onPress={
|
|
|
()=> {
|
|
|
this.cidTo = rowData.cidTo;
|
|
|
this.cnameTo = rowData.nickName;
|
|
|
this.commentId = rowData.commentId;
|
|
|
<SPCommentCell
|
|
|
data={rowData}
|
|
|
cidFrom={this.props.cidFrom}
|
|
|
onPressAvatar={this.props.onPressAvatar}
|
|
|
onPressComment={() => {
|
|
|
this.onPressComment(rowData.cidTo, rowData.nickName, rowData.commentId);
|
|
|
}}
|
|
|
/>
|
|
|
);
|
|
|
break;
|
|
|
default:
|
|
|
return null;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
onPressComment(cidTo, nickName, commentId) {
|
|
|
this.cidTo = cidTo;
|
|
|
this.cnameTo = nickName;
|
|
|
this.commentId = commentId;
|
|
|
NativeModules.YH_CommunityHelper.uid()
|
|
|
.then(uid => {
|
|
|
new PostingService().getPostUser(uid).then(json => {
|
|
|
if (json.forbidSpeaking === 'Y') {
|
|
|
Alert.alert('抱歉','您暂时被禁言,请等待禁言解除哦~');
|
|
|
} else {
|
|
|
this.replyToSomeOneElse(rowData.nickName);
|
|
|
this.replyToSomeOneElse(nickName);
|
|
|
}
|
|
|
}).catch(error => {
|
|
|
this.replyToSomeOneElse(rowData.nickName);
|
|
|
this.replyToSomeOneElse(nickName);
|
|
|
})
|
|
|
})
|
|
|
.catch(error => {
|
...
|
...
|
@@ -458,59 +480,15 @@ export default class SubjectPost extends Component { |
|
|
if (json.forbidSpeaking === 'Y') {
|
|
|
Alert.alert('抱歉','您暂时被禁言,请等待禁言解除哦~');
|
|
|
} else {
|
|
|
this.replyToSomeOneElse(rowData.nickName);
|
|
|
this.replyToSomeOneElse(nickName);
|
|
|
}
|
|
|
}).catch(error => {
|
|
|
this.replyToSomeOneElse(rowData.nickName);
|
|
|
this.replyToSomeOneElse(nickName);
|
|
|
})
|
|
|
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
>
|
|
|
<View>
|
|
|
<View style={{flexDirection:'row'}}>
|
|
|
<View style={{flex:1,flexDirection: 'row',alignItems:'center'}}>
|
|
|
<UserBrief
|
|
|
avatar={rowData.headIcon}
|
|
|
name={rowData.nickName}
|
|
|
timeago={rowData.timeago}
|
|
|
isOwner={rowData.LZ}
|
|
|
onPressAvatar={() => {
|
|
|
this.props.onPressAvatar && this.props.onPressAvatar();
|
|
|
}}
|
|
|
/>
|
|
|
</View>
|
|
|
{this.renderDeleteCommentButton(rowData.cidTo,rowData.commentId)}
|
|
|
</View>
|
|
|
|
|
|
<SubjectContent contentWidth={width-65} left={20} blocks={rowData.blocks} replyTo={rowData.replyTo} onPressAvatar={this.props.onPressAvatar}/>
|
|
|
<View style={styles.commentSeparator}/>
|
|
|
</View>
|
|
|
</TouchableOpacity>
|
|
|
);
|
|
|
break;
|
|
|
default:
|
|
|
return null;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
renderDeleteCommentButton(commentUserId,id) {
|
|
|
if (this.props.dataBlob.header[0].LZ||(commentUserId == this.props.cidFrom)) {
|
|
|
return(
|
|
|
<TouchableOpacity
|
|
|
style={{width:80,height:30,alignItems:'flex-end'}}
|
|
|
onPress={()=>{
|
|
|
this.props.onPressDeleteComment&&this.props.onPressDeleteComment(id);
|
|
|
}}
|
|
|
>
|
|
|
<Image style={{width:20,height:20}} resizeMode={'contain'} source={require('../../images/posting/ic_dian.png')}/>
|
|
|
</TouchableOpacity>
|
|
|
)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
replyToSomeOneElse(someOne) {
|
|
|
this.someOneToReply = someOne;
|
...
|
...
|
@@ -532,17 +510,6 @@ const styles = StyleSheet.create({ |
|
|
backgroundColor: 'white',
|
|
|
paddingLeft: 15,
|
|
|
},
|
|
|
commentContainer: {
|
|
|
paddingTop: 10,
|
|
|
paddingLeft: 15,
|
|
|
paddingRight: 15,
|
|
|
backgroundColor: 'white',
|
|
|
},
|
|
|
commentSeparator: {
|
|
|
backgroundColor: '#a0a0a0',
|
|
|
height: 0.5,
|
|
|
width: width-30,
|
|
|
},
|
|
|
headerRight: {
|
|
|
flex: 1,
|
|
|
flexDirection: 'row',
|
...
|
...
|
|