Browse Source

fix:跟读播放的时候,暂停其他的播放中的音频

adam 4 years ago
parent
commit
7a67067d6a

+ 115
- 115
lib/App.js View File

@@ -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) {},

+ 1
- 1
lib/App.js.map
File diff suppressed because it is too large
View File


+ 30
- 30
lib/App.module.css View File

@@ -1,30 +1,30 @@
1
-.comment {
2
-  width: 100%;
3
-  padding: 10px;
4
-  margin-bottom: 100px;
5
-}
6
-
7
-.comment .ant-spin-nested-loading > div > .ant-spin .ant-spin-dot {
8
-  position: fixed;
9
-  top: 45%;
10
-}
11
-
12
-.comment-header-tag {
13
-  border: 1px solid #cecece;
14
-  border-radius: 0;
15
-  color: #666;
16
-}
17
-
18
-.comment-header-tip {
19
-  color: #5198eb;
20
-  margin-right: 15px;
21
-  margin-left: 5px;
22
-}
23
-
24
-.comment-header-text {
25
-  color: #666;
26
-}
27
-
28
-.comment-img {
29
-  max-width: 100%;
30
-}
1
+.comment {
2
+  width: 100%;
3
+  padding: 10px;
4
+  margin-bottom: 100px;
5
+}
6
+
7
+.comment .ant-spin-nested-loading > div > .ant-spin .ant-spin-dot {
8
+  position: fixed;
9
+  top: 45%;
10
+}
11
+
12
+.comment-header-tag {
13
+  border: 1px solid #cecece;
14
+  border-radius: 0;
15
+  color: #666;
16
+}
17
+
18
+.comment-header-tip {
19
+  color: #5198eb;
20
+  margin-right: 15px;
21
+  margin-left: 5px;
22
+}
23
+
24
+.comment-header-text {
25
+  color: #666;
26
+}
27
+
28
+.comment-img {
29
+  max-width: 100%;
30
+}

+ 1
- 1
lib/Comment.js.map View File

@@ -1 +1 @@
1
-{"version":3,"sources":["../src/Comment.js"],"names":["Comment","CommentContext","React","createContext","Component","props","app"],"mappings":";;;;;;;;;QAKgBA,O,GAAAA,O;;AALhB;;;;;;AAEA,IAAMC,iBAAiBC,gBAAMC,aAAN,EAAvB;;AAEA;AACO,SAASH,OAAT,CAAiBI,SAAjB,EAA4B;AACjC;AACA,SAAO,UAASC,KAAT,EAAgB;AACrB;AACA;AACA,WACE;AAAC,oBAAD,CAAgB,QAAhB;AAAA;AACG;AAAA,eAAO,8BAAC,SAAD,eAAeA,KAAf,IAAsB,KAAKC,GAA3B,IAAP;AAAA;AADH,KADF;AAKD,GARD;AASD;;QAEQL,c,GAAAA,c;kBAEMD,O","file":"Comment.js","sourcesContent":["import React from \"react\";\n\nconst CommentContext = React.createContext();\n\n// This function takes a component...\nexport function Comment(Component) {\n  // ...and returns another component...\n  return function(props) {\n    // ... and renders the wrapped component with the context theme!\n    // Notice that we pass through any additional props as well\n    return (\n      <CommentContext.Consumer>\n        {app => <Component {...props} app={app} />}\n      </CommentContext.Consumer>\n    );\n  };\n}\n\nexport { CommentContext };\n\nexport default Comment;\n"]}
1
+{"version":3,"sources":["../src/Comment.js"],"names":["Comment","CommentContext","React","createContext","Component","props","app"],"mappings":";;;;;;;;;QAKgBA,O,GAAAA,O;;AALhB;;;;;;AAEA,IAAMC,iBAAiBC,gBAAMC,aAAN,EAAvB;;AAEA;AACO,SAASH,OAAT,CAAiBI,SAAjB,EAA4B;AACjC;AACA,SAAO,UAASC,KAAT,EAAgB;AACrB;AACA;AACA,WACE;AAAC,oBAAD,CAAgB,QAAhB;AAAA;AACG;AAAA,eAAO,8BAAC,SAAD,eAAeA,KAAf,IAAsB,KAAKC,GAA3B,IAAP;AAAA;AADH,KADF;AAKD,GARD;AASD;;QAEQL,c,GAAAA,c;kBAEMD,O","file":"Comment.js","sourcesContent":["import React from \"react\";\r\n\r\nconst CommentContext = React.createContext();\r\n\r\n// This function takes a component...\r\nexport function Comment(Component) {\r\n  // ...and returns another component...\r\n  return function(props) {\r\n    // ... and renders the wrapped component with the context theme!\r\n    // Notice that we pass through any additional props as well\r\n    return (\r\n      <CommentContext.Consumer>\r\n        {app => <Component {...props} app={app} />}\r\n      </CommentContext.Consumer>\r\n    );\r\n  };\r\n}\r\n\r\nexport { CommentContext };\r\n\r\nexport default Comment;\r\n"]}

