Authored by 张文文

站内信通知消息接口调试 reviewd by 朱傲哲

... ... @@ -16,27 +16,25 @@ export default class ContentFansListCell extends Component {
render() {
let {data} = this.props;
let resource = data.isMutualAttention ? require('../../images/content_attentioned.png') : require('../../images/content_fan.png');
let status = data.isMutualAttention ? 1 : 0;
let optUid = data.optUid;
let {width, height} = Dimensions.get('window');
let sliceCount = width <= 320 ? 6 : 10;
let userName = data.userName.length > sliceCount ? data.userName.slice(0,sliceCount)+'...' : data.userName;
return (
<View>
<View style={styles.headerBackground}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(optUid)}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(data)}>
<YH_Image style={styles.headIcon} url={data.headIco} circle={true}/>
</TouchableOpacity>
<View style={styles.textView}>
<TouchableOpacity style={styles.toubleView} activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(optUid)}>
<TouchableOpacity style={styles.toubleView} activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(data)}>
<Text style={styles.nicknameText} numberOfLines={1}>{userName}</Text>
<Text style={styles.defaultReplyText}>关注了你</Text>
</TouchableOpacity>
<Text style={styles.startTimeText}>{data.createTime}</Text>
</View>
<TouchableOpacity activeOpacity={1} style={styles.fanContainer} onPress={()=> {this.props.updateAttentionAction && this.props.updateAttentionAction(status,optUid)}}>
<TouchableOpacity activeOpacity={1} style={styles.fanContainer} onPress={()=> {this.props.updateAttentionAction && this.props.updateAttentionAction(data)}}>
<Image style={styles.fanImage} resizeMode="contain" source={resource}/>
</TouchableOpacity>
</View>
... ...
... ... @@ -18,48 +18,29 @@ export default class ContentLikedListCell extends Component {
let resource = rowData.coverImg ? typeof rowData.coverImg === 'string' ? JSON.parse(rowData.coverImg) : rowData.coverImg : '';
let picItem = resource ? typeof resource.data === 'string' ? JSON.parse(resource.data) : resource.data : '';
let imageUrl = YH_Image.getSlicedUrl(picItem.src, 50 * DEVICE_HEIGHT_RATIO, 50 * DEVICE_HEIGHT_RATIO, 2);
let {width, height} = Dimensions.get('window');
let sliceCount = width <= 320 ? 10 : 15;
let userName = rowData.userName.length > sliceCount ? rowData.userName.slice(0,sliceCount)+'...' : rowData.userName;
let subName = '赞了你';
switch (rowData.businessType) {
case 1000:
subName = '赞了你';
break;
case 1001:
subName = '收藏了你';
break;
case 1002:
subName = '评论了你';
break;
case 1003:
subName = '回复了你';
break;
case 1004:
subName = '关注了你';
break;
default:
}
let subName = rowData.businessType === 1000 ? '赞了你' : '收藏了你';
return (
<View>
<View style={styles.headerBackground}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData.optUid)}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData)}>
<YH_Image style={styles.headIcon} url={rowData.headIco} circle={true}/>
</TouchableOpacity>
<View style={styles.textView}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData.optUid)}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData)}>
<Text style={styles.nicknameText} numberOfLines={1}>{userName}</Text>
</TouchableOpacity>
<Text style={styles.subnameText}>{subName}</Text>
</View>
</View>
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData.articleId, rowData.rootCommentId, rowData.isDelete)}>
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData)}>
{ rowData.isDelete === 'N' ?
... ...
... ... @@ -73,11 +73,8 @@ export default class ContentListView extends Component {
{
return(
<ContentNotifyListCell
itemData={rowData}
onPressListItem={(itemData) => {
this.props.onPressListItem && this.props.onPressListItem(itemData, rowID)
}
}
data={rowData}
jumpToGrassDetailPage={this.props.jumpToGrassDetailPage}
/>
);
}
... ...
... ... @@ -21,44 +21,26 @@ export default class ContentMessageCell extends Component {
let picItem = resource ? typeof resource.data === 'string' ? JSON.parse(resource.data) : resource.data : '';
let imageUrl = YH_Image.getSlicedUrl(picItem.src, 50 * DEVICE_HEIGHT_RATIO, 50 * DEVICE_HEIGHT_RATIO, 2);
let {width, height} = Dimensions.get('window');
let sliceCount = width <= 320 ? 10 : 15;
let userName = rowData.userName.length > sliceCount ? rowData.userName.slice(0,sliceCount)+'...' : rowData.userName;
let subName = '赞了你';
switch (rowData.businessType) {
case 1000:
subName = '赞了你';
break;
case 1001:
subName = '收藏了你';
break;
case 1002:
subName = '评论了你';
break;
case 1003:
subName = '回复了你';
break;
case 1004:
subName = '关注了你';
break;
default:
}
let subName = rowData.businessType === 1002 ? '评论了你' : '回复了你';
return (
<View>
<View style={styles.headerBackground}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData.optUid)}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData)}>
<YH_Image style={styles.headIcon} url={rowData.headIco} circle={true}/>
</TouchableOpacity>
<View style={styles.textView}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData.optUid)}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData)}>
<Text style={styles.nicknameText} numberOfLines={1}>{userName}</Text>
</TouchableOpacity>
<Text style={styles.subnameText}>{subName}</Text>
</View>
<TouchableOpacity activeOpacity={1} style={styles.replyContainer} onPress={()=> this.props.jumpToShowKeyboard && this.props.jumpToShowKeyboard(rowData.userName, rowData.commentId, rowData.isDelete)}>
<TouchableOpacity activeOpacity={1} style={styles.replyContainer} onPress={()=> this.props.jumpToShowKeyboard && this.props.jumpToShowKeyboard(rowData)}>
<Image style={styles.replyImage} resizeMode="contain" source={require('../../images/content_reply.png')}/>
</TouchableOpacity>
</View>
... ... @@ -69,7 +51,7 @@ export default class ContentMessageCell extends Component {
{ status ?
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData.articleId, rowData.rootCommentId, rowData.isDelete, status)}>
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData)}>
<View style={styles.ownerReplyView}>
<Text style={{paddingLeft: 10, paddingTop: 14, paddingRight: 1, paddingBottom: 12}} numberOfLines={3}>
<Text style={styles.replyText}>我的评论:</Text>
... ... @@ -80,7 +62,7 @@ export default class ContentMessageCell extends Component {
:
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData.articleId, rowData.rootCommentId, rowData.isDelete, status)}>
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData)}>
{ rowData.isDelete === 'N' ?
<View style={ styles.originContainerView} >
... ...
... ... @@ -15,17 +15,18 @@ export default class ContentNotifyListCell extends Component {
}
render() {
let imageUri = 'http://img10.static.yhbimg.com/couponImg/2017/02/23/16/0199db13b531e2ae5b4c69fa34c198c902.png?imageView/{mode}/w/{width}/h/{height}';
imageUri = SlicedImage.getSlicedUrl(imageUri, 50, 50, 2);
let {data} = this.props;
let {itemData} = this.props;
let resource = data.coverImg ? typeof data.coverImg === 'string' ? JSON.parse(data.coverImg) : data.coverImg : '';
let picItem = resource ? typeof resource.data === 'string' ? JSON.parse(resource.data) : resource.data : '';
let imageUrl = YH_Image.getSlicedUrl(picItem.src, 50 * DEVICE_HEIGHT_RATIO, 50 * DEVICE_HEIGHT_RATIO, 2);
return (
<View style= {styles.cellContainer}>
<View style={styles.headContainer}>
<Text style={styles.headTextStyle}>
今天 12:03
{data.createTime}
</Text>
<View style={[styles.headSeparator]}/>
</View>
... ... @@ -33,18 +34,18 @@ export default class ContentNotifyListCell extends Component {
<View style={styles.editContainer}>
<TouchableOpacity
activeOpacity={1}
onLongPress={() =>{
this.props.onLongPressListItem && this.props.onLongPressListItem(itemData);
}}
// onLongPress={() =>{
// this.props.onLongPressListItem && this.props.onLongPressListItem(data);
// }}
onPress={() =>{
this.props.onPressListItem && this.props.onPressListItem(itemData);
this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(data);
}}
>
<View style={styles.contentContainer}>
<View style={styles.descStyle}>
<Image
<YH_Image
style={styles.iconStyle}
source={{uri: imageUri}}
url={imageUrl}
resizeMode="contain"
/>
<View style={styles.textContainer}>
... ... @@ -52,7 +53,7 @@ export default class ContentNotifyListCell extends Component {
style={styles.detail}
numberOfLines={2}
>
恭喜您!您发布的内容为优质内容,获得有货社区重点推荐
{data.content}
</Text>
</View>
</View>
... ... @@ -62,7 +63,7 @@ export default class ContentNotifyListCell extends Component {
<TouchableOpacity
activeOpacity={1}
onPress={() => {
this.props.onPressListItem && this.props.onPressListItem(itemData)
this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(data)
}
}
>
... ... @@ -139,21 +140,12 @@ let styles = StyleSheet.create({
justifyContent: 'space-between',
alignItems: 'flex-start',
},
titleStyle: {
marginLeft: 10,
fontSize: 13,
fontWeight: 'bold',
color: '#444444',
marginRight: 15,
backgroundColor: 'transparent'
},
detail:{
marginLeft: 10,
fontSize: 13,
fontWeight: 'bold',
fontSize: 12,
fontFamily: 'PingFang-SC-Regular',
color: '#444444',
maxWidth: width-15-50-10-22,
lineHeight: 18,
backgroundColor: 'transparent'
},
... ...
... ... @@ -51,11 +51,11 @@ class ContentListContainer extends Component {
this._onEndReached = this._onEndReached.bind(this);
this._jumpToPersonalGrassPage = this._jumpToPersonalGrassPage.bind(this);
this._jumpToGrassDetailPage = this._jumpToGrassDetailPage.bind(this);
this._onPressListItem = this._onPressListItem.bind(this);
}
_updateAttentionAction(status, optUid) {
this.props.actions.updateAttentionAction(status, optUid);
_updateAttentionAction(data) {
let status = data.isMutualAttention ? 1 : 0;
this.props.actions.updateAttentionAction(status, data.optUid);
}
_onRefresh() {
... ... @@ -74,15 +74,11 @@ class ContentListContainer extends Component {
this.props.actions.clearOtherMessage()
}
_onPressListItem(itemData, rowID) {
console.log('查看原文');
}
//跳转到种草H5
_jumpToPersonalGrassPage(optUid) {
_jumpToPersonalGrassPage(rowData) {
let {communityHost} = this.props
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/author/${1}/${optUid}`
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/author/${1}/${rowData.optUid}`
let action, params;
if(Platform.OS === 'ios') {
action = 'go.h5';
... ... @@ -105,13 +101,13 @@ class ContentListContainer extends Component {
NativeModules.YH_CommonHelper.jumpWithUrl(path);
}
_jumpToGrassDetailPage(articleId, rootCommentId, isDelete) {
if (isDelete === 'Y') {
_jumpToGrassDetailPage(rowData) {
if (rowData.isDelete === 'Y') {
return;
}
let {communityHost} = this.props
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/article/detail/${articleId}`
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/article/detail/${rowData.articleId}`
let action, params;
if(Platform.OS === 'ios') {
action = 'go.h5';
... ... @@ -152,7 +148,6 @@ class ContentListContainer extends Component {
updateAttentionAction={this._updateAttentionAction}
jumpToPersonalGrassPage={this._jumpToPersonalGrassPage}
jumpToGrassDetailPage={this._jumpToGrassDetailPage}
onPressListItem={this._onPressListItem}
/>
</View>
... ...
... ... @@ -101,14 +101,14 @@ class ContentMessageContainer extends Component {
NativeModules.YH_CommonHelper.jumpWithUrl(actionUrl);
}
_jumpToShowKeyboard(userName, commentId, isDelete) {
if (isDelete === 'Y') {
_jumpToShowKeyboard(rowData) {
if (rowData.isDelete === 'Y') {
this.props.actions.showToastMessage('原文已被作者删除');
return;
}
NativeModules.YH_CommonHelper.showkeyBoardView(userName).then(replyValue => {
this.props.actions.addArticleCommentAction(replyValue, commentId);
NativeModules.YH_CommonHelper.showkeyBoardView(rowData.userName).then(replyValue => {
this.props.actions.addArticleCommentAction(replyValue, rowData.commentId);
});
}
... ... @@ -117,11 +117,11 @@ class ContentMessageContainer extends Component {
}
//跳转到种草H5
_jumpToPersonalGrassPage(optUid) {
_jumpToPersonalGrassPage(rowData) {
let {communityHost} = this.props
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/author/${1}/${optUid}`
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/author/${1}/${rowData.optUid}`
let action, params;
if(Platform.OS === 'ios') {
action = 'go.h5';
... ... @@ -144,17 +144,16 @@ class ContentMessageContainer extends Component {
NativeModules.YH_CommonHelper.jumpWithUrl(path);
}
_jumpToGrassDetailPage(articleId, rootCommentId, isDelete, status) {
if (isDelete === 'Y') {
if (status) {
_jumpToGrassDetailPage(rowData) {
if (rowData.isDelete === 'Y') {
if (rowData.businessType === 1003) {
this.props.actions.showToastMessage('原文已被作者删除');
}
return;
}
let {communityHost} = this.props
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/article/detail/${articleId}`+ `?commentId=${rootCommentId}`
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/article/detail/${rowData.articleId}`+ `?commentId=${rowData.rootCommentId}`
let action, params;
if(Platform.OS === 'ios') {
... ...