...
|
...
|
@@ -39,6 +39,7 @@ const { |
|
|
SUBJECT_DEL_COMMENT_REQUEST,
|
|
|
SUBJECT_DEL_COMMENT_SUCCESS,
|
|
|
SUBJECT_DEL_COMMENT_FAILURE,
|
|
|
SUBJECT_SHARE_DATA_PREPARED,
|
|
|
} = require('../../constants/actionTypes').default;
|
|
|
|
|
|
export function deleteComment(sid, id) {
|
...
|
...
|
@@ -79,8 +80,8 @@ export function subjectLikeRequest(sid,json) { |
|
|
|
|
|
export function subjectLike(sid,postId) {
|
|
|
return (dispatch, getState) => {
|
|
|
dispatch(subjectLikeRequest(sid,postId));
|
|
|
let {user} = getState();
|
|
|
dispatch(subjectLikeRequest(sid,user.profile.avatar));
|
|
|
return new HomeService().postLike(postId, user.profile.uid)
|
|
|
.then(json => {
|
|
|
dispatch({
|
...
|
...
|
@@ -103,8 +104,8 @@ export function subjectUnlikeRequest(sid,json) { |
|
|
|
|
|
export function subjectUnlike(sid,postId) {
|
|
|
return (dispatch, getState) => {
|
|
|
dispatch(subjectUnlikeRequest(sid,postId));
|
|
|
let {user} = getState();
|
|
|
dispatch(subjectUnlikeRequest(sid,user.profile.avatar));
|
|
|
return new HomeService().postUnlike(postId, user.profile.uid)
|
|
|
.then(json => {
|
|
|
dispatch({
|
...
|
...
|
@@ -137,18 +138,16 @@ export function onRightPressed(sid) { |
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
let params = {
|
|
|
postsId: item.id,
|
|
|
appType: 1,
|
|
|
}
|
|
|
new PostingService().getShareUrl(params).then(json => {
|
|
|
let {subject} = getState();
|
|
|
let item = subject.items.get(sid);
|
|
|
let {subject} = getState();
|
|
|
let item = subject.items.get(sid);
|
|
|
console.log('aaaaaaaaaaaaaa');
|
|
|
console.log(item.shareUrl);
|
|
|
if (item.shareUrl.length) {
|
|
|
let blockAry = item.blocks.toJS();
|
|
|
let content = '';
|
|
|
let contentStr = '';
|
|
|
for (var i = 0; i < blockAry.length; i++) {
|
|
|
if (blockAry[i].templateKey == 'text') {
|
|
|
content = blockAry[i].contentData||'';
|
|
|
contentStr = blockAry[i].contentData||'';
|
|
|
break;
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -159,6 +158,7 @@ export function onRightPressed(sid) { |
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
console.log('bbbbbbbbbbbbbb');
|
|
|
let newSrc = picUrl;
|
|
|
if (picUrl.length) {
|
|
|
if (picUrl.indexOf('imageView') === -1) {
|
...
|
...
|
@@ -169,21 +169,46 @@ export function onRightPressed(sid) { |
|
|
.replace('{height}', '320');
|
|
|
}
|
|
|
}
|
|
|
console.log('cccccccccccccccc');
|
|
|
let title = item.postsTitle||contentStr||'潮流社区';
|
|
|
let content = item.authorInfo.nickName||''+'在潮流社区发布的潮流主题帖很赞,快来看看!'
|
|
|
let shareInfo = {
|
|
|
title: subject.postsTitle||'',
|
|
|
title,
|
|
|
content,
|
|
|
'picUrl':newSrc,
|
|
|
linkUrl: json.shareUrl,
|
|
|
picUrl:newSrc,
|
|
|
linkUrl: item.shareUrl,
|
|
|
}
|
|
|
console.log('ddddddddddddd');
|
|
|
dispatch(doShare(sid,shareInfo));
|
|
|
}).catch(error => {
|
|
|
console.log('ddddddddddddddddd');
|
|
|
} else {
|
|
|
Alert.alert('提示','获取分享信息失败');
|
|
|
})
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function prepareShareData(sid, postId) {
|
|
|
return dispatch => {
|
|
|
let params = {
|
|
|
postsId: postId,
|
|
|
appType: 1,
|
|
|
};
|
|
|
new PostingService().getShareUrl(params).then(json => {
|
|
|
dispatch(shareDataPrepared(sid, json.shareUrl));
|
|
|
}).catch(error => {
|
|
|
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function shareDataPrepared(sid, shareUrl) {
|
|
|
return {
|
|
|
type: SUBJECT_SHARE_DATA_PREPARED,
|
|
|
payload: {sid, shareUrl},
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function onRight(sid) {
|
|
|
return {
|
|
|
type:'SUBJECT_DO_NOTHING',
|
...
|
...
|
@@ -193,7 +218,7 @@ export function onRight(sid) { |
|
|
|
|
|
export function doShare(sid,shareInfo) {
|
|
|
NativeModules.YH_CommunityHelper.showShare(shareInfo);
|
|
|
|
|
|
console.log('ffffffffffff');
|
|
|
return {
|
|
|
type:'SUBJECT_DO_NOTHING',
|
|
|
payload: sid,
|
...
|
...
|
@@ -436,6 +461,7 @@ export function commitComment(sid,params, newList) { |
|
|
new PostingService().commitReply(params)
|
|
|
.then(response => {
|
|
|
Alert.alert('提示','回复成功');
|
|
|
newList[0].commentId = response.id;
|
|
|
dispatch(commentSuccess(sid,response, newList));
|
|
|
}).catch(error => {
|
|
|
Alert.alert('提示','回复失败');
|
...
|
...
|
|