+ 1
- 1
lib/avatar.js.map
File diff suppressed because it is too large
View File


+ 1
- 1
lib/axios.js.map View File

@@ -1 +1 @@
1
-{"version":3,"sources":["../src/axios.js"],"names":["axios","defaults","withCredentials","headers","common"],"mappings":";;;;;;AAAA;;;;;;AAEAA,gBAAMC,QAAN,CAAeC,eAAf,GAAiC,IAAjC;AACAF,gBAAMC,QAAN,CAAeE,OAAf,CAAuBC,MAAvB,CAA8B,eAA9B,IAAiD,SAAjD;;kBAEeJ,e","file":"axios.js","sourcesContent":["import axios from \"axios\";\n\naxios.defaults.withCredentials = true;\naxios.defaults.headers.common[\"Authorization\"] = \"Bearer \";\n\nexport default axios;\n"]}
1
+{"version":3,"sources":["../src/axios.js"],"names":["axios","defaults","withCredentials","headers","common"],"mappings":";;;;;;AAAA;;;;;;AAEAA,gBAAMC,QAAN,CAAeC,eAAf,GAAiC,IAAjC;AACAF,gBAAMC,QAAN,CAAeE,OAAf,CAAuBC,MAAvB,CAA8B,eAA9B,IAAiD,SAAjD;;kBAEeJ,e","file":"axios.js","sourcesContent":["import axios from \"axios\";\r\n\r\naxios.defaults.withCredentials = true;\r\naxios.defaults.headers.common[\"Authorization\"] = \"Bearer \";\r\n\r\nexport default axios;\r\n"]}

+ 48
- 27
lib/components/AudioPlayer/index.js View File

@@ -1,40 +1,40 @@
1
-'use strict';
1
+"use strict";
2 2
 
3 3
 Object.defineProperty(exports, "__esModule", {
4 4
   value: true
5 5
 });
6 6
 
7
-var _slider = require('antd/es/slider');
7
+var _slider = require("antd/es/slider");
8 8
 
9 9
 var _slider2 = _interopRequireDefault(_slider);
10 10
 
11
-var _icon = require('antd/es/icon');
11
+var _icon = require("antd/es/icon");
12 12
 
13 13
 var _icon2 = _interopRequireDefault(_icon);
14 14
 
15 15
 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; }; }();
16 16
 
17
-require('antd/es/slider/style');
17
+require("antd/es/slider/style");
18 18
 
19
-require('antd/es/icon/style');
19
+require("antd/es/icon/style");
20 20
 
21
-var _react = require('react');
21
+var _react = require("react");
22 22
 
23 23
 var _react2 = _interopRequireDefault(_react);
24 24
 
25
-var _dayjs = require('dayjs');
25
+var _dayjs = require("dayjs");
26 26
 
27 27
 var _dayjs2 = _interopRequireDefault(_dayjs);
28 28
 
29
-var _duration = require('dayjs/plugin/duration');
29
+var _duration = require("dayjs/plugin/duration");
30 30
 
31 31
 var _duration2 = _interopRequireDefault(_duration);
32 32
 
33
-var _utc = require('dayjs/plugin/utc');
33
+var _utc = require("dayjs/plugin/utc");
34 34
 
35 35
 var _utc2 = _interopRequireDefault(_utc);
36 36
 
37
-require('./index.less');
37
+require("./index.less");
38 38
 
39 39
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
40 40
 
@@ -64,7 +64,7 @@ var AudioPlayer = function (_React$Component) {
64 64
   }
65 65
 
