...
|
...
|
@@ -56,8 +56,6 @@ export default function postingReducer(state = initialState, action) { |
|
|
|
|
|
switch (action.type) {
|
|
|
case GO_TO_POST: {
|
|
|
console.log(state);
|
|
|
console.log('bbbbbbbbbbbbbbbbbbbbbb');
|
|
|
let currentSid = state.sid;
|
|
|
let newItems = state.items;
|
|
|
let newSid = currentSid;
|
...
|
...
|
@@ -90,68 +88,8 @@ export default function postingReducer(state = initialState, action) { |
|
|
break;
|
|
|
case SUBJECT_CONTENT_SUCCESS:{
|
|
|
let {sid,json} = action.payload;
|
|
|
|
|
|
let {
|
|
|
authorInfo,
|
|
|
blocks,// contentData order templateKey
|
|
|
browse,
|
|
|
createTime,
|
|
|
forumCode,
|
|
|
forumName,
|
|
|
id,
|
|
|
isForumTop,
|
|
|
isHot,
|
|
|
isIndexTop,
|
|
|
postsTitle,
|
|
|
praise,
|
|
|
praiseUsers,//headIcon nickName uid
|
|
|
shareGoods,
|
|
|
publishTimeString,
|
|
|
shareProductSkn,
|
|
|
revieweState,
|
|
|
hasPraise,
|
|
|
largeImages,
|
|
|
LZ,
|
|
|
} = json;
|
|
|
let item = state.items.get(sid);
|
|
|
item = item.set('blocks',Immutable.fromJS(blocks))
|
|
|
.set('browse',browse)
|
|
|
.set('createTime',createTime)
|
|
|
.set('forumCode',forumCode)
|
|
|
.set('forumName',forumName)
|
|
|
.set('id',id)
|
|
|
.set('isForumTop',isForumTop)
|
|
|
.set('isHot',isHot)
|
|
|
.set('isIndexTop',isIndexTop)
|
|
|
.set('postsTitle',postsTitle)
|
|
|
.set('praise',praise)
|
|
|
.set('praiseUsers',Immutable.fromJS(praiseUsers.reverse()))
|
|
|
.set('publishTimeString',publishTimeString)
|
|
|
.set('shareProductSkn',shareProductSkn)
|
|
|
.set('LZ',LZ)
|
|
|
.set('isContentFetching', false)
|
|
|
.set('contentError', null)
|
|
|
.set('revieweState',revieweState)
|
|
|
.set('largeImages',largeImages)
|
|
|
.set('hasPraise',hasPraise||'N');
|
|
|
if (shareGoods) {
|
|
|
let imgUrl = '';
|
|
|
if (shareGoods.goodsImage.length) {
|
|
|
let ary=shareGoods.goodsImage.split('?');
|
|
|
imgUrl = ary[0];
|
|
|
}
|
|
|
item = item.setIn(['shareGoods','productName'],shareGoods.productName||'')
|
|
|
.setIn(['shareGoods','productUrl'],shareGoods.productUrl||'')
|
|
|
.setIn(['shareGoods','salesPrice'],shareGoods.salesPrice||'')
|
|
|
.setIn(['shareGoods','goodsImage'],imgUrl||'')
|
|
|
.setIn(['shareGoods','productId'],shareGoods.productId)
|
|
|
}
|
|
|
if (authorInfo) {
|
|
|
item = item.setIn(['authorInfo','headIcon'],authorInfo.headIcon||'')
|
|
|
.setIn(['authorInfo','nickName'],authorInfo.nickName||'')
|
|
|
.setIn(['authorInfo','uid'],authorInfo.uid||'')
|
|
|
.setIn(['authorInfo','url'],authorInfo.url||'')
|
|
|
}
|
|
|
item = postContentSuccess(item, json);
|
|
|
let nextState = state.setIn(['items', sid], item);
|
|
|
return nextState;
|
|
|
}
|
...
|
...
|
@@ -315,3 +253,55 @@ export default function postingReducer(state = initialState, action) { |
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function postContentSuccess(item, json) {
|
|
|
let {
|
|
|
authorInfo,
|
|
|
blocks,// contentData order templateKey
|
|
|
browse,
|
|
|
createTime,
|
|
|
forumCode,
|
|
|
forumName,
|
|
|
id,
|
|
|
isForumTop,
|
|
|
isHot,
|
|
|
isIndexTop,
|
|
|
postsTitle,
|
|
|
praise,
|
|
|
praiseUsers,//headIcon nickName uid
|
|
|
shareGoods,
|
|
|
revieweState,
|
|
|
hasPraise,
|
|
|
largeImages,
|
|
|
LZ,
|
|
|
} = json;
|
|
|
|
|
|
item = item.set('isContentFetching', false)
|
|
|
.set('contentError', null)
|
|
|
.set('blocks',Immutable.fromJS(blocks))
|
|
|
.set('browse',browse)
|
|
|
.set('createTime',createTime)
|
|
|
.set('forumCode',forumCode)
|
|
|
.set('forumName',forumName)
|
|
|
.set('id',id)
|
|
|
.set('isForumTop',isForumTop)
|
|
|
.set('isHot',isHot)
|
|
|
.set('isIndexTop',isIndexTop)
|
|
|
.set('postsTitle',postsTitle)
|
|
|
.set('praise',praise)
|
|
|
.set('praiseUsers',Immutable.fromJS(praiseUsers.reverse()))
|
|
|
.set('LZ',LZ)
|
|
|
.set('revieweState',revieweState)
|
|
|
.set('largeImages',largeImages)
|
|
|
.set('hasPraise',hasPraise||'N')
|
|
|
.setIn(['shareGoods','productName'],shareGoods.productName)
|
|
|
.setIn(['shareGoods','productUrl'],shareGoods.productUrl)
|
|
|
.setIn(['shareGoods','salesPrice'],shareGoods.salesPrice)
|
|
|
.setIn(['shareGoods','goodsImage'],shareGoods.goodsImage)
|
|
|
.setIn(['shareGoods','productId'],shareGoods.productId)
|
|
|
.setIn(['authorInfo','headIcon'],authorInfo.headIcon)
|
|
|
.setIn(['authorInfo','nickName'],authorInfo.nickName)
|
|
|
.setIn(['authorInfo','uid'],authorInfo.uid);
|
|
|
|
|
|
return item;
|
|
|
} |
...
|
...
|
|