Authored by 盖剑秋

Add sid to subject post initial state. reviewed by redding.

@@ -29,12 +29,12 @@ export default class SubjectContent extends Component { @@ -29,12 +29,12 @@ export default class SubjectContent extends Component {
29 <Text key={i} style={styles.contentText}> 29 <Text key={i} style={styles.contentText}>
30 <Text>回复</Text> 30 <Text>回复</Text>
31 <Text style={{color:'#4a90e2'}} onPress={()=>{this.props.onPressAvatar(this.props.replyTo.uid);}}>{this.props.replyTo.nickName}</Text> 31 <Text style={{color:'#4a90e2'}} onPress={()=>{this.props.onPressAvatar(this.props.replyTo.uid);}}>{this.props.replyTo.nickName}</Text>
32 - <Text>':'+{decodeURI(content)}</Text> 32 + <Text>':'+{content}</Text>
33 </Text> 33 </Text>
34 ) 34 )
35 }else { 35 }else {
36 return( 36 return(
37 - <Text key={i} style={styles.contentText}>{decodeURI(content)}</Text> 37 + <Text key={i} style={styles.contentText}>{content}</Text>
38 ) 38 )
39 } 39 }
40 40
@@ -302,7 +302,7 @@ export default class SubjectPost extends Component { @@ -302,7 +302,7 @@ export default class SubjectPost extends Component {
302 cidFrom: this.props.cidFrom, 302 cidFrom: this.props.cidFrom,
303 cidTo: this.cidTo, 303 cidTo: this.cidTo,
304 authorUid: this.props.authorUid, 304 authorUid: this.props.authorUid,
305 - content: encodeURI(this.replyContent), 305 + content: this.replyContent,
306 } 306 }
307 this.props.commentWithParams(params); 307 this.props.commentWithParams(params);
308 this.blurAll(); 308 this.blurAll();
@@ -67,12 +67,14 @@ class SubjectPostContainer extends Component { @@ -67,12 +67,14 @@ class SubjectPostContainer extends Component {
67 this.onPressLikeOrDislike = this.onPressLikeOrDislike.bind(this); 67 this.onPressLikeOrDislike = this.onPressLikeOrDislike.bind(this);
68 this.onPressShareGoods = this.onPressShareGoods.bind(this); 68 this.onPressShareGoods = this.onPressShareGoods.bind(this);
69 this.onPressLargeImage = this.onPressLargeImage.bind(this); 69 this.onPressLargeImage = this.onPressLargeImage.bind(this);
  70 + this.sid = this.props.subject.sid;
70 } 71 }
71 72
72 componentDidMount() { 73 componentDidMount() {
  74 + let item = this.props.subject.items.get(this.sid);
73 InteractionManager.runAfterInteractions(() => { 75 InteractionManager.runAfterInteractions(() => {
74 - this.props.actions.requestPostContent(this.props.postId);  
75 - this.props.actions.requestPostComments(this.props.postId); 76 + this.props.actions.requestPostContent(this.sid,item.id);
  77 + this.props.actions.requestPostComments(this.sid,item.id);
76 }); 78 });
77 } 79 }
78 80
@@ -81,10 +83,11 @@ class SubjectPostContainer extends Component { @@ -81,10 +83,11 @@ class SubjectPostContainer extends Component {
81 } 83 }
82 84
83 onEndReached() { 85 onEndReached() {
84 - if (this.props.subject.currentPage>=this.props.subject.totalPages) { 86 + let item = this.props.subject.items.get(this.sid);
  87 + if (item.currentPage>=item.totalPages) {
85 return; 88 return;
86 } 89 }
87 - this.props.actions.requestPostComments(300, this.props.subject.lastedTime); 90 + this.props.actions.requestPostComments(this.sid, item.id, item.lastedTime);
88 } 91 }
89 92
90 onPressLargeImage(index) { 93 onPressLargeImage(index) {
@@ -92,16 +95,17 @@ class SubjectPostContainer extends Component { @@ -92,16 +95,17 @@ class SubjectPostContainer extends Component {
92 } 95 }
93 96
94 assetsSelected(assets) { 97 assetsSelected(assets) {
95 - this.props.actions.assetsSelected(assets); 98 + this.props.actions.assetsSelected(this.sid,assets);
96 } 99 }
97 100
98 commentWithParams(params) { 101 commentWithParams(params) {
99 - this.props.actions.commentWithParams(params); 102 + this.props.actions.commentWithParams(this.sid,params);
100 } 103 }
101 104
102 onPressShareGoods() { 105 onPressShareGoods() {
  106 + let item = this.props.subject.items.get(this.sid);
103 let params = { 107 let params = {
104 - productSkn: this.props.subject.shareProductSkn, 108 + productSkn: item.shareProductSkn,
105 }; 109 };
106 NativeModules.YH_CommunityHelper.displayProductDetail(params); 110 NativeModules.YH_CommunityHelper.displayProductDetail(params);
107 } 111 }
@@ -114,26 +118,28 @@ class SubjectPostContainer extends Component { @@ -114,26 +118,28 @@ class SubjectPostContainer extends Component {
114 } 118 }
115 119
116 onPressReportOrDelete() { 120 onPressReportOrDelete() {
117 - if (this.props.subject.LZ) {  
118 - this.props.actions.doDelete(this.props.subject.id); 121 + let item = this.props.subject.items.get(this.sid);
  122 + if (item.LZ) {
  123 + this.props.actions.doDelete(this.sid,item.id);
119 } else { 124 } else {
120 let params = { 125 let params = {
121 - postsId: this.props.subject.id, 126 + postsId: item.id,
122 loginUid: this.props.user.profile.uid, 127 loginUid: this.props.user.profile.uid,
123 contentData: '涉黄', 128 contentData: '涉黄',
124 } 129 }
125 - this.props.actions.doReport(params); 130 + this.props.actions.doReport(this.sid,params);
126 } 131 }
127 } 132 }
128 133
129 onPressLikeOrDislike() { 134 onPressLikeOrDislike() {
130 - if (this.props.subject.inLikeAction) { 135 + let item = this.props.subject.items.get(this.sid);
  136 + if (item.inLikeAction) {
131 return; 137 return;
132 } 138 }
133 - if (this.props.subject.hasPraise == 'Y') {  
134 - this.props.actions.subjectUnlike(this.props.subject.id); 139 + if (item.hasPraise == 'Y') {
  140 + this.props.actions.subjectUnlike(this.sid,item.id);
135 }else if(this.props.subject.hasPraise == 'N'){ 141 }else if(this.props.subject.hasPraise == 'N'){
136 - this.props.actions.subjectLike(this.props.subject.id); 142 + this.props.actions.subjectLike(this.sid,item.id);
137 } 143 }
138 } 144 }
139 145
@@ -142,34 +148,35 @@ class SubjectPostContainer extends Component { @@ -142,34 +148,35 @@ class SubjectPostContainer extends Component {
142 } 148 }
143 149
144 render() { 150 render() {
145 - let {headIcon,nickName,uid} = this.props.subject.authorInfo;  
146 - let timeagoStr = timeago().format(this.props.subject.createTime, 'zh_CN'); 151 + let item = this.props.subject.items.get(this.sid);
  152 + let {headIcon,nickName,uid} = item.authorInfo;
  153 + let timeagoStr = timeago().format(item.createTime, 'zh_CN');
147 let header = { 154 let header = {
148 uid, 155 uid,
149 headIcon, 156 headIcon,
150 nickName, 157 nickName,
151 - forumCode: this.props.subject.forumCode,  
152 - forumName: this.props.subject.forumName, 158 + forumCode: item.forumCode,
  159 + forumName: item.forumName,
153 timeago: timeagoStr, 160 timeago: timeagoStr,
154 - LZ: this.props.subject.LZ, 161 + LZ: item.LZ,
155 } 162 }
156 let likeData = { 163 let likeData = {
157 - praiseUsers: this.props.subject.praiseUsers.toJS(),  
158 - praise: this.props.subject.praise,  
159 - browse: this.props.subject.browse,  
160 - postId: this.props.subject.id, 164 + praiseUsers: item.praiseUsers.toJS(),
  165 + praise: item.praise,
  166 + browse: item.browse,
  167 + postId: item.id,
161 } 168 }
162 let shareGoods = []; 169 let shareGoods = [];
163 - if (this.props.subject.shareGoods.productName.length) {  
164 - shareGoods.push(this.props.subject.shareGoods); 170 + if (item.shareGoods.productName.length) {
  171 + shareGoods.push(item.shareGoods);
165 } 172 }
166 let dataBlob = { 173 let dataBlob = {
167 header : [header], 174 header : [header],
168 - title: [this.props.subject.postsTitle],  
169 - content: [this.props.subject.blocks.toJS()], 175 + title: [item.postsTitle],
  176 + content: [item.blocks.toJS()],
170 shareGoods, 177 shareGoods,
171 like: [likeData], 178 like: [likeData],
172 - comments: this.props.subject.commentList.toJS(), 179 + comments: item.commentList.toJS(),
173 }; 180 };
174 181
175 return ( 182 return (
@@ -177,21 +184,21 @@ class SubjectPostContainer extends Component { @@ -177,21 +184,21 @@ class SubjectPostContainer extends Component {
177 <SubjectPost 184 <SubjectPost
178 dataBlob={dataBlob} 185 dataBlob={dataBlob}
179 onEndReached={this.onEndReached} 186 onEndReached={this.onEndReached}
180 - endReached={this.props.subject.currentPage>=this.props.subject.totalPages}  
181 - isFetching={this.props.subject.isCommentsFetching} 187 + endReached={item.currentPage>=item.totalPages}
  188 + isFetching={item.isCommentsFetching}
182 assetsSelected={this.assetsSelected} 189 assetsSelected={this.assetsSelected}
183 - assets={this.props.subject.assets.toJS()}  
184 - commentCount={this.props.subject.commentCount} 190 + assets={item.assets.toJS()}
  191 + commentCount={item.commentCount}
185 commentWithParams={this.commentWithParams} 192 commentWithParams={this.commentWithParams}
186 - postId={this.props.subject.id} 193 + postId={item.id}
187 cidFrom={this.props.user.profile.uid} 194 cidFrom={this.props.user.profile.uid}
188 - authorUid={this.props.subject.authorInfo.uid} 195 + authorUid={item.authorInfo.uid}
189 onPressAvatar={this.onPressAvatar} 196 onPressAvatar={this.onPressAvatar}
190 onPressSection={this.onPressSection} 197 onPressSection={this.onPressSection}
191 onPressReportOrDelete={this.onPressReportOrDelete} 198 onPressReportOrDelete={this.onPressReportOrDelete}
192 onPressLikeCell={this.onPressLikeCell} 199 onPressLikeCell={this.onPressLikeCell}
193 onPressLikeOrDislike={this.onPressLikeOrDislike} 200 onPressLikeOrDislike={this.onPressLikeOrDislike}
194 - likeState={this.props.subject.hasPraise} 201 + likeState={item.hasPraise}
195 onPressShareGoods={this.onPressShareGoods} 202 onPressShareGoods={this.onPressShareGoods}
196 onPressLargeImage={this.onPressLargeImage} 203 onPressLargeImage={this.onPressLargeImage}
197 /> 204 />
@@ -319,17 +319,17 @@ function parseBNS(json) { @@ -319,17 +319,17 @@ function parseBNS(json) {
319 }, 319 },
320 hot: { 320 hot: {
321 avatar: hotAvatar, 321 avatar: hotAvatar,
322 - content: hotPost && hotPost.contentData ? decodeURI(hotPost.contentData) : '', 322 + content: hotPost && hotPost.contentData ? hotPost.contentData : '',
323 hasImg: hotPost && hotPost.hasImgFlg ? hotPost.hasImgFlg : '', 323 hasImg: hotPost && hotPost.hasImgFlg ? hotPost.hasImgFlg : '',
324 postId: hotPost && hotPost.postId ? hotPost.postId : '', 324 postId: hotPost && hotPost.postId ? hotPost.postId : '',
325 - postTitle: hotPost && hotPost.postsTitle ? decodeURI(hotPost.postsTitle) : '', 325 + postTitle: hotPost && hotPost.postsTitle ? hotPost.postsTitle : '',
326 }, 326 },
327 new: { 327 new: {
328 avatar: newAvatar, 328 avatar: newAvatar,
329 - content: newPost && newPost.contentData ? decodeURI(newPost.contentData) : '', 329 + content: newPost && newPost.contentData ? newPost.contentData : '',
330 hasImg: newPost && newPost.hasImgFlg ? newPost.hasImgFlg : '', 330 hasImg: newPost && newPost.hasImgFlg ? newPost.hasImgFlg : '',
331 postId: newPost && newPost.postId ? newPost.postId : '', 331 postId: newPost && newPost.postId ? newPost.postId : '',
332 - postTitle: newPost && newPost.postsTitle ? decodeURI(newPost.postsTitle) : '', 332 + postTitle: newPost && newPost.postsTitle ? newPost.postsTitle : '',
333 }, 333 },
334 num: { 334 num: {
335 onedayAddNum: item.oneDayAddNum, 335 onedayAddNum: item.oneDayAddNum,
@@ -363,7 +363,7 @@ function parseRecommendation(json) { @@ -363,7 +363,7 @@ function parseRecommendation(json) {
363 blocks && blocks.map((item, i) => { 363 blocks && blocks.map((item, i) => {
364 let contentData = item.contentData ? item.contentData : ''; 364 let contentData = item.contentData ? item.contentData : '';
365 if (desc === '' && item.templateKey === 'text') { 365 if (desc === '' && item.templateKey === 'text') {
366 - desc = decodeURI(contentData); 366 + desc = contentData;
367 } 367 }
368 368
369 if (item.templateKey === 'image') { 369 if (item.templateKey === 'image') {
@@ -380,7 +380,7 @@ function parseRecommendation(json) { @@ -380,7 +380,7 @@ function parseRecommendation(json) {
380 let createTime = item.createTime; 380 let createTime = item.createTime;
381 let timeagoStr = timeago(createTime); 381 let timeagoStr = timeago(createTime);
382 let isLike = item.hasPraise === 'Y' ? true : false; 382 let isLike = item.hasPraise === 'Y' ? true : false;
383 - let title = item.postsTitle ? decodeURI(item.postsTitle) : ''; 383 + let title = item.postsTitle ? item.postsTitle : '';
384 if (title === '') { 384 if (title === '') {
385 title = desc; 385 title = desc;
386 desc = ''; 386 desc = '';
@@ -192,10 +192,10 @@ export function updateUploadState(url,fileName) { @@ -192,10 +192,10 @@ export function updateUploadState(url,fileName) {
192 sizeStr += assets[i].width + 'x' + assets[i].height +','; 192 sizeStr += assets[i].width + 'x' + assets[i].height +',';
193 } 193 }
194 let param = { 194 let param = {
195 - postsTitle: encodeURI(posting.title), 195 + postsTitle: posting.title,
196 uid: ssouid, 196 uid: ssouid,
197 forumCode: posting.currentBoardId, 197 forumCode: posting.currentBoardId,
198 - contentData: encodeURI(posting.content), 198 + contentData: posting.content,
199 images: imageStr, 199 images: imageStr,
200 sizes: sizeStr, 200 sizes: sizeStr,
201 } 201 }
@@ -291,7 +291,7 @@ function parseNewPost(json) { @@ -291,7 +291,7 @@ function parseNewPost(json) {
291 blocks && blocks.map((item, i) => { 291 blocks && blocks.map((item, i) => {
292 let contentData = item.contentData ? item.contentData : ''; 292 let contentData = item.contentData ? item.contentData : '';
293 if (desc === '' && item.templateKey === 'text') { 293 if (desc === '' && item.templateKey === 'text') {
294 - desc = decodeURI(contentData); 294 + desc = contentData;
295 } 295 }
296 296
297 if (item.templateKey === 'image') { 297 if (item.templateKey === 'image') {
@@ -308,7 +308,7 @@ function parseNewPost(json) { @@ -308,7 +308,7 @@ function parseNewPost(json) {
308 let createTime = item.createTime; 308 let createTime = item.createTime;
309 let timeagoStr = timeago(createTime); 309 let timeagoStr = timeago(createTime);
310 let isLike = item.hasPraise === 'Y' ? true : false; 310 let isLike = item.hasPraise === 'Y' ? true : false;
311 - let title = item.postsTitle ? decodeURI(item.postsTitle) : ''; 311 + let title = item.postsTitle ? item.postsTitle : '';
312 if (title === '') { 312 if (title === '') {
313 title = desc; 313 title = desc;
314 desc = ''; 314 desc = '';
@@ -46,16 +46,16 @@ export function goToLikeList(postId, likeCount) { @@ -46,16 +46,16 @@ export function goToLikeList(postId, likeCount) {
46 }; 46 };
47 } 47 }
48 48
49 -export function subjectLikeRequest(json) { 49 +export function subjectLikeRequest(sid,json) {
50 return { 50 return {
51 type: SUBJECT_LIKE_REQUEST, 51 type: SUBJECT_LIKE_REQUEST,
52 - payload: json 52 + payload: {sid,json}
53 }; 53 };
54 } 54 }
55 55
56 -export function subjectLike(postId) { 56 +export function subjectLike(sid,postId) {
57 return (dispatch, getState) => { 57 return (dispatch, getState) => {
58 - dispatch(subjectLikeRequest(postId)); 58 + dispatch(subjectLikeRequest(sid,postId));
59 let {user} = getState(); 59 let {user} = getState();
60 return new HomeService().postLike(postId, user.profile.uid) 60 return new HomeService().postLike(postId, user.profile.uid)
61 .then(json => { 61 .then(json => {
@@ -70,16 +70,16 @@ export function subjectLike(postId) { @@ -70,16 +70,16 @@ export function subjectLike(postId) {
70 }; 70 };
71 } 71 }
72 72
73 -export function subjectUnlikeRequest(json) { 73 +export function subjectUnlikeRequest(sid,json) {
74 return { 74 return {
75 type: SUBJECT_UNLIKE_REQUEST, 75 type: SUBJECT_UNLIKE_REQUEST,
76 - payload: json 76 + payload: {sid,json}
77 }; 77 };
78 } 78 }
79 79
80 -export function subjectUnlike(postId) { 80 +export function subjectUnlike(sid,postId) {
81 return (dispatch, getState) => { 81 return (dispatch, getState) => {
82 - dispatch(subjectUnlikeRequest(postId)); 82 + dispatch(subjectUnlikeRequest(sid,postId));
83 let {user} = getState(); 83 let {user} = getState();
84 return new HomeService().postUnlike(postId, user.profile.uid) 84 return new HomeService().postUnlike(postId, user.profile.uid)
85 .then(json => { 85 .then(json => {
@@ -95,11 +95,12 @@ export function subjectUnlike(postId) { @@ -95,11 +95,12 @@ export function subjectUnlike(postId) {
95 } 95 }
96 96
97 97
98 -export function onRightPressed() { 98 +export function onRightPressed(sid) {
99 return (dispatch, getState) => { 99 return (dispatch, getState) => {
100 - dispatch(onRight()); 100 + dispatch(onRight(sid));
101 let {subject} = getState(); 101 let {subject} = getState();
102 - if (subject.LZ && !subject.revieweState) { 102 + let item = subject.items.get(sid);
  103 + if (item.LZ && !item.revieweState) {
103 const BUTTONS = ['删除','取消']; 104 const BUTTONS = ['删除','取消'];
104 ActionSheetIOS.showActionSheetWithOptions({ 105 ActionSheetIOS.showActionSheetWithOptions({
105 options: BUTTONS, 106 options: BUTTONS,
@@ -108,17 +109,18 @@ export function onRightPressed() { @@ -108,17 +109,18 @@ export function onRightPressed() {
108 109
109 (buttonIndex) => { 110 (buttonIndex) => {
110 if (buttonIndex == 0) { 111 if (buttonIndex == 0) {
111 - dispatch(doDelete(subject.id)); 112 + dispatch(doDelete(sid,item.id));
112 } 113 }
113 }); 114 });
114 } else { 115 } else {
115 let params = { 116 let params = {
116 - postsId: subject.id, 117 + postsId: item.id,
117 appType: 1, 118 appType: 1,
118 } 119 }
119 new PostingService().getShareUrl(params).then(json => { 120 new PostingService().getShareUrl(params).then(json => {
120 let {subject} = getState(); 121 let {subject} = getState();
121 - let blockAry = subject.blocks.toJS(); 122 + let item = subject.items.get(sid);
  123 + let blockAry = item.blocks.toJS();
122 let content = ''; 124 let content = '';
123 for (var i = 0; i < blockAry.length; i++) { 125 for (var i = 0; i < blockAry.length; i++) {
124 if (blockAry[i].templateKey == 'text') { 126 if (blockAry[i].templateKey == 'text') {
@@ -149,10 +151,8 @@ export function onRightPressed() { @@ -149,10 +151,8 @@ export function onRightPressed() {
149 'picUrl':newSrc, 151 'picUrl':newSrc,
150 linkUrl: json.shareUrl, 152 linkUrl: json.shareUrl,
151 } 153 }
152 - console.log(shareInfo);  
153 - dispatch(doShare(shareInfo)); 154 + dispatch(doShare(sid,shareInfo));
154 }).catch(error => { 155 }).catch(error => {
155 - console.log(error);  
156 Alert.alert('提示','获取分享信息失败'); 156 Alert.alert('提示','获取分享信息失败');
157 }) 157 })
158 158
@@ -160,23 +160,25 @@ export function onRightPressed() { @@ -160,23 +160,25 @@ export function onRightPressed() {
160 } 160 }
161 } 161 }
162 162
163 -export function onRight() { 163 +export function onRight(sid) {
164 return { 164 return {
165 - type:'SUBJECT_DO_NOTHING' 165 + type:'SUBJECT_DO_NOTHING',
  166 + payload:sid,
166 } 167 }
167 } 168 }
168 169
169 -export function doShare(shareInfo) { 170 +export function doShare(sid,shareInfo) {
170 171
171 console.log(shareInfo); 172 console.log(shareInfo);
172 NativeModules.YH_CommunityHelper.showShare(shareInfo); 173 NativeModules.YH_CommunityHelper.showShare(shareInfo);
173 174
174 return { 175 return {
175 - type:'SUBJECT_DO_NOTHING' 176 + type:'SUBJECT_DO_NOTHING',
  177 + payload: sid,
176 } 178 }
177 } 179 }
178 180
179 -export function doDelete(postsId) { 181 +export function doDelete(sid,postsId) {
180 182
181 Alert.alert('提示','是否确认删除?', 183 Alert.alert('提示','是否确认删除?',
182 [{text:'否'}, 184 [{text:'否'},
@@ -192,11 +194,12 @@ export function doDelete(postsId) { @@ -192,11 +194,12 @@ export function doDelete(postsId) {
192 }}]); 194 }}]);
193 console.log('deleted.............'); 195 console.log('deleted.............');
194 return { 196 return {
195 - type:'SUBJECT_DO_NOTHING' 197 + type:'SUBJECT_DO_NOTHING',
  198 + payload:sid,
196 } 199 }
197 } 200 }
198 201
199 -export function doReport(params) { 202 +export function doReport(sid, params) {
200 new PostingService().reportPost(params).then(json => { 203 new PostingService().reportPost(params).then(json => {
201 Alert.alert('提示','举报成功'); 204 Alert.alert('提示','举报成功');
202 }).catch(error => { 205 }).catch(error => {
@@ -204,92 +207,100 @@ export function doReport(params) { @@ -204,92 +207,100 @@ export function doReport(params) {
204 }); 207 });
205 208
206 return { 209 return {
207 - type:'SUBJECT_DO_NOTHING' 210 + type:'SUBJECT_DO_NOTHING',
  211 + payload:sid,
208 } 212 }
209 } 213 }
210 214
211 -export function requestPostContent(postsId) { 215 +export function contentSuccess(sid,json) {
212 return dispatch => { 216 return dispatch => {
213 - dispatch(doRequestContent()); 217 + let rightImg = require('../../images/posting/share.png');
  218 + if (json.LZ&&!json.revieweState) {
  219 + rightImg = require('../../images/posting/more.png');
  220 + }
  221 + Actions.refresh({key: 'SubjectPost', rightButtonImage:rightImg});
  222 +
  223 + let largeImages = [];
  224 + let index=0;
  225 + for (var i = 0; i < json.blocks.length; i++) {
  226 + let item = json.blocks[i];
  227 + if (item.templateKey == 'image') {
  228 + let urlStr = item.contentData||'';
  229 + let imgWidth = 640;
  230 + let imgHeight = imgWidth;
  231 + let sizeStr = item.size || '';
  232 + if (sizeStr.length) {
  233 + let ary=sizeStr.split('x');
  234 + let w = parseInt(ary[0]);
  235 + let h = parseInt(ary[1]);
  236 + if (w&&h) {
  237 + imgHeight = imgWidth/w*h;
  238 + }
  239 + }
  240 + let newSrc = urlStr;
  241 + if (urlStr.indexOf('imageView') === -1) {
  242 + newSrc = urlStr + '?imageView2/' + '1' + '/w/' + imgWidth + '/h/' + imgHeight;
  243 + } else {
  244 + newSrc = urlStr.replace('{mode}', '1')
  245 + .replace('{width}', imgWidth)
  246 + .replace('{height}', imgHeight);
  247 + }
  248 + largeImages.push(newSrc);
  249 + json.blocks[i].index=index;
  250 + index++;
  251 + }
  252 + }
  253 + json.largeImages = largeImages;
  254 + dispatch(contentRequestSuccess(sid,json));
  255 + }
  256 +}
  257 +
  258 +export function requestPostContent(sid,postsId) {
  259 + return dispatch => {
  260 + dispatch(doRequestContent(sid));
214 let params = {postsId}; 261 let params = {postsId};
215 new PostingService().getPostContent(params) 262 new PostingService().getPostContent(params)
216 .then(json => { 263 .then(json => {
217 NativeModules.YH_CommunityHelper.uid() 264 NativeModules.YH_CommunityHelper.uid()
218 .then(uid => { 265 .then(uid => {
219 json.LZ = (uid == json.authorInfo.uid); 266 json.LZ = (uid == json.authorInfo.uid);
220 - let rightImg = require('../../images/posting/share.png');  
221 - if (json.LZ&&!json.revieweState) {  
222 - rightImg = require('../../images/posting/more.png');  
223 - }  
224 - Actions.refresh({key: 'SubjectPost', rightButtonImage:rightImg});  
225 -  
226 - let largeImages = [];  
227 - let index=0;  
228 - for (var i = 0; i < json.blocks.length; i++) {  
229 - let item = json.blocks[i];  
230 - if (item.templateKey == 'image') {  
231 - let urlStr = item.contentData||'';  
232 - let imgWidth = 640;  
233 - let imgHeight = imgWidth;  
234 - let sizeStr = item.size || '';  
235 - if (sizeStr.length) {  
236 - let ary=sizeStr.split('x');  
237 - let w = parseInt(ary[0]);  
238 - let h = parseInt(ary[1]);  
239 - if (w&&h) {  
240 - imgHeight = imgWidth/w*h;  
241 - }  
242 - }  
243 - let newSrc = urlStr;  
244 - if (urlStr.indexOf('imageView') === -1) {  
245 - newSrc = urlStr + '?imageView2/' + '1' + '/w/' + imgWidth + '/h/' + imgHeight;  
246 - } else {  
247 - newSrc = urlStr.replace('{mode}', '1')  
248 - .replace('{width}', imgWidth)  
249 - .replace('{height}', imgHeight);  
250 - }  
251 - largeImages.push(newSrc);  
252 - json.blocks[i].index=index;  
253 - index++;  
254 - }  
255 - }  
256 - json.largeImages = largeImages;  
257 - dispatch(contentRequestSuccess(json)); 267 + dispatch(contentSuccess(sid,json));
258 }) 268 })
259 .catch(error => { 269 .catch(error => {
260 json.LZ = false; 270 json.LZ = false;
261 - dispatch(contentRequestSuccess(json)); 271 + dispatch(contentSuccess(sid,json));
262 }); 272 });
263 }) 273 })
264 .catch(error => { 274 .catch(error => {
265 - dispatch(contentRequestFailure(error)); 275 + dispatch(contentRequestFailure(sid,error));
266 }); 276 });
267 } 277 }
268 } 278 }
269 279
270 -export function doRequestContent() { 280 +export function doRequestContent(sid) {
271 return { 281 return {
272 type: SUBJECT_CONTENT_REQUEST, 282 type: SUBJECT_CONTENT_REQUEST,
  283 + payload: sid,
273 } 284 }
274 } 285 }
275 286
276 -export function contentRequestSuccess(json) { 287 +export function contentRequestSuccess(sid,json) {
277 return { 288 return {
278 type: SUBJECT_CONTENT_SUCCESS, 289 type: SUBJECT_CONTENT_SUCCESS,
279 - payload: json, 290 + payload: {sid,json},
280 } 291 }
281 } 292 }
282 293
283 -export function contentRequestFailure(error) { 294 +export function contentRequestFailure(sid,error) {
284 return { 295 return {
285 type: SUBJECT_CONTENT_FAILURE, 296 type: SUBJECT_CONTENT_FAILURE,
286 - payload: error, 297 + payload: {sid,error},
287 } 298 }
288 } 299 }
289 300
290 -export function requestPostComments(postsId, lastedTime) { 301 +export function requestPostComments(sid, postsId, lastedTime) {
291 return dispatch => { 302 return dispatch => {
292 - dispatch(doRequestComments()); 303 + dispatch(doRequestComments(sid));
293 let params = { 304 let params = {
294 postsId, 305 postsId,
295 lastedTime, 306 lastedTime,
@@ -297,22 +308,23 @@ export function requestPostComments(postsId, lastedTime) { @@ -297,22 +308,23 @@ export function requestPostComments(postsId, lastedTime) {
297 }; 308 };
298 new PostingService().getPostComments(params) 309 new PostingService().getPostComments(params)
299 .then(json => { 310 .then(json => {
300 - dispatch(commentsRequestSuccess(json)); 311 + dispatch(commentsRequestSuccess(sid,json));
301 312
302 }) 313 })
303 .catch(error => { 314 .catch(error => {
304 - dispatch(commentsRequestFailure(error)); 315 + dispatch(commentsRequestFailure(sid,error));
305 }); 316 });
306 } 317 }
307 } 318 }
308 319
309 -export function doRequestComments() { 320 +export function doRequestComments(sid) {
310 return { 321 return {
311 type: SUBJECT_COMMENTS_REQUEST, 322 type: SUBJECT_COMMENTS_REQUEST,
  323 + payload: sid,
312 } 324 }
313 } 325 }
314 326
315 -export function commentsRequestSuccess(json) { 327 +export function commentsRequestSuccess(sid,json) {
316 let {list} = json; 328 let {list} = json;
317 let newList = []; 329 let newList = [];
318 list && list.map((obj,i)=> { 330 list && list.map((obj,i)=> {
@@ -348,82 +360,87 @@ export function commentsRequestSuccess(json) { @@ -348,82 +360,87 @@ export function commentsRequestSuccess(json) {
348 json.list = newList; 360 json.list = newList;
349 return { 361 return {
350 type: SUBJECT_COMMENTS_SUCCESS, 362 type: SUBJECT_COMMENTS_SUCCESS,
351 - payload: json, 363 + payload: {sid,json},
352 } 364 }
353 } 365 }
354 366
355 -export function commentsRequestFailure(error) { 367 +export function commentsRequestFailure(sid,error) {
356 return { 368 return {
357 type: SUBJECT_COMMENTS_FAILURE, 369 type: SUBJECT_COMMENTS_FAILURE,
358 - payload: error, 370 + payload: {sid,error},
359 } 371 }
360 } 372 }
361 373
362 -export function assetsSelected(assets) { 374 +export function assetsSelected(sid,assets) {
363 return { 375 return {
364 type: SUBJECT_ASSETS_SELECTED, 376 type: SUBJECT_ASSETS_SELECTED,
365 - payload: assets, 377 + payload: {sid,assets},
366 } 378 }
367 } 379 }
368 380
369 -export function commentWithParams(params) { 381 +export function commentWithParams(sid,params) {
370 return (dispatch, getState) => { 382 return (dispatch, getState) => {
371 - dispatch(startComment()); 383 + dispatch(startComment(sid));
372 let {subject} = getState(); 384 let {subject} = getState();
373 - let assets = subject.assets.toJS(); 385 + let item = subject.items.get(sid);
  386 + let assets = item.assets.toJS();
374 if (assets.length) { 387 if (assets.length) {
375 for (let i = 0; i < assets.length; i++) { 388 for (let i = 0; i < assets.length; i++) {
376 let asset = assets[i] 389 let asset = assets[i]
377 390
378 new PostingService().uploadImageAsset(asset) 391 new PostingService().uploadImageAsset(asset)
379 .then(response => { 392 .then(response => {
380 - dispatch(updateCommentProgress(response, params)); 393 + dispatch(updateCommentProgress(sid,response, params));
381 }).catch(error => { 394 }).catch(error => {
382 - dispatch(commentFail(error)); 395 + dispatch(commentFail(sid,error));
383 }); 396 });
384 } 397 }
385 } else { 398 } else {
386 - dispatch(commitComment(params)); 399 + dispatch(commitComment(sid,params));
387 } 400 }
388 } 401 }
389 } 402 }
390 403
391 -export function startComment() { 404 +export function startComment(sid) {
392 return { 405 return {
393 type: SUBJECT_REPLY_REQUEST, 406 type: SUBJECT_REPLY_REQUEST,
  407 + payload: sid,
394 } 408 }
395 } 409 }
396 410
397 -export function commitComment(params) { 411 +export function commitComment(sid,params) {
398 return dispatch => { 412 return dispatch => {
399 new PostingService().commitReply(params) 413 new PostingService().commitReply(params)
400 .then(response => { 414 .then(response => {
401 - dispatch(commentSuccess(response)); 415 + dispatch(commentSuccess(sid,response));
402 }).catch(error => { 416 }).catch(error => {
403 - dispatch(commentFail(error)); 417 + dispatch(commentFail(sid,error));
404 }); 418 });
405 } 419 }
406 } 420 }
407 421
408 -export function updateCommentProgress(url, params) { 422 +export function updateCommentProgress(sid, url, params) {
409 return (dispatch, getState) => { 423 return (dispatch, getState) => {
410 let {subject} = getState(); 424 let {subject} = getState();
411 - let {assetsUrlStr, assetFinishCount} = subject; 425 + let item = subject.items.get(sid);
  426 + let {assetsUrlStr, assetFinishCount} = item;
412 let newStr = assetsUrlStr + url + ','; 427 let newStr = assetsUrlStr + url + ',';
413 let newCount = assetFinishCount + 1; 428 let newCount = assetFinishCount + 1;
414 let payloadData = { 429 let payloadData = {
  430 + sid,
415 newStr, 431 newStr,
416 newCount, 432 newCount,
417 }; 433 };
418 dispatch(commentImageStateChanged(payloadData)); 434 dispatch(commentImageStateChanged(payloadData));
419 dispatch(() => { 435 dispatch(() => {
420 let {subject} = getState(); 436 let {subject} = getState();
421 - if (subject.assetFinishCount == subject.assets.toJS().length) { 437 + let item = subject.items.get(sid);
  438 + if (item.assetFinishCount == item.assets.toJS().length) {
422 let newParams = { 439 let newParams = {
423 ...params, 440 ...params,
424 - images: subject.assetsUrlStr, 441 + images: item.assetsUrlStr,
425 } 442 }
426 - dispatch(commitComment(newParams)); 443 + dispatch(commitComment(sid,newParams));
427 } 444 }
428 }); 445 });
429 } 446 }
@@ -436,16 +453,16 @@ export function commentImageStateChanged(payloadData) { @@ -436,16 +453,16 @@ export function commentImageStateChanged(payloadData) {
436 } 453 }
437 } 454 }
438 455
439 -export function commentSuccess(json) { 456 +export function commentSuccess(sid,json) {
440 return { 457 return {
441 type: SUBJECT_REPLY_SUCCESS, 458 type: SUBJECT_REPLY_SUCCESS,
442 - payload: json, 459 + payload: {sid, json},
443 } 460 }
444 } 461 }
445 462
446 -export function commentFail (error) { 463 +export function commentFail (sid,error) {
447 return { 464 return {
448 - type: SUBJECT_COMMENTS_FAILURE,  
449 - payload: error, 465 + type: SUBJECT_REPLY_FAILURE,
  466 + payload: {sid,error},
450 } 467 }
451 } 468 }
@@ -9,8 +9,7 @@ @@ -9,8 +9,7 @@
9 */ 9 */
10 import Immutable, {List, Record} from 'immutable'; 10 import Immutable, {List, Record} from 'immutable';
11 11
12 -let InitialState = Record({  
13 - 12 +let item = new (Record({
14 isContentFetching: false, 13 isContentFetching: false,
15 contentError: null, 14 contentError: null,
16 isCommentsFetching: false, 15 isCommentsFetching: false,
@@ -21,7 +20,7 @@ let InitialState = Record({ @@ -21,7 +20,7 @@ let InitialState = Record({
21 nickName: '', 20 nickName: '',
22 uid: 0, 21 uid: 0,
23 url: '' 22 url: ''
24 - })), 23 + })),
25 blocks: List(),// contentData order templateKey 24 blocks: List(),// contentData order templateKey
26 browse: 0, 25 browse: 0,
27 createTime: 0, 26 createTime: 0,
@@ -59,6 +58,12 @@ let InitialState = Record({ @@ -59,6 +58,12 @@ let InitialState = Record({
59 58
60 inLikeAction: false, 59 inLikeAction: false,
61 largeImages:[], 60 largeImages:[],
  61 +}));
  62 +
  63 +let InitialState = Record({
  64 + sid: -1,
  65 + items: List(),
  66 + item: item,
62 }); 67 });
63 68
64 export default InitialState; 69 export default InitialState;
@@ -49,15 +49,29 @@ export default function postingReducer(state = initialState, action) { @@ -49,15 +49,29 @@ export default function postingReducer(state = initialState, action) {
49 49
50 switch (action.type) { 50 switch (action.type) {
51 case GO_TO_POST: { 51 case GO_TO_POST: {
52 - return state.set('id', action.payload); 52 + let sid = state.sid + 1;
  53 + // 获取新的初始状态item
  54 + let item = initialState.item;
  55 + // 设置item的value
  56 + item = item.set('id', action.payload);
  57 + // items新增item
  58 + let newItems = state.items.push(item);
  59 + let nextState = state.set('sid', sid)
  60 + .set('items', newItems);
  61 + return nextState;
  62 + // return state.set('id', action.payload);
53 } 63 }
54 64
55 case SUBJECT_CONTENT_REQUEST: { 65 case SUBJECT_CONTENT_REQUEST: {
56 - let nextState = state.set('isContentFetching', true).set('contentError', null); 66 + let sid = action.payload;
  67 + let item = state.items.get(sid);
  68 + item = item.set('isContentFetching', true).set('contentError', null);
  69 + let nextState = state.setIn(['items', sid], item);
57 return nextState; 70 return nextState;
58 } 71 }
59 break; 72 break;
60 case SUBJECT_CONTENT_SUCCESS:{ 73 case SUBJECT_CONTENT_SUCCESS:{
  74 + let {sid,json} = action.payload;
61 75
62 let { 76 let {
63 authorInfo, 77 authorInfo,
@@ -80,8 +94,9 @@ export default function postingReducer(state = initialState, action) { @@ -80,8 +94,9 @@ export default function postingReducer(state = initialState, action) {
80 hasPraise, 94 hasPraise,
81 largeImages, 95 largeImages,
82 LZ, 96 LZ,
83 - } = action.payload;  
84 - let nextState = state.setIn(['authorInfo','headIcon'],authorInfo.headIcon||'') 97 + } = json;
  98 + let item = state.items.get(sid);
  99 + item = item.setIn(['authorInfo','headIcon'],authorInfo.headIcon||'')
85 .setIn(['authorInfo','nickName'],authorInfo.nickName||'') 100 .setIn(['authorInfo','nickName'],authorInfo.nickName||'')
86 .setIn(['authorInfo','uid'],authorInfo.uid||'') 101 .setIn(['authorInfo','uid'],authorInfo.uid||'')
87 .setIn(['authorInfo','url'],authorInfo.url||'') 102 .setIn(['authorInfo','url'],authorInfo.url||'')
@@ -94,7 +109,7 @@ export default function postingReducer(state = initialState, action) { @@ -94,7 +109,7 @@ export default function postingReducer(state = initialState, action) {
94 .set('isForumTop',isForumTop) 109 .set('isForumTop',isForumTop)
95 .set('isHot',isHot) 110 .set('isHot',isHot)
96 .set('isIndexTop',isIndexTop) 111 .set('isIndexTop',isIndexTop)
97 - .set('postsTitle',decodeURI(postsTitle)) 112 + .set('postsTitle',postsTitle)
98 .set('praise',praise) 113 .set('praise',praise)
99 .set('praiseUsers',Immutable.fromJS(praiseUsers)) 114 .set('praiseUsers',Immutable.fromJS(praiseUsers))
100 .set('publishTimeString',publishTimeString) 115 .set('publishTimeString',publishTimeString)
@@ -106,81 +121,119 @@ export default function postingReducer(state = initialState, action) { @@ -106,81 +121,119 @@ export default function postingReducer(state = initialState, action) {
106 .set('largeImages',largeImages) 121 .set('largeImages',largeImages)
107 .set('hasPraise',hasPraise||'N'); 122 .set('hasPraise',hasPraise||'N');
108 if (shareGoods) { 123 if (shareGoods) {
109 - nextState.setIn(['shareGoods','productName'],shareGoods.productName||'') 124 + item.setIn(['shareGoods','productName'],shareGoods.productName||'')
110 .setIn(['shareGoods','productUrl'],shareGoods.productUrl||'') 125 .setIn(['shareGoods','productUrl'],shareGoods.productUrl||'')
111 .setIn(['shareGoods','salesPrice'],shareGoods.salesPrice||'') 126 .setIn(['shareGoods','salesPrice'],shareGoods.salesPrice||'')
112 .setIn(['shareGoods','goodsImage'],shareGoods.goodsImage||'') 127 .setIn(['shareGoods','goodsImage'],shareGoods.goodsImage||'')
113 } 128 }
  129 + let nextState = state.setIn(['items', sid], item);
114 return nextState; 130 return nextState;
115 } 131 }
116 break; 132 break;
117 case SUBJECT_CONTENT_FAILURE: { 133 case SUBJECT_CONTENT_FAILURE: {
118 - let nextState = state.set('isContentFetching', false).set('contentError', action.payload); 134 +
  135 + let {sid,error} = action.payload;
  136 + let item = state.items.get(sid);
  137 + item = item.set('isContentFetching', false).set('contentError', error);
  138 + let nextState = state.setIn(['items', sid], item);
119 return nextState; 139 return nextState;
120 } 140 }
121 break; 141 break;
122 case SUBJECT_COMMENTS_SUCCESS:{ 142 case SUBJECT_COMMENTS_SUCCESS:{
123 - let {lastedTime, total, list, pageSize} = action.payload; 143 +
  144 + let {sid,json} = action.payload;
  145 + let item = state.items.get(sid);
  146 + let {lastedTime, total, list, pageSize} = json;
124 let tailCount = (total%pageSize)>0?1:0; 147 let tailCount = (total%pageSize)>0?1:0;
125 let totalPages = total/pageSize + tailCount; 148 let totalPages = total/pageSize + tailCount;
126 149
127 - let existedAry = state.commentList.toJS(); 150 + let existedAry = item.commentList.toJS();
128 let nextData = [...existedAry,...list]; 151 let nextData = [...existedAry,...list];
129 - let page = state.currentPage; 152 + let page = item.currentPage;
130 page++; 153 page++;
131 - let nextState = state.set('commentList',Immutable.fromJS(nextData)) 154 + item = item.set('commentList',Immutable.fromJS(nextData))
132 .set('lastedTime',lastedTime) 155 .set('lastedTime',lastedTime)
133 .set('totalPages',totalPages) 156 .set('totalPages',totalPages)
134 .set('currentPage',page) 157 .set('currentPage',page)
135 .set('commentCount',total); 158 .set('commentCount',total);
  159 + let nextState = state.setIn(['items', sid], item);
136 return nextState; 160 return nextState;
137 } 161 }
138 break; 162 break;
139 case SUBJECT_COMMENTS_REQUEST:{ 163 case SUBJECT_COMMENTS_REQUEST:{
140 - let nextState = state.set('isCommentsFetching', true).set('commentsError', null); 164 +
  165 + let sid = action.payload;
  166 + let item = state.items.get(sid);
  167 + item = item.set('isCommentsFetching', true).set('commentsError', null);
  168 + let nextState = state.setIn(['items', sid], item);
141 return nextState; 169 return nextState;
142 } 170 }
143 break; 171 break;
144 case SUBJECT_COMMENTS_FAILURE: 172 case SUBJECT_COMMENTS_FAILURE:
145 - let nextState = state.set('isCommentsFetching', false).set('commentsError', action.payload); 173 + let {sid,error} = action.payload;
  174 + let item = state.items.get(sid);
  175 + item = item.set('isCommentsFetching', false).set('commentsError', error);
  176 + let nextState = state.setIn(['items', sid], item);
146 return nextState; 177 return nextState;
147 break; 178 break;
148 case SUBJECT_ASSETS_SELECTED: { 179 case SUBJECT_ASSETS_SELECTED: {
149 - let data = action.payload||[];  
150 - let nextState = state.set('assets',Immutable.fromJS(data)); 180 + let {sid,assets} = action.payload;
  181 + let data = assets||[];
  182 + let item = state.items.get(sid);
  183 + item = item.set('assets',Immutable.fromJS(data));
  184 + let nextState = state.setIn(['items', sid], item);
151 return nextState; 185 return nextState;
152 } 186 }
153 break; 187 break;
154 case SUBJECT_REPLY_REQUEST: { 188 case SUBJECT_REPLY_REQUEST: {
155 - let nextState = state.set('isReplying',true).set('replyError',null); 189 + let sid = action.payload;
  190 + let item = state.items.get(sid);
  191 + item = item.set('isReplying',true).set('replyError',null);
  192 + let nextState = state.setIn(['items', sid], item);
156 return nextState; 193 return nextState;
157 } 194 }
158 break; 195 break;
159 case SUBJECT_REPLY_SUCCESS:{ 196 case SUBJECT_REPLY_SUCCESS:{
160 - let nextState = state.set('assets',Immutable.fromJS([])) 197 + let {sid, json} = action.payload;
  198 + let item = state.items.get(sid);
  199 + item = item.set('assets',Immutable.fromJS([]))
161 .set('assetsUrlStr','') 200 .set('assetsUrlStr','')
162 .set('assetFinishCount',0) 201 .set('assetFinishCount',0)
163 .set('isReplying',false) 202 .set('isReplying',false)
164 - .set('replyError',error) 203 + .set('replyError',error);
  204 + let nextState = state.setIn(['items', sid], item);
165 return nextState; 205 return nextState;
166 } 206 }
167 break; 207 break;
168 case SUBJECT_REPLY_FAILURE: { 208 case SUBJECT_REPLY_FAILURE: {
169 - let nextState = state.set('isReplying',false).set('replyError',action.payload); 209 + let {sid,error} = action.payload;
  210 + let item = state.items.get(sid);
  211 + item = item.set('isReplying',false).set('replyError',action.payload);
  212 + let nextState = state.setIn(['items', sid], item);
170 return nextState; 213 return nextState;
171 } 214 }
172 break; 215 break;
173 case SUBJECT_REPLY_UPDATE: { 216 case SUBJECT_REPLY_UPDATE: {
174 - let {newStr,newCount} = action.payload;  
175 - let nextState = state.set('assetsUrlStr',newStr).set('assetFinishCount',newCount); 217 + let {sid, newStr,newCount} = action.payload;
  218 + let item = state.items.get(sid);
  219 + item = item.set('assetsUrlStr',newStr).set('assetFinishCount',newCount);
  220 + let nextState = state.setIn(['items', sid], item);
176 return nextState; 221 return nextState;
177 } 222 }
178 case SUBJECT_LIKE_REQUEST: { 223 case SUBJECT_LIKE_REQUEST: {
179 - return state.set('hasPraise','Y'); 224 + let {sid,json} = action.payload;
  225 + let item = state.items.get(sid);
  226 + item = item.set('hasPraise','Y');
  227 + let nextState = state.setIn(['items', sid], item);
  228 + return nextState;
180 } 229 }
181 230
182 case SUBJECT_UNLIKE_REQUEST: { 231 case SUBJECT_UNLIKE_REQUEST: {
183 - return state.set('hasPraise','N');; 232 + let {sid,json} = action.payload;
  233 + let item = state.items.get(sid);
  234 + item = item.set('hasPraise','N');
  235 + let nextState = state.setIn(['items', sid], item);
  236 + return nextState;
184 } 237 }
185 break; 238 break;
186 case SUBJECT_DO_NOTHING: 239 case SUBJECT_DO_NOTHING:
@@ -190,7 +243,7 @@ export default function postingReducer(state = initialState, action) { @@ -190,7 +243,7 @@ export default function postingReducer(state = initialState, action) {
190 return state; 243 return state;
191 break; 244 break;
192 default: 245 default:
193 - return initialState; 246 + return state;
194 break; 247 break;
195 } 248 }
196 } 249 }
@@ -633,7 +633,7 @@ function parseJson(json) { @@ -633,7 +633,7 @@ function parseJson(json) {
633 blocks && blocks.map((item, i) => { 633 blocks && blocks.map((item, i) => {
634 let contentData = item.contentData ? item.contentData : ''; 634 let contentData = item.contentData ? item.contentData : '';
635 if (desc === '' && item.templateKey === 'text') { 635 if (desc === '' && item.templateKey === 'text') {
636 - desc = decodeURI(contentData); 636 + desc = contentData;
637 } 637 }
638 638
639 if (item.templateKey === 'image') { 639 if (item.templateKey === 'image') {
@@ -650,7 +650,7 @@ function parseJson(json) { @@ -650,7 +650,7 @@ function parseJson(json) {
650 let createTime = item.createTime; 650 let createTime = item.createTime;
651 let timeagoStr = timeago(createTime); 651 let timeagoStr = timeago(createTime);
652 let isLike = item.hasPraise === 'Y' ? true : false; 652 let isLike = item.hasPraise === 'Y' ? true : false;
653 - let title = item.postsTitle ? decodeURI(item.postsTitle) : ''; 653 + let title = item.postsTitle ? item.postsTitle : '';
654 if (title === '') { 654 if (title === '') {
655 title = desc; 655 title = desc;
656 desc = ''; 656 desc = '';
@@ -701,7 +701,7 @@ function parseReply(json) { @@ -701,7 +701,7 @@ function parseReply(json) {
701 blocks && blocks.map((item, i) => { 701 blocks && blocks.map((item, i) => {
702 let contentData = item.contentData ? item.contentData : ''; 702 let contentData = item.contentData ? item.contentData : '';
703 if (desc === '' && item.templateKey === 'text') { 703 if (desc === '' && item.templateKey === 'text') {
704 - desc = decodeURI(contentData); 704 + desc = contentData;
705 } 705 }
706 706
707 if (item.templateKey === 'image') { 707 if (item.templateKey === 'image') {
@@ -110,7 +110,7 @@ export function userThatNotMePosts(sid) { @@ -110,7 +110,7 @@ export function userThatNotMePosts(sid) {
110 if (!item) { 110 if (!item) {
111 return; 111 return;
112 } 112 }
113 - 113 +
114 if (item.posts.isFetching || item.posts.error) { 114 if (item.posts.isFetching || item.posts.error) {
115 return; 115 return;
116 } 116 }
@@ -170,7 +170,7 @@ function parseUserThatNotMePosts(json) { @@ -170,7 +170,7 @@ function parseUserThatNotMePosts(json) {
170 blocks && blocks.map((item, i) => { 170 blocks && blocks.map((item, i) => {
171 let contentData = item.contentData ? item.contentData : ''; 171 let contentData = item.contentData ? item.contentData : '';
172 if (desc === '' && item.templateKey === 'text') { 172 if (desc === '' && item.templateKey === 'text') {
173 - desc = decodeURI(contentData); 173 + desc = contentData;
174 } 174 }
175 175
176 if (item.templateKey === 'image') { 176 if (item.templateKey === 'image') {
@@ -187,7 +187,7 @@ function parseUserThatNotMePosts(json) { @@ -187,7 +187,7 @@ function parseUserThatNotMePosts(json) {
187 let createTime = item.createTime; 187 let createTime = item.createTime;
188 let timeagoStr = timeago(createTime); 188 let timeagoStr = timeago(createTime);
189 let isLike = item.hasPraise === 'Y' ? true : false; 189 let isLike = item.hasPraise === 'Y' ? true : false;
190 - let title = item.postsTitle ? decodeURI(item.postsTitle) : ''; 190 + let title = item.postsTitle ? item.postsTitle : '';
191 title = title === '' ? desc : title; 191 title = title === '' ? desc : title;
192 let id = item.id ? item.id : 0; 192 let id = item.id ? item.id : 0;
193 193