66 66
   _createClass(AudioPlayer, [{
67
-    key: 'componentDidMount',
67
+    key: "componentDidMount",
68 68
     value: function componentDidMount() {
69 69
       var _this2 = this;
70 70
 
@@ -90,7 +90,7 @@ var AudioPlayer = function (_React$Component) {
90 90
       }
91 91
     }
92 92
   }, {
93
-    key: 'componentDidUpdate',
93
+    key: "componentDidUpdate",
94 94
     value: function componentDidUpdate(prevProps) {
95 95
       var _this3 = this;
96 96
 
@@ -114,7 +114,28 @@ var AudioPlayer = function (_React$Component) {
114 114
       }
115 115
     }
116 116
   }, {
117
-    key: 'render',
117
+    key: "clickPlayOrPause",
118
+    value: function clickPlayOrPause(isPlaying) {
119
+      if (!this.player) {
120
+        return;
121
+      }
122
+      if (isPlaying) {
123
+        this.player.pause();
124
+      } else {
125
+        // 如果是播放,先暂停其他的播放
126
+        var playerList = document.getElementsByTagName("audio");
127
+        if (playerList) {
128
+          Array.from(playerList).forEach(function (player) {
129
+            if (!player.paused) {
130
+              player.pause();
131
+            }
132
+          });
133
+        }
134
+        this.player.play();
135
+      }
136
+    }
137
+  }, {
138
+    key: "render",
118 139
     value: function render() {
119 140
       var _this4 = this;
120 141
 
@@ -124,27 +145,27 @@ var AudioPlayer = function (_React$Component) {
124 145
           duration = _state.duration;
125 146
 
126 147
       return _react2.default.createElement(
127
-        'div',
128
-        { className: 'comment-item-speak-audio-container' },
129
-        _react2.default.createElement('audio', {
148
+        "div",
149
+        { className: "comment-item-speak-audio-container" },
150
+        _react2.default.createElement("audio", {
130 151
           ref: function ref(_ref) {
131 152
             _this4.player = _ref;
132 153
           },
133
-          style: { display: 'none' }
154
+          style: { display: "none" }
134 155
         }),
135 156
         _react2.default.createElement(
136
-          'span',
157
+          "span",
137 158
           {
138
-            className: 'icon',
159
+            className: "icon",
139 160
             onClick: function onClick() {
140
-              return _this4.player && (isPlaying ? _this4.player.pause() : _this4.player.play());
161
+              _this4.clickPlayOrPause(isPlaying);
141 162
             }
142 163
           },
143
-          isPlaying ? _react2.default.createElement(_icon2.default, { className: 'pause', type: 'pause' }) : _react2.default.createElement('i', { className: 'schedule schedule-icon_image_audio' })
164
+          isPlaying ? _react2.default.createElement(_icon2.default, { className: "pause", type: "pause" }) : _react2.default.createElement("i", { className: "schedule schedule-icon_image_audio" })
144 165
         ),
145 166
         _react2.default.createElement(_slider2.default, {
146 167
           step: 0.001,
147
-          className: 'slider',
168
+          className: "slider",
148 169
           tooltipVisible: false,
149 170
           value: currentDuration,
150 171
           max: duration,
@@ -155,11 +176,11 @@ var AudioPlayer = function (_React$Component) {
155 176
           }
156 177
         }),
157 178
         _react2.default.createElement(
158
-          'span',
159
-          { className: 'time' },
160
-          _dayjs2.default.utc(_dayjs2.default.duration(currentDuration, 'seconds').asMilliseconds()).format('mm:ss'),
161
-          '/',
162
-          _dayjs2.default.utc(_dayjs2.default.duration(duration, 'seconds').asMilliseconds()).format('mm:ss')
179
+          "span",
180
+          { className: "time" },
181
+          _dayjs2.default.utc(_dayjs2.default.duration(currentDuration, "seconds").asMilliseconds()).format("mm:ss"),
182
+          "/",
183
+          _dayjs2.default.utc(_dayjs2.default.duration(duration, "seconds").asMilliseconds()).format("mm:ss")
163 184
         )
164 185
       );
165 186
     }

+ 1
- 1
lib/components/AudioPlayer/index.js.map
File diff suppressed because it is too large
View File


+ 1
- 1
lib/components/AudioPlayer/index.less View File

@@ -57,4 +57,4 @@
57 57
       width: 60px;
58 58
     }
59 59
   }
60
-}
60
+}

+ 49
- 49
lib/components/CommentBox/index.css View File

@@ -1,49 +1,49 @@
1
-.comment-show-more {
2
-  color: #4a90e2;
3
-  text-align: center;
4
-  width: 100px;
5
-  background-color: #f8f8f8;
6
-  cursor: pointer;
7
-  padding: 10px;
8
-  margin: 0 auto;
9
-  transition: all 0.3s;
10
-}
11
-.comment-show-more:hover {
12
-  background-color: #f5f5f5;
13
-  color: #1890ff;
14
-}
15
-.comment-more-box {
16
-  text-align: center;
17
-  width: 90%;
18
-  margin-left: 50px;
19
-  margin-top: 10px;
20
-  height: 40px;
21
-  display: inline-block;
22
-}
23
-@media screen and (max-width: 616px) and (min-width: 449px) {
24
-  .comment-more-box {
25
-    text-align: center;
26
-    width: 85%;
27
-    margin-left: 50px;
28
-    height: 40px;
29
-    display: inline-block;
30
-  }
31
-}
32
-@media screen and (max-width: 449px) and (min-width: 365px) {
33
-  .comment-more-box {
34
-    text-align: center;
35
-    width: 80%;
36
-    margin-left: 50px;
37
-    height: 40px;
38
-    display: inline-block;
39
-  }
40
-}
41
-@media screen and (max-width: 365px) {
42
-  .comment-more-box {
43
-    text-align: center;
44
-    width: 75%;
45
-    margin-left: 50px;
46
-    height: 40px;
47
-    display: inline-block;
48
-  }
49
-}
1
+.comment-show-more {
2
+  color: #4a90e2;
3
+  text-align: center;
4
+  width: 100px;
5
+  background-color: #f8f8f8;
6
+  cursor: pointer;
7
+  padding: 10px;
8
+  margin: 0 auto;
9
+  transition: all 0.3s;
10
+}
11
+.comment-show-more:hover {
12
+  background-color: #f5f5f5;
13
+  color: #1890ff;
14
+}
15
+.comment-more-box {
16
+  text-align: center;
17
+  width: 90%;
18
+  margin-left: 50px;
19
+  margin-top: 10px;
20
+  height: 40px;
21
+  display: inline-block;
22
+}
23
+@media screen and (max-width: 616px) and (min-width: 449px) {
24
+  .comment-more-box {
25
+    text-align: center;
26
+    width: 85%;
27
+    margin-left: 50px;
28
+    height: 40px;
29
+    display: inline-block;
30
+  }
31
+}
32
+@media screen and (max-width: 449px) and (min-width: 365px) {
33
+  .comment-more-box {
34
+    text-align: center;
35
+    width: 80%;
36
+    margin-left: 50px;
37
+    height: 40px;
38
+    display: inline-block;
39
+  }
40
+}
41
+@media screen and (max-width: 365px) {
42
+  .comment-more-box {
43
+    text-align: center;
44
+    width: 75%;
45
+    margin-left: 50px;
46
+    height: 40px;
47
+    display: inline-block;
48
+  }
49
+}

+ 1
- 1
lib/components/CommentList/index.js.map
File diff suppressed because it is too large
View File


+ 1
- 1
lib/components/ContentItem/index.css View File

@@ -139,7 +139,7 @@
139 139
   height: 0;
140 140
   padding-bottom: 100%;
141 141
   border-radius: 5px;
142
-  cursor: url('//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/QPI84fxmD.undefined'),
142
+  cursor: url("//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/QPI84fxmD.undefined"),
143 143
     auto;
144 144
 }
145 145
 

+ 1
- 1
lib/components/ContentItem/index.js.map
File diff suppressed because it is too large
View File


+ 39
- 39
lib/components/Editor/Emoji.css View File

@@ -1,39 +1,39 @@
1
-.emoji .item {
2
-  float: left;
3
-  width: 40px;
4
-  height: 40px;
5
-  cursor: pointer;
6
-  white-space: nowrap;
7
-  /* this is required unless you put the helper span closely near the img */
8
-  text-align: center;
9
-  margin: 0;
10
-}
11
-
12
-.emoji .item .helper {
13
-  display: inline-block;
14
-  height: 100%;
15
-  vertical-align: middle;
16
-}
17
-
18
-.emoji .item img {
19
-  margin: 0 auto;
20
-  vertical-align: middle;
21
-  padding: 3px;
22
-}
23
-
24
-.emoji .item img:hover {
25
-  border: 1px solid #40a9ff;
26
-}
27
-
28
-.ant-carousel .slick-dots {
29
-  height: 5px;
30
-}
31
-
32
-.ant-carousel .slick-dots li button {
33
-  height: 5px;
34
-  width: 25px;
35
-}
36
-
37
-.ant-carousel .slick-dots li.slick-active button {
38
-  width: 32px;
39
-}
1
+.emoji .item {
2
+  float: left;
3
+  width: 40px;
4
+  height: 40px;
5
+  cursor: pointer;
6
+  white-space: nowrap;
7
+  /* this is required unless you put the helper span closely near the img */
8
+  text-align: center;
9
+  margin: 0;
10
+}
11
+
12
+.emoji .item .helper {
13
+  display: inline-block;
14
+  height: 100%;
15
+  vertical-align: middle;
16
+}
17
+
18
+.emoji .item img {
19
+  margin: 0 auto;
20
+  vertical-align: middle;
21
+  padding: 3px;
22
+}
23
+
24
+.emoji .item img:hover {
25
+  border: 1px solid #40a9ff;
26
+}
27
+
28
+.ant-carousel .slick-dots {
29
+  height: 5px;
30
+}
31
+
32
+.ant-carousel .slick-dots li button {
33
+  height: 5px;
34
+  width: 25px;
35
+}
36
+
37
+.ant-carousel .slick-dots li.slick-active button {
38
+  width: 32px;
39
+}

+ 1
- 1
lib/components/Editor/Upload.js.map
File diff suppressed because it is too large
View File


+ 112
- 112
lib/components/ImagePreviewer/ImagePreviewer.css View File

@@ -1,112 +1,112 @@
1
-.container .toolbar {
2
-  border-bottom: 1px solid #f2f2f2;
3
-  margin: 0 5px;
4
-  padding-bottom: 10px;
5
-}
6
-.container .toolbar .button {
7
-  padding: 5px 10px;
8
-  cursor: pointer;
9
-}
10
-.container .toolbar .button.reversal i {
11
-  transform: rotate3d(0, 1, 0, 180deg);
12
-}
13
-.container .pictureWrapper {
14
-  position: relative;
15
-  text-align: center;
16
-  margin-top: 15px;
17
-  padding: 0 5px;
18
-}
19
-.container .pictureWrapper .tools {
20
-  position: absolute;
21
-  left: 0;
22
-  top: 0;
23
-  bottom: 0;
24
-  right: 0;
25
-}
26
-.container .pictureWrapper .tools .item {
27
-  width: 33%;
28
-  display: inline-block;
29
-  height: 100%;
30
-}
31
-.container .pictureWrapper .tools .item.left {
32
-  cursor: url("//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/73_yM_fx-.undefined"),
33
-    auto;
34
-}
35
-.container .pictureWrapper .tools .item.shrink {
36
-  cursor: url("//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/oGPpbJ7Rk.undefined"),
37
-    auto;
38
-}
39
-.container .pictureWrapper .tools .item.right {
40
-  cursor: url("//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/S8obecP1d.undefined"),
41
-    auto;
42
-}
43
-.container .pictureWrapper .picture {
44
-  max-width: 100%;
45
-  max-height: 400px;
46
-}
47
-.container .pictureWrapper .prev {
48
-  position: absolute;
49
-  width: 50px;
50
-  background-color: transparent;
51
-  z-index: 100;
52
-  opacity: 0.5;
53
-  font-size: 50px;
54
-  text-align: left;
55
-  cursor: pointer;
56
-  left: 5px;
57
-  top: 0;
58
-  bottom: 0;
59
-}
60
-.container .pictureWrapper .prev:hover {
61
-  background-color: #fff;
62
-}
63
-.container .pictureWrapper .next {
64
-  position: absolute;
65
-  width: 50px;
66
-  background-color: transparent;
67
-  z-index: 100;
68
-  opacity: 0.5;
69
-  font-size: 50px;
70
-  text-align: left;
71
-  cursor: pointer;
72
-  right: 5px;
73
-  top: 0;
74
-  bottom: 0;
75
-}
76
-.container .pictureWrapper .next:hover {
77
-  background-color: #fff;
78
-}
79
-.container .pictureWrapper .middle {
80
-  position: absolute;
81
-  top: 50%;
82
-  transform: translateY(-50%);
83
-}
84
-.container .list {
85
-  font-size: 0;
86
-  margin-top: 25px;
87
-}
88
-.container .list .wrapper {
89
-  width: 11.1%;
90
-  height: 0;
91
-  padding-bottom: 11.1%;
92
-  position: relative;
93
-  display: inline-block;
94
-  border-radius: 5px;
95
-  border: 1px solid transparent;
96
-  opacity: 0.5;
97
-}
98
-.container .list .wrapper.active {
99
-  border: 1px solid #fc4747;
100
-  opacity: 1;
101
-}
102
-.container .list .wrapper .thumbnail {
103
-  position: absolute;
104
-  top: 5px;
105
-  bottom: 5px;
106
-  left: 5px;
107
-  right: 5px;
108
-  background-size: cover;
109
-  background-position: center;
110
-  border-radius: 5px;
111
-  cursor: pointer;
112
-}
1
+.container .toolbar {
2
+  border-bottom: 1px solid #f2f2f2;
3
+  margin: 0 5px;
4
+  padding-bottom: 10px;
5
+}
6
+.container .toolbar .button {
7
+  padding: 5px 10px;
8
+  cursor: pointer;
9
+}
10
+.container .toolbar .button.reversal i {
11
+  transform: rotate3d(0, 1, 0, 180deg);
12
+}
13
+.container .pictureWrapper {
14
+  position: relative;
15
+  text-align: center;
16
+  margin-top: 15px;
17
+  padding: 0 5px;
18
+}
19
+.container .pictureWrapper .tools {
20
+  position: absolute;
21
+  left: 0;
22
+  top: 0;
23
+  bottom: 0;
24
+  right: 0;
25
+}
26
+.container .pictureWrapper .tools .item {
27
+  width: 33%;
28
+  display: inline-block;
29
+  height: 100%;
30
+}
31
+.container .pictureWrapper .tools .item.left {
32
+  cursor: url("//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/73_yM_fx-.undefined"),
33
+    auto;
34
+}
35
+.container .pictureWrapper .tools .item.shrink {
36
+  cursor: url("//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/oGPpbJ7Rk.undefined"),
37
+    auto;
38
+}
39
+.container .pictureWrapper .tools .item.right {
40
+  cursor: url("//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/S8obecP1d.undefined"),
41
+    auto;
42
+}
43
+.container .pictureWrapper .picture {
44
+  max-width: 100%;
45
+  max-height: 400px;
46
+}
47
+.container .pictureWrapper .prev {
48
+  position: absolute;
49
+  width: 50px;
50
+  background-color: transparent;
51
+  z-index: 100;
52
+  opacity: 0.5;
53
+  font-size: 50px;
54
+  text-align: left;
55
+  cursor: pointer;
56
+  left: 5px;
57
+  top: 0;
58
+  bottom: 0;
59
+}
60
+.container .pictureWrapper .prev:hover {
61
+  background-color: #fff;
62
+}
63
+.container .pictureWrapper .next {
64
+  position: absolute;
65
+  width: 50px;
66
+  background-color: transparent;
67
+  z-index: 100;
68
+  opacity: 0.5;
69
+  font-size: 50px;
70
+  text-align: left;
71
+  cursor: pointer;
72
+  right: 5px;
73
+  top: 0;
74
+  bottom: 0;
75
+}
76
+.container .pictureWrapper .next:hover {
77
+  background-color: #fff;
78
+}
79
+.container .pictureWrapper .middle {
80
+  position: absolute;
81
+  top: 50%;
82
+  transform: translateY(-50%);
83
+}
84
+.container .list {
85
+  font-size: 0;
86
+  margin-top: 25px;
87
+}
88
+.container .list .wrapper {
89
+  width: 11.1%;
90
+  height: 0;
91
+  padding-bottom: 11.1%;
92
+  position: relative;
93
+  display: inline-block;
94
+  border-radius: 5px;
95
+  border: 1px solid transparent;
96
+  opacity: 0.5;
97
+}
98
+.container .list .wrapper.active {
99
+  border: 1px solid #fc4747;
100
+  opacity: 1;
101
+}
102
+.container .list .wrapper .thumbnail {
103
+  position: absolute;
104
+  top: 5px;
105
+  bottom: 5px;
106
+  left: 5px;
107
+  right: 5px;
108
+  background-size: cover;
109
+  background-position: center;
110
+  border-radius: 5px;
111
+  cursor: pointer;
112
+}

+ 117
- 117
lib/components/ImagePreviewer/ImagePreviewer.less View File

@@ -1,117 +1,117 @@
1
-.comment-image-preview-container {
2
-  .toolbar {
3
-    border-bottom: 1px solid #f2f2f2;
4
-    margin: 0 5px;
5
-    padding-bottom: 10px;
6
-    .button {
7
-      padding: 5px 10px;
8
-      cursor: pointer;
9
-      &.reversal i {
10
-        transform: rotate3d(0, 1, 0, 180deg);
11
-      }
12
-    }
13
-  }
14
-  .pictureWrapper {
15
-    position: relative; // width: 100%;
16
-    // padding-bottom: 68%;
17
-    // height: 0;
18
-    text-align: center;
19
-    margin-top: 15px;
20
-    padding: 0 5px;
21
-    .tools {
22
-      position: absolute;
23
-      left: 0;
24
-      top: 0;
25
-      bottom: 0;
26
-      right: 0;
27
-      .item {
28
-        width: 33%;
29
-        display: inline-block;
30
-        height: 100%;
31
-        &.left {
32
-          cursor: url("//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/73_yM_fx-.undefined"),
33
-            auto;
34
-        }
35
-        &.shrink {
36
-          cursor: url("//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/oGPpbJ7Rk.undefined"),
37
-            auto;
38
-        }
39
-        &.right {
40
-          cursor: url("//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/S8obecP1d.undefined"),
41
-            auto;
42
-        }
43
-      }
44
-    }
45
-    .picture {
46
-      max-width: 100%;
47
-      max-height: 400px;
48
-    }
49
-    .tool() {
50
-      position: absolute;
51
-      width: 50px;
52
-      background-color: transparent;
53
-      z-index: 100;
54
-      opacity: 0.5;
55
-      font-size: 50px;
56
-      text-align: left;
57
-      cursor: pointer;
58
-      &:hover {
59
-        background-color: #fff;
60
-      }
61
-    }
62
-    .prev {
63
-      .tool();
64
-      left: 5px;
65
-      top: 0;
66
-      bottom: 0;
67
-    }
68
-    .next {
69
-      .tool();
70
-      right: 5px;
71
-      top: 0;
72
-      bottom: 0;
73
-    }
74
-    .middle {
75
-      position: absolute;
76
-      top: 50%;
77
-      transform: translateY(-50%);
78
-    } // .picture {
79
-    //     position: absolute;
80
-    //     bottom: 0;
81
-    //     top: 0;
82
-    //     left: 5px;
83
-    //     right: 5px;
84
-    //     background-size: contain;
85
-    //     background-position: center;
86
-    // }
87
-  }
88
-  .list {
89
-    font-size: 0;
90
-    margin-top: 25px;
91
-    .wrapper {
92
-      width: 11.1%;
93
-      height: 0;
94
-      padding-bottom: 11.1%;
95
-      position: relative;
96
-      display: inline-block;
97
-      border-radius: 5px;
98
-      border: 1px solid transparent;
99
-      opacity: 0.5;
100
-      &.active {
101
-        border: 1px solid #fc4747;
102
-        opacity: 1;
103
-      }
104
-      .thumbnail {
105
-        position: absolute;
106
-        top: 5px;
107
-        bottom: 5px;
108
-        left: 5px;
109
-        right: 5px;
110
-        background-size: cover;
111
-        background-position: center;
112
-        border-radius: 5px;
113
-        cursor: pointer;
114
-      }
115
-    }
116
-  }
117
-}
1
+.comment-image-preview-container {
2
+  .toolbar {
3
+    border-bottom: 1px solid #f2f2f2;
4
+    margin: 0 5px;
5
+    padding-bottom: 10px;
6
+    .button {
7
+      padding: 5px 10px;
8
+      cursor: pointer;
9
+      &.reversal i {
10
+        transform: rotate3d(0, 1, 0, 180deg);
11
+      }
12
+    }
13
+  }
14
+  .pictureWrapper {
15
+    position: relative; // width: 100%;
16
+    // padding-bottom: 68%;
17
+    // height: 0;
18
+    text-align: center;
19
+    margin-top: 15px;
20
+    padding: 0 5px;
21
+    .tools {
22
+      position: absolute;
23
+      left: 0;
24
+      top: 0;
25
+      bottom: 0;
26
+      right: 0;
27
+      .item {
28
+        width: 33%;
29
+        display: inline-block;
30
+        height: 100%;
31
+        &.left {
32
+          cursor: url("//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/73_yM_fx-.undefined"),
33
+            auto;
34
+        }
35
+        &.shrink {
36
+          cursor: url("//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/oGPpbJ7Rk.undefined"),
37
+            auto;
38
+        }
39
+        &.right {
40
+          cursor: url("//links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/S8obecP1d.undefined"),
41
+            auto;
42
+        }
43
+      }
44
+    }
45
+    .picture {
46
+      max-width: 100%;
47
+      max-height: 400px;
48
+    }
49
+    .tool() {
50
+      position: absolute;
51
+      width: 50px;
52
+      background-color: transparent;
53
+      z-index: 100;
54
+      opacity: 0.5;
55
+      font-size: 50px;
56
+      text-align: left;
57
+      cursor: pointer;
58
+      &:hover {
59
+        background-color: #fff;
60
+      }
61
+    }
62
+    .prev {
63
+      .tool();
64
+      left: 5px;
65
+      top: 0;
66
+      bottom: 0;
67
+    }
68
+    .next {
69
+      .tool();
70
+      right: 5px;
71
+      top: 0;
72
+      bottom: 0;
73
+    }
74
+    .middle {
75
+      position: absolute;
76
+      top: 50%;
77
+      transform: translateY(-50%);
78
+    } // .picture {
79
+    //     position: absolute;
80
+    //     bottom: 0;
81
+    //     top: 0;
82
+    //     left: 5px;
83
+    //     right: 5px;
84
+    //     background-size: contain;
85
+    //     background-position: center;
86
+    // }
87
+  }
88
+  .list {
89
+    font-size: 0;
90
+    margin-top: 25px;
91
+    .wrapper {
92
+      width: 11.1%;
93
+      height: 0;
94
+      padding-bottom: 11.1%;
95
+      position: relative;
96
+      display: inline-block;
97
+      border-radius: 5px;
98
+      border: 1px solid transparent;
99
+      opacity: 0.5;
100
+      &.active {
101
+        border: 1px solid #fc4747;
102
+        opacity: 1;
103
+      }
104
+      .thumbnail {
105
+        position: absolute;
106
+        top: 5px;
107
+        bottom: 5px;
108
+        left: 5px;
109
+        right: 5px;
110
+        background-size: cover;
111
+        background-position: center;
112
+        border-radius: 5px;
113
+        cursor: pointer;
114
+      }
115
+    }
116
+  }
117
+}

+ 3
- 3
lib/components/ImagePreviewer/README.md View File

@@ -1,4 +1,4 @@
1
-+ big //links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/QPI84fxmD.undefined
2
-+ small //links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/oGPpbJ7Rk.undefined
3
-+ prev //links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/73_yM_fx-.undefined
1
++ big //links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/QPI84fxmD.undefined
2
++ small //links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/oGPpbJ7Rk.undefined
3
++ prev //links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/73_yM_fx-.undefined
4 4
 + next //links-comment.oss-cn-beijing.aliyuncs.com/comment/20180928/S8obecP1d.undefined

+ 1
- 1
lib/components/RenderText/index.js.map View File

@@ -1 +1 @@
1
-{"version":3,"sources":["../../../src/components/RenderText/index.js"],"names":["App","__html","text"],"mappings":";;;;;;AAAA;;;;AACA;;;;AAEA,IAAMA,MAAM,SAANA,GAAM;AAAA,SACV;AACE,eAAU,sBADZ;AAEE,6BAAyB;AACvBC,cAAQ,2BAAcC,IAAd;AADe;AAF3B,IADU;AAAA,CAAZ;;kBASeF,G","file":"index.js","sourcesContent":["import React from \"react\";\nimport { renderContent } from \"../../helper\";\n\nconst App = text => (\n  <div\n    className=\"comment-item-content\"\n    dangerouslySetInnerHTML={{\n      __html: renderContent(text)\n    }}\n  />\n);\n\nexport default App;\n"]}
1
+{"version":3,"sources":["../../../src/components/RenderText/index.js"],"names":["App","__html","text"],"mappings":";;;;;;AAAA;;;;AACA;;;;AAEA,IAAMA,MAAM,SAANA,GAAM;AAAA,SACV;AACE,eAAU,sBADZ;AAEE,6BAAyB;AACvBC,cAAQ,2BAAcC,IAAd;AADe;AAF3B,IADU;AAAA,CAAZ;;kBASeF,G","file":"index.js","sourcesContent":["import React from \"react\";\r\nimport { renderContent } from \"../../helper\";\r\n\r\nconst App = text => (\r\n  <div\r\n    className=\"comment-item-content\"\r\n    dangerouslySetInnerHTML={{\r\n      __html: renderContent(text)\r\n    }}\r\n  />\r\n);\r\n\r\nexport default App;\r\n"]}

+ 2
- 2
lib/index.js View File

@@ -122,8 +122,8 @@ window.renderComment = renderComment;
122 122
 if (process.env.NODE_ENV !== "production") {
123 123
   renderComment({
124 124
     id: "root-comment",
125
-    type: 1,
126
-    businessId: "test",
125
+    type: 3,
126
+    businessId: "5ea8320dedd68200018e733d",
127 127
     businessUserId: 4,
128 128
     userId: 58297,
129 129
     currentUser: {

+ 1
- 1
lib/index.js.map
File diff suppressed because it is too large
View File


+ 1
- 1
lib/registerServiceWorker.js.map
File diff suppressed because it is too large
View File


+ 4
- 4
lib/version.json View File

@@ -1,8 +1,8 @@
1 1
 {
2 2
     "name":       "comment",
3
-    "buildDate":  1585374331505,
3
+    "buildDate":  1588147494452,
4 4
     "version":    "1.0.4",
5
-    "numCommits": 209,
6
-    "hash":       "daff054",
7
-    "dirty":      false
5
+    "numCommits": 210,
6
+    "hash":       "7da2eb9",
7
+    "dirty":      true
8 8
 }

+ 1
- 1
package.json View File

@@ -16,7 +16,7 @@
16 16
   "dependencies": {
17 17
     "antd": "^3.19.3",
18 18
     "axios": "^0.18.0",
19
-    "dayjs": "^1.7.2",
19
+    "dayjs": "^1.8.25",
20 20
     "js-cookie": "^2.2.0",
21 21
     "prop-types": "^15.6.2",
22 22
     "react": "^16.4.1",

+ 23
- 4
src/components/AudioPlayer/index.js View File

@@ -47,6 +47,26 @@ class AudioPlayer extends React.Component {
47 47
     }
48 48
   }
49 49
 
50
+  clickPlayOrPause(isPlaying) {
51
+    if (!this.player) {
52
+      return;
53
+    }
54
+    if (isPlaying) {
55
+      this.player.pause();
56
+    } else {
57
+      // 如果是播放,先暂停其他的播放
58
+      const playerList = document.getElementsByTagName("audio");
59
+      if (playerList) {
60
+        Array.from(playerList).forEach(player => {
61
+          if (!player.paused) {
62
+            player.pause();
63
+          }
64
+        });
65
+      }
66
+      this.player.play();
67
+    }
68
+  }
69
+
50 70
   render() {
51 71
     const { currentDuration, isPlaying, duration } = this.state;
52 72
     return (
@@ -60,10 +80,9 @@ class AudioPlayer extends React.Component {
60 80
         />
61 81
         <span
62 82
           className="icon"
63
-          onClick={() =>
64
-            this.player &&
65
-            (isPlaying ? this.player.pause() : this.player.play())
66
-          }
83
+          onClick={() => {
84
+            this.clickPlayOrPause(isPlaying);
85
+          }}
67 86
         >
68 87
           {isPlaying ? (
69 88
             <Icon className="pause" type="pause" />

+ 2
- 2
src/index.js View File

@@ -87,8 +87,8 @@ window.renderComment = renderComment;
87 87
 if (process.env.NODE_ENV !== "production") {
88 88
   renderComment({
89 89
     id: "root-comment",
90
-    type: 1,
91
-    businessId: "test",
90
+    type: 3,
91
+    businessId: "5ea8320dedd68200018e733d",
92 92
     businessUserId: 4,
93 93
     userId: 58297,
94 94
     currentUser: {