|
@@ -1,11 +1,11 @@
|
1
|
|
-'use strict';
|
|
1
|
+"use strict";
|
2
|
2
|
|
3
|
3
|
Object.defineProperty(exports, "__esModule", {
|
4
|
4
|
value: true
|
5
|
5
|
});
|
6
|
6
|
exports.RenderText = exports.Editor = undefined;
|
7
|
7
|
|
8
|
|
-var _message2 = require('antd/es/message');
|
|
8
|
+var _message2 = require("antd/es/message");
|
9
|
9
|
|
10
|
10
|
var _message3 = _interopRequireDefault(_message2);
|
11
|
11
|
|
|
@@ -13,57 +13,57 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
|
13
|
13
|
|
14
|
14
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
15
|
15
|
|
16
|
|
-require('antd/es/message/style');
|
|
16
|
+require("antd/es/message/style");
|
17
|
17
|
|
18
|
|
-var _react = require('react');
|
|
18
|
+var _react = require("react");
|
19
|
19
|
|
20
|
20
|
var _react2 = _interopRequireDefault(_react);
|
21
|
21
|
|
22
|
|
-var _propTypes = require('prop-types');
|
|
22
|
+var _propTypes = require("prop-types");
|
23
|
23
|
|
24
|
24
|
var _propTypes2 = _interopRequireDefault(_propTypes);
|
25
|
25
|
|
26
|
|
-var _axios = require('axios');
|
|
26
|
+var _axios = require("axios");
|
27
|
27
|
|
28
|
28
|
var _axios2 = _interopRequireDefault(_axios);
|
29
|
29
|
|
30
|
|
-var _jsCookie = require('js-cookie');
|
|
30
|
+var _jsCookie = require("js-cookie");
|
31
|
31
|
|
32
|
32
|
var _jsCookie2 = _interopRequireDefault(_jsCookie);
|
33
|
33
|
|
34
|
|
-var _reactIntlUniversal = require('react-intl-universal');
|
|
34
|
+var _reactIntlUniversal = require("react-intl-universal");
|
35
|
35
|
|
36
|
36
|
var _reactIntlUniversal2 = _interopRequireDefault(_reactIntlUniversal);
|
37
|
37
|
|
38
|
|
-var _constant = require('./constant');
|
|
38
|
+var _constant = require("./constant");
|
39
|
39
|
|
40
|
|
-var _Comment = require('./Comment');
|
|
40
|
+var _Comment = require("./Comment");
|
41
|
41
|
|
42
|
|
-var _helper = require('./helper');
|
|
42
|
+var _helper = require("./helper");
|
43
|
43
|
|
44
|
|
-var _CommentInput = require('./components/CommentInput');
|
|
44
|
+var _CommentInput = require("./components/CommentInput");
|
45
|
45
|
|
46
|
46
|
var _CommentInput2 = _interopRequireDefault(_CommentInput);
|
47
|
47
|
|
48
|
|
-var _CommentList = require('./components/CommentList');
|
|
48
|
+var _CommentList = require("./components/CommentList");
|
49
|
49
|
|
50
|
50
|
var _CommentList2 = _interopRequireDefault(_CommentList);
|
51
|
51
|
|
52
|
|
-var _Editor = require('./components/Editor');
|
|
52
|
+var _Editor = require("./components/Editor");
|
53
|
53
|
|
54
|
54
|
var _Editor2 = _interopRequireDefault(_Editor);
|
55
|
55
|
|
56
|
|
-var _RenderText = require('./components/RenderText');
|
|
56
|
+var _RenderText = require("./components/RenderText");
|
57
|
57
|
|
58
|
58
|
var _RenderText2 = _interopRequireDefault(_RenderText);
|
59
|
59
|
|
60
|
|
-var _EditComment = require('./components/EditComment/EditComment');
|
|
60
|
+var _EditComment = require("./components/EditComment/EditComment");
|
61
|
61
|
|
62
|
62
|
var _EditComment2 = _interopRequireDefault(_EditComment);
|
63
|
63
|
|
64
|
|
-var _lang = require('./lang');
|
|
64
|
+var _lang = require("./lang");
|
65
|
65
|
|
66
|
|
-require('./App.css');
|
|
66
|
+require("./App.css");
|
67
|
67
|
|
68
|
68
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
69
|
69
|
|
|
@@ -94,13 +94,13 @@ var App = function (_Component) {
|
94
|
94
|
// 是否没有更多评论了
|
95
|
95
|
isNoMoreComment: false,
|
96
|
96
|
initDone: false,
|
97
|
|
- locale: 'zh-CN',
|
|
97
|
+ locale: "zh-CN",
|
98
|
98
|
editModalVisible: false,
|
99
|
|
- action: '',
|
100
|
|
- replyId: '',
|
101
|
|
- commentId: '',
|
102
|
|
- userId: '',
|
103
|
|
- content: '',
|
|
99
|
+ action: "",
|
|
100
|
+ replyId: "",
|
|
101
|
+ commentId: "",
|
|
102
|
+ userId: "",
|
|
103
|
+ content: "",
|
104
|
104
|
replyPage: 1,
|
105
|
105
|
emojiList: []
|
106
|
106
|
};
|
|
@@ -123,16 +123,16 @@ var App = function (_Component) {
|
123
|
123
|
}
|
124
|
124
|
|
125
|
125
|
_createClass(App, [{
|
126
|
|
- key: 'componentWillMount',
|
|
126
|
+ key: "componentWillMount",
|
127
|
127
|
value: function componentWillMount() {
|
128
|
128
|
this.axios = _axios2.default;
|
129
|
129
|
this.axios.defaults.withCredentials = true;
|
130
|
130
|
if (this.props.token) {
|
131
|
|
- this.axios.defaults.headers.common['Authorization'] = 'Bearer ' + this.props.token;
|
|
131
|
+ this.axios.defaults.headers.common["Authorization"] = "Bearer " + this.props.token;
|
132
|
132
|
}
|
133
|
133
|
}
|
134
|
134
|
}, {
|
135
|
|
- key: 'componentDidMount',
|
|
135
|
+ key: "componentDidMount",
|
136
|
136
|
value: function componentDidMount() {
|
137
|
137
|
this.loadLocales();
|
138
|
138
|
this.loadEmoji();
|
|
@@ -145,27 +145,27 @@ var App = function (_Component) {
|
145
|
145
|
*/
|
146
|
146
|
|
147
|
147
|
}, {
|
148
|
|
- key: 'loadLocales',
|
|
148
|
+ key: "loadLocales",
|
149
|
149
|
value: function loadLocales() {
|
150
|
150
|
var _this2 = this;
|
151
|
151
|
|
152
|
152
|
var currentLocale = this.props.locales;
|
153
|
153
|
|
154
|
|
- var cookieLang = _jsCookie2.default.get('lnk_lang');
|
|
154
|
+ var cookieLang = _jsCookie2.default.get("lnk_lang");
|
155
|
155
|
if (!currentLocale) {
|
156
|
156
|
currentLocale = cookieLang || _reactIntlUniversal2.default.determineLocale({
|
157
|
|
- urlLocaleKey: 'lang'
|
|
157
|
+ urlLocaleKey: "lang"
|
158
|
158
|
});
|
159
|
159
|
}
|
160
|
160
|
currentLocale = _lang.SUPPORT_LOCALES.find(function (item) {
|
161
|
161
|
return item.value === currentLocale;
|
162
|
|
- }) ? currentLocale : 'zh-CN';
|
163
|
|
- var version = require('./version.json').hash;
|
|
162
|
+ }) ? currentLocale : "zh-CN";
|
|
163
|
+ var version = require("./version.json").hash;
|
164
|
164
|
// 使用绝对路径
|
165
|
|
- var languageURL = _constant.LANGUAGE_LINK + '/' + currentLocale + '.json?v=' + version;
|
|
165
|
+ var languageURL = _constant.LANGUAGE_LINK + "/" + currentLocale + ".json?v=" + version;
|
166
|
166
|
return fetch(languageURL).then(function (response) {
|
167
|
167
|
if (response.status >= 400) {
|
168
|
|
- throw new Error('Bad response from server');
|
|
168
|
+ throw new Error("Bad response from server");
|
169
|
169
|
}
|
170
|
170
|
return response.json();
|
171
|
171
|
}).then(function (data) {
|
|
@@ -184,21 +184,21 @@ var App = function (_Component) {
|
184
|
184
|
*/
|
185
|
185
|
|
186
|
186
|
}, {
|
187
|
|
- key: 'loadEmoji',
|
|
187
|
+ key: "loadEmoji",
|
188
|
188
|
value: function loadEmoji() {
|
189
|
189
|
var _this3 = this;
|
190
|
190
|
|
191
|
|
- this.axios.get(this.props.emojiAPI + '/emoticons').then(function (response) {
|
|
191
|
+ this.axios.get(this.props.emojiAPI + "/emoticons").then(function (response) {
|
192
|
192
|
var emojiMap = {};
|
193
|
193
|
response.data.list.forEach(function (item) {
|
194
|
194
|
emojiMap[item.name] = item.url;
|
195
|
195
|
});
|
196
|
|
- window.sessionStorage.setItem('emojiMap', JSON.stringify(emojiMap));
|
|
196
|
+ window.sessionStorage.setItem("emojiMap", JSON.stringify(emojiMap));
|
197
|
197
|
_this3.setState({ emojiList: response.data.list });
|
198
|
198
|
}).catch(this.errorHandler);
|
199
|
199
|
}
|
200
|
200
|
}, {
|
201
|
|
- key: 'handleEdit',
|
|
201
|
+ key: "handleEdit",
|
202
|
202
|
value: function handleEdit(_ref) {
|
203
|
203
|
var replyId = _ref.replyId,
|
204
|
204
|
commentId = _ref.commentId,
|
|
@@ -208,7 +208,7 @@ var App = function (_Component) {
|
208
|
208
|
|
209
|
209
|
this.setState({
|
210
|
210
|
editModalVisible: true,
|
211
|
|
- action: content.replies ? 'comment' : content.reply ? 'replyToReply' : 'reply',
|
|
211
|
+ action: content.replies ? "comment" : content.reply ? "replyToReply" : "reply",
|
212
|
212
|
replyId: replyId,
|
213
|
213
|
commentId: commentId,
|
214
|
214
|
userId: userId,
|
|
@@ -217,14 +217,14 @@ var App = function (_Component) {
|
217
|
217
|
});
|
218
|
218
|
}
|
219
|
219
|
}, {
|
220
|
|
- key: 'handleClose',
|
|
220
|
+ key: "handleClose",
|
221
|
221
|
value: function handleClose() {
|
222
|
222
|
this.setState({
|
223
|
223
|
editModalVisible: false
|
224
|
224
|
});
|
225
|
225
|
}
|
226
|
226
|
}, {
|
227
|
|
- key: 'error',
|
|
227
|
+ key: "error",
|
228
|
228
|
value: function error(msg) {
|
229
|
229
|
var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
230
|
230
|
|
|
@@ -236,7 +236,7 @@ var App = function (_Component) {
|
236
|
236
|
}
|
237
|
237
|
}
|
238
|
238
|
}, {
|
239
|
|
- key: 'errorHandler',
|
|
239
|
+ key: "errorHandler",
|
240
|
240
|
value: function errorHandler(error) {
|
241
|
241
|
var locale = this.state.locale;
|
242
|
242
|
|
|
@@ -259,7 +259,7 @@ var App = function (_Component) {
|
259
|
259
|
*/
|
260
|
260
|
|
261
|
261
|
}, {
|
262
|
|
- key: 'handleChangeLoading',
|
|
262
|
+ key: "handleChangeLoading",
|
263
|
263
|
value: function handleChangeLoading(key, value) {
|
264
|
264
|
var loading = this.state.loading;
|
265
|
265
|
|
|
@@ -272,7 +272,7 @@ var App = function (_Component) {
|
272
|
272
|
*/
|
273
|
273
|
|
274
|
274
|
}, {
|
275
|
|
- key: 'sGetComment',
|
|
275
|
+ key: "sGetComment",
|
276
|
276
|
value: function sGetComment() {
|
277
|
277
|
var _this4 = this;
|
278
|
278
|
|
|
@@ -284,14 +284,14 @@ var App = function (_Component) {
|
284
|
284
|
|
285
|
285
|
var pageType = this.props.pageType;
|
286
|
286
|
|
287
|
|
- this.handleChangeLoading('sGetComment', true);
|
|
287
|
+ this.handleChangeLoading("sGetComment", true);
|
288
|
288
|
var _props = this.props,
|
289
|
289
|
API = _props.API,
|
290
|
290
|
type = _props.type,
|
291
|
291
|
businessId = _props.businessId,
|
292
|
292
|
limit = _props.limit;
|
293
|
293
|
|
294
|
|
- this.axios.get(API + '/comments?type=' + type + '&business_id=' + businessId + '&is_speak=' + filterSpeak + '&page=' + page + '&limit=' + limit).then(function (response) {
|
|
294
|
+ this.axios.get(API + "/comments?type=" + type + "&business_id=" + businessId + "&is_speak=" + filterSpeak + "&page=" + page + "&limit=" + limit).then(function (response) {
|
295
|
295
|
var _response$data = response.data,
|
296
|
296
|
list = _response$data.list,
|
297
|
297
|
page = _response$data.page,
|
|
@@ -301,7 +301,7 @@ var App = function (_Component) {
|
301
|
301
|
var newList = list;
|
302
|
302
|
var oldList = _this4.state.list;
|
303
|
303
|
|
304
|
|
- if (pageType === 'more') {
|
|
304
|
+ if (pageType === "more") {
|
305
|
305
|
if (page > 1) {
|
306
|
306
|
// 删除临时数据
|
307
|
307
|
oldList = oldList.filter(function (o) {
|
|
@@ -309,7 +309,7 @@ var App = function (_Component) {
|
309
|
309
|
});
|
310
|
310
|
newList = oldList.concat(newList);
|
311
|
311
|
}
|
312
|
|
- } else if (pageType === 'pagination') {
|
|
312
|
+ } else if (pageType === "pagination") {
|
313
|
313
|
// TODO 滚动到顶部
|
314
|
314
|
window.scrollTo(0, 0);
|
315
|
315
|
}
|
|
@@ -321,13 +321,13 @@ var App = function (_Component) {
|
321
|
321
|
});
|
322
|
322
|
_this4.props.onCountChange(total);
|
323
|
323
|
} else {
|
324
|
|
- _message3.default.info(_reactIntlUniversal2.default.get('message.noMoreComment'));
|
|
324
|
+ _message3.default.info(_reactIntlUniversal2.default.get("message.noMoreComment"));
|
325
|
325
|
_this4.setState({
|
326
|
326
|
isNoMoreComment: true
|
327
|
327
|
});
|
328
|
328
|
}
|
329
|
329
|
}).catch(this.errorHandler).finally(function () {
|
330
|
|
- _this4.handleChangeLoading('sGetComment', false);
|
|
330
|
+ _this4.handleChangeLoading("sGetComment", false);
|
331
|
331
|
});
|
332
|
332
|
}
|
333
|
333
|
|
|
@@ -336,7 +336,7 @@ var App = function (_Component) {
|
336
|
336
|
*/
|
337
|
337
|
|
338
|
338
|
}, {
|
339
|
|
- key: 'sGetReply',
|
|
339
|
+ key: "sGetReply",
|
340
|
340
|
value: function sGetReply() {
|
341
|
341
|
var _this5 = this;
|
342
|
342
|
|
|
@@ -345,14 +345,14 @@ var App = function (_Component) {
|
345
|
345
|
_ref3$page = _ref3.page,
|
346
|
346
|
page = _ref3$page === undefined ? 1 : _ref3$page;
|
347
|
347
|
|
348
|
|
- this.handleChangeLoading('sGetReply', true);
|
|
348
|
+ this.handleChangeLoading("sGetReply", true);
|
349
|
349
|
var _props2 = this.props,
|
350
|
350
|
API = _props2.API,
|
351
|
351
|
limit = _props2.limit;
|
352
|
352
|
|
353
|
|
- this.axios.get(API + '/replies?comment_id=' + commentId + '&page=' + page + '&limit=' + limit).then(function (response) {
|
|
353
|
+ this.axios.get(API + "/replies?comment_id=" + commentId + "&page=" + page + "&limit=" + limit).then(function (response) {
|
354
|
354
|
if (!response.data.list) {
|
355
|
|
- _message3.default.info(_reactIntlUniversal2.default.get('message.noMoreData'));
|
|
355
|
+ _message3.default.info(_reactIntlUniversal2.default.get("message.noMoreData"));
|
356
|
356
|
}
|
357
|
357
|
var list = _this5.state.list.map(function (item) {
|
358
|
358
|
if (item.id === commentId) {
|
|
@@ -378,7 +378,7 @@ var App = function (_Component) {
|
378
|
378
|
});
|
379
|
379
|
_this5.setState({ list: list });
|
380
|
380
|
}).catch(this.errorHandler).finally(function () {
|
381
|
|
- _this5.handleChangeLoading('sGetReply', false);
|
|
381
|
+ _this5.handleChangeLoading("sGetReply", false);
|
382
|
382
|
});
|
383
|
383
|
}
|
384
|
384
|
|
|
@@ -388,7 +388,7 @@ var App = function (_Component) {
|
388
|
388
|
*/
|
389
|
389
|
|
390
|
390
|
}, {
|
391
|
|
- key: 'sCreateComment',
|
|
391
|
+ key: "sCreateComment",
|
392
|
392
|
value: function sCreateComment() {
|
393
|
393
|
var _this6 = this;
|
394
|
394
|
|
|
@@ -397,16 +397,16 @@ var App = function (_Component) {
|
397
|
397
|
|
398
|
398
|
var cb = arguments[1];
|
399
|
399
|
|
400
|
|
- if (!content) return this.error(_reactIntlUniversal2.default.get('message.notNull'));
|
401
|
|
- this.handleChangeLoading('sCreateComment', true);
|
|
400
|
+ if (!content) return this.error(_reactIntlUniversal2.default.get("message.notNull"));
|
|
401
|
+ this.handleChangeLoading("sCreateComment", true);
|
402
|
402
|
var _props3 = this.props,
|
403
|
403
|
API = _props3.API,
|
404
|
404
|
type = _props3.type,
|
405
|
405
|
businessId = _props3.businessId,
|
406
|
406
|
businessUserId = _props3.businessUserId;
|
407
|
407
|
|
408
|
|
- this.axios(API + '/comments', {
|
409
|
|
- method: 'post',
|
|
408
|
+ this.axios(API + "/comments", {
|
|
409
|
+ method: "post",
|
410
|
410
|
data: {
|
411
|
411
|
type: type,
|
412
|
412
|
business_id: businessId,
|
|
@@ -416,7 +416,7 @@ var App = function (_Component) {
|
416
|
416
|
withCredentials: true
|
417
|
417
|
}).then(function (response) {
|
418
|
418
|
if (_this6.props.showAlertComment) {
|
419
|
|
- _message3.default.success(_reactIntlUniversal2.default.get('message.success'));
|
|
419
|
+ _message3.default.success(_reactIntlUniversal2.default.get("message.success"));
|
420
|
420
|
}
|
421
|
421
|
if ((0, _helper.isFunction)(cb)) cb(response.data);
|
422
|
422
|
// 将数据写入到 list 中
|
|
@@ -436,7 +436,7 @@ var App = function (_Component) {
|
436
|
436
|
_this6.props.onCommentFail(error.response.status);
|
437
|
437
|
_this6.errorHandler(error);
|
438
|
438
|
}).finally(function () {
|
439
|
|
- _this6.handleChangeLoading('sCreateComment', false);
|
|
439
|
+ _this6.handleChangeLoading("sCreateComment", false);
|
440
|
440
|
});
|
441
|
441
|
}
|
442
|
442
|
|
|
@@ -445,15 +445,15 @@ var App = function (_Component) {
|
445
|
445
|
*/
|
446
|
446
|
|
447
|
447
|
}, {
|
448
|
|
- key: 'sDeleteComment',
|
|
448
|
+ key: "sDeleteComment",
|
449
|
449
|
value: function sDeleteComment(commentId) {
|
450
|
450
|
var _this7 = this;
|
451
|
451
|
|
452
|
|
- this.handleChangeLoading('sDeleteComment', true);
|
|
452
|
+ this.handleChangeLoading("sDeleteComment", true);
|
453
|
453
|
var API = this.props.API;
|
454
|
454
|
|
455
|
|
- this.axios(API + '/comments/' + commentId, {
|
456
|
|
- method: 'delete',
|
|
455
|
+ this.axios(API + "/comments/" + commentId, {
|
|
456
|
+ method: "delete",
|
457
|
457
|
withCredentials: true
|
458
|
458
|
}).then(function () {
|
459
|
459
|
var _state2 = _this7.state,
|
|
@@ -470,7 +470,7 @@ var App = function (_Component) {
|
470
|
470
|
_this7.props.onDelete(_constant.COMMENT_TYPE.COMMENT, deletedItem);
|
471
|
471
|
_this7.props.onCountChange(total - 1);
|
472
|
472
|
}).catch(this.errorHandler).finally(function () {
|
473
|
|
- _this7.handleChangeLoading('sDeleteComment', false);
|
|
473
|
+ _this7.handleChangeLoading("sDeleteComment", false);
|
474
|
474
|
});
|
475
|
475
|
}
|
476
|
476
|
/**
|
|
@@ -479,18 +479,18 @@ var App = function (_Component) {
|
479
|
479
|
*/
|
480
|
480
|
|
481
|
481
|
}, {
|
482
|
|
- key: 'sUpdateComment',
|
|
482
|
+ key: "sUpdateComment",
|
483
|
483
|
value: function sUpdateComment(_ref5) {
|
484
|
484
|
var _this8 = this;
|
485
|
485
|
|
486
|
486
|
var commentId = _ref5.commentId,
|
487
|
487
|
content = _ref5.content;
|
488
|
488
|
|
489
|
|
- this.handleChangeLoading('sUpdateComment', true);
|
|
489
|
+ this.handleChangeLoading("sUpdateComment", true);
|
490
|
490
|
var API = this.props.API;
|
491
|
491
|
|
492
|
|
- this.axios(API + '/comments/' + commentId, {
|
493
|
|
- method: 'post',
|
|
492
|
+ this.axios(API + "/comments/" + commentId, {
|
|
493
|
+ method: "post",
|
494
|
494
|
data: {
|
495
|
495
|
content: content
|
496
|
496
|
},
|
|
@@ -506,10 +506,10 @@ var App = function (_Component) {
|
506
|
506
|
}
|
507
|
507
|
return it;
|
508
|
508
|
});
|
509
|
|
- _this8.props.onUpdateComment('comment');
|
|
509
|
+ _this8.props.onUpdateComment("comment");
|
510
|
510
|
_this8.setState({ list: list });
|
511
|
511
|
}).catch(this.errorHandler).finally(function () {
|
512
|
|
- _this8.handleChangeLoading('sUpdateComment', false);
|
|
512
|
+ _this8.handleChangeLoading("sUpdateComment", false);
|
513
|
513
|
});
|
514
|
514
|
}
|
515
|
515
|
/**
|
|
@@ -519,21 +519,21 @@ var App = function (_Component) {
|
519
|
519
|
*/
|
520
|
520
|
|
521
|
521
|
}, {
|
522
|
|
- key: 'sCreateReply',
|
|
522
|
+ key: "sCreateReply",
|
523
|
523
|
value: function sCreateReply(data, cb) {
|
524
|
524
|
var _this9 = this;
|
525
|
525
|
|
526
|
|
- if (!data.content) return this.error(_reactIntlUniversal2.default.get('message.replyNoNull'));
|
527
|
|
- this.handleChangeLoading('sCreateReply', true);
|
|
526
|
+ if (!data.content) return this.error(_reactIntlUniversal2.default.get("message.replyNoNull"));
|
|
527
|
+ this.handleChangeLoading("sCreateReply", true);
|
528
|
528
|
var API = this.props.API;
|
529
|
529
|
|
530
|
|
- this.axios(API + '/replies', {
|
531
|
|
- method: 'post',
|
|
530
|
+ this.axios(API + "/replies", {
|
|
531
|
+ method: "post",
|
532
|
532
|
data: data,
|
533
|
533
|
withCredentials: true
|
534
|
534
|
}).then(function (response) {
|
535
|
535
|
if (_this9.props.showAlertReply) {
|
536
|
|
- _message3.default.success(_reactIntlUniversal2.default.get('message.replySuccess'));
|
|
536
|
+ _message3.default.success(_reactIntlUniversal2.default.get("message.replySuccess"));
|
537
|
537
|
}
|
538
|
538
|
if ((0, _helper.isFunction)(cb)) cb(response.data);
|
539
|
539
|
// 将数据写入到 list 中
|
|
@@ -554,7 +554,7 @@ var App = function (_Component) {
|
554
|
554
|
_this9.props.onCommentFail(error.response.status);
|
555
|
555
|
_this9.errorHandler(error);
|
556
|
556
|
}).finally(function () {
|
557
|
|
- _this9.handleChangeLoading('sCreateReply', false);
|
|
557
|
+ _this9.handleChangeLoading("sCreateReply", false);
|
558
|
558
|
});
|
559
|
559
|
}
|
560
|
560
|
|
|
@@ -565,15 +565,15 @@ var App = function (_Component) {
|
565
|
565
|
*/
|
566
|
566
|
|
567
|
567
|
}, {
|
568
|
|
- key: 'sDeleteReply',
|
|
568
|
+ key: "sDeleteReply",
|
569
|
569
|
value: function sDeleteReply(replyId, commentId) {
|
570
|
570
|
var _this10 = this;
|
571
|
571
|
|
572
|
|
- this.handleChangeLoading('sDeleteReply', true);
|
|
572
|
+ this.handleChangeLoading("sDeleteReply", true);
|
573
|
573
|
var API = this.props.API;
|
574
|
574
|
|
575
|
|
- this.axios(API + '/replies/' + replyId + '?CommentID=' + commentId, {
|
576
|
|
- method: 'delete',
|
|
575
|
+ this.axios(API + "/replies/" + replyId + "?CommentID=" + commentId, {
|
|
576
|
+ method: "delete",
|
577
|
577
|
withCredentials: true
|
578
|
578
|
}).then(function () {
|
579
|
579
|
var deletedItem = null;
|
|
@@ -593,7 +593,7 @@ var App = function (_Component) {
|
593
|
593
|
_this10.setState({ list: list });
|
594
|
594
|
_this10.props.onDelete(_constant.COMMENT_TYPE.REPLY, deletedItem);
|
595
|
595
|
}).catch(this.errorHandler).finally(function () {
|
596
|
|
- _this10.handleChangeLoading('sDeleteReply', false);
|
|
596
|
+ _this10.handleChangeLoading("sDeleteReply", false);
|
597
|
597
|
});
|
598
|
598
|
}
|
599
|
599
|
/**
|
|
@@ -603,7 +603,7 @@ var App = function (_Component) {
|
603
|
603
|
*/
|
604
|
604
|
|
605
|
605
|
}, {
|
606
|
|
- key: 'sUpdateReply',
|
|
606
|
+ key: "sUpdateReply",
|
607
|
607
|
value: function sUpdateReply(_ref6) {
|
608
|
608
|
var _this11 = this;
|
609
|
609
|
|
|
@@ -612,11 +612,11 @@ var App = function (_Component) {
|
612
|
612
|
replyId = _ref6.replyId,
|
613
|
613
|
replyPage = _ref6.replyPage;
|
614
|
614
|
|
615
|
|
- this.handleChangeLoading('sUpdateReply', true);
|
|
615
|
+ this.handleChangeLoading("sUpdateReply", true);
|
616
|
616
|
var API = this.props.API;
|
617
|
617
|
|
618
|
|
- this.axios(API + '/replies/' + replyId, {
|
619
|
|
- method: 'post',
|
|
618
|
+ this.axios(API + "/replies/" + replyId, {
|
|
619
|
+ method: "post",
|
620
|
620
|
data: {
|
621
|
621
|
comment_id: commentId,
|
622
|
622
|
content: content
|
|
@@ -626,9 +626,9 @@ var App = function (_Component) {
|
626
|
626
|
for (var i = 1; i <= replyPage; i++) {
|
627
|
627
|
_this11.sGetReply({ commentId: commentId, page: i });
|
628
|
628
|
}
|
629
|
|
- _this11.props.onUpdateComment('reply');
|
|
629
|
+ _this11.props.onUpdateComment("reply");
|
630
|
630
|
}).catch(this.errorHandler).finally(function () {
|
631
|
|
- _this11.handleChangeLoading('sUpdateReply', false);
|
|
631
|
+ _this11.handleChangeLoading("sUpdateReply", false);
|
632
|
632
|
});
|
633
|
633
|
}
|
634
|
634
|
/**
|
|
@@ -638,19 +638,19 @@ var App = function (_Component) {
|
638
|
638
|
*/
|
639
|
639
|
|
640
|
640
|
}, {
|
641
|
|
- key: 'sCommentFavor',
|
|
641
|
+ key: "sCommentFavor",
|
642
|
642
|
value: function sCommentFavor(commentId, favored) {
|
643
|
643
|
var _this12 = this;
|
644
|
644
|
|
645
|
|
- this.handleChangeLoading('sCommentFavor', true);
|
|
645
|
+ this.handleChangeLoading("sCommentFavor", true);
|
646
|
646
|
var API = this.props.API;
|
647
|
647
|
|
648
|
|
- this.axios(API + '/comments/' + commentId + '/favor', {
|
649
|
|
- method: favored ? 'delete' : 'put',
|
|
648
|
+ this.axios(API + "/comments/" + commentId + "/favor", {
|
|
649
|
+ method: favored ? "delete" : "put",
|
650
|
650
|
withCredentials: true
|
651
|
651
|
}).then(function (response) {
|
652
|
652
|
if (_this12.props.showAlertFavor) {
|
653
|
|
- _message3.default.success(favored ? _reactIntlUniversal2.default.get('message.cancelLickSuccess') : _reactIntlUniversal2.default.get('message.likeSuccess'));
|
|
653
|
+ _message3.default.success(favored ? _reactIntlUniversal2.default.get("message.cancelLickSuccess") : _reactIntlUniversal2.default.get("message.likeSuccess"));
|
654
|
654
|
}
|
655
|
655
|
// 更新 list 中的该项数据的 favored
|
656
|
656
|
var list = _this12.state.list.map(function (item) {
|
|
@@ -662,7 +662,7 @@ var App = function (_Component) {
|
662
|
662
|
});
|
663
|
663
|
_this12.setState({ list: list });
|
664
|
664
|
}).catch(this.errorHandler).finally(function () {
|
665
|
|
- _this12.handleChangeLoading('sCommentFavor', false);
|
|
665
|
+ _this12.handleChangeLoading("sCommentFavor", false);
|
666
|
666
|
});
|
667
|
667
|
}
|
668
|
668
|
|
|
@@ -674,21 +674,21 @@ var App = function (_Component) {
|
674
|
674
|
*/
|
675
|
675
|
|
676
|
676
|
}, {
|
677
|
|
- key: 'sReplyFavor',
|
|
677
|
+ key: "sReplyFavor",
|
678
|
678
|
value: function sReplyFavor(replyId, commentId, favored) {
|
679
|
679
|
var _this13 = this;
|
680
|
680
|
|
681
|
|
- this.handleChangeLoading('sReplyFavor', true);
|
|
681
|
+ this.handleChangeLoading("sReplyFavor", true);
|
682
|
682
|
var API = this.props.API;
|
683
|
683
|
|
684
|
|
- this.axios(API + '/replies/' + replyId + '/favor', {
|
685
|
|
- method: favored ? 'delete' : 'put',
|
|
684
|
+ this.axios(API + "/replies/" + replyId + "/favor", {
|
|
685
|
+ method: favored ? "delete" : "put",
|
686
|
686
|
data: {
|
687
|
687
|
comment_id: commentId
|
688
|
688
|
},
|
689
|
689
|
withCredentials: true
|
690
|
690
|
}).then(function (response) {
|
691
|
|
- _message3.default.success(favored ? _reactIntlUniversal2.default.get('message.cancelLickSuccess') : _reactIntlUniversal2.default.get('message.likeSuccess'));
|
|
691
|
+ _message3.default.success(favored ? _reactIntlUniversal2.default.get("message.cancelLickSuccess") : _reactIntlUniversal2.default.get("message.likeSuccess"));
|
692
|
692
|
// 更新 list 中的该项数据的 favored
|
693
|
693
|
var list = _this13.state.list.map(function (item) {
|
694
|
694
|
if (item.id === commentId) {
|
|
@@ -707,7 +707,7 @@ var App = function (_Component) {
|
707
|
707
|
});
|
708
|
708
|
_this13.setState({ list: list });
|
709
|
709
|
}).catch(this.errorHandler).finally(function () {
|
710
|
|
- _this13.handleChangeLoading('sReplyFavor', false);
|
|
710
|
+ _this13.handleChangeLoading("sReplyFavor", false);
|
711
|
711
|
});
|
712
|
712
|
}
|
713
|
713
|
|
|
@@ -716,21 +716,21 @@ var App = function (_Component) {
|
716
|
716
|
*/
|
717
|
717
|
|
718
|
718
|
}, {
|
719
|
|
- key: 'sOssSts',
|
|
719
|
+ key: "sOssSts",
|
720
|
720
|
value: function sOssSts() {
|
721
|
721
|
var _this14 = this;
|
722
|
722
|
|
723
|
|
- this.handleChangeLoading('sOssSts', true);
|
|
723
|
+ this.handleChangeLoading("sOssSts", true);
|
724
|
724
|
var API = this.props.API;
|
725
|
725
|
|
726
|
|
- this.axios.get(API + '/oss/sts').then(function (response) {
|
|
726
|
+ this.axios.get(API + "/oss/sts").then(function (response) {
|
727
|
727
|
_this14.setState({ oss: _extends({}, response.data) });
|
728
|
728
|
}).catch(this.errorHandler).finally(function () {
|
729
|
|
- _this14.handleChangeLoading('sOssSts', false);
|
|
729
|
+ _this14.handleChangeLoading("sOssSts", false);
|
730
|
730
|
});
|
731
|
731
|
}
|
732
|
732
|
}, {
|
733
|
|
- key: 'render',
|
|
733
|
+ key: "render",
|
734
|
734
|
value: function render() {
|
735
|
735
|
// 添加到 Context 的数据
|
736
|
736
|
var value = _extends({}, this.state, this.props, {
|
|
@@ -752,11 +752,11 @@ var App = function (_Component) {
|
752
|
752
|
_Comment.CommentContext.Provider,
|
753
|
753
|
{ value: value },
|
754
|
754
|
_react2.default.createElement(
|
755
|
|
- 'div',
|
756
|
|
- { className: 'comment' },
|
|
755
|
+ "div",
|
|
756
|
+ { className: "comment" },
|
757
|
757
|
this.props.showEditor && _react2.default.createElement(_CommentInput2.default, { content: this.props.children }),
|
758
|
758
|
this.props.showList && _react2.default.createElement(
|
759
|
|
- 'div',
|
|
759
|
+ "div",
|
760
|
760
|
{ style: { marginTop: 20 } },
|
761
|
761
|
_react2.default.createElement(_CommentList2.default, null)
|
762
|
762
|
)
|
|
@@ -807,9 +807,9 @@ App.propTypes = {
|
807
|
807
|
|
808
|
808
|
App.defaultProps = {
|
809
|
809
|
businessUserId: 0,
|
810
|
|
- API: '//api.links123.net/comment/v1',
|
811
|
|
- emojiAPI: '//api.links123.net/link/v1',
|
812
|
|
- LOGINLINK: process.env.RUN_MOD === 'production' ? 'https://passport.links123.com/login' : 'http://test.links123.net:5050/login',
|
|
810
|
+ API: "//api.links123.net/comment/v1",
|
|
811
|
+ emojiAPI: "//api.links123.net/link/v1",
|
|
812
|
+ LOGINLINK: process.env.RUN_MOD === "production" ? "https://passport.links123.com/login" : "http://test.links123.net:5050/login",
|
813
|
813
|
showList: true,
|
814
|
814
|
showEditor: true,
|
815
|
815
|
showAlertComment: false,
|
|
@@ -817,7 +817,7 @@ App.defaultProps = {
|
817
|
817
|
showAlertFavor: false,
|
818
|
818
|
showError: true,
|
819
|
819
|
showEdit: false,
|
820
|
|
- pageType: 'more',
|
|
820
|
+ pageType: "more",
|
821
|
821
|
limit: _constant.LIMIT,
|
822
|
822
|
onGetMoreBtnClick: function onGetMoreBtnClick() {},
|
823
|
823
|
onPageChange: function onPageChange(page) {},
|