通用评论

index.js 3.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _spin = require("antd/es/spin");
  6. var _spin2 = _interopRequireDefault(_spin);
  7. 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; }; }();
  8. require("antd/es/spin/style/css");
  9. var _react = require("react");
  10. var _react2 = _interopRequireDefault(_react);
  11. var _Comment = require("../../Comment");
  12. var _Comment2 = _interopRequireDefault(_Comment);
  13. var _CommentBox = require("../CommentBox");
  14. var _CommentBox2 = _interopRequireDefault(_CommentBox);
  15. require("./index.css");
  16. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  18. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  19. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  20. var CommentList = function (_Component) {
  21. _inherits(CommentList, _Component);
  22. function CommentList(props) {
  23. _classCallCheck(this, CommentList);
  24. var _this = _possibleConstructorReturn(this, (CommentList.__proto__ || Object.getPrototypeOf(CommentList)).call(this, props));
  25. _this.state = {};
  26. return _this;
  27. }
  28. _createClass(CommentList, [{
  29. key: "render",
  30. value: function render() {
  31. var _props$app = this.props.app,
  32. list = _props$app.list,
  33. page = _props$app.page,
  34. loading = _props$app.loading,
  35. isNoMoreComment = _props$app.isNoMoreComment,
  36. sGetComment = _props$app.sGetComment;
  37. var spinning = Boolean(loading.sGetComment || loading.sCommentFavor);
  38. return _react2.default.createElement(
  39. "div",
  40. null,
  41. _react2.default.createElement(
  42. _spin2.default,
  43. { spinning: spinning },
  44. list.map(function (item) {
  45. return _react2.default.createElement(_CommentBox2.default, { content: item, key: item.id, commentId: item.id });
  46. }),
  47. !isNoMoreComment && _react2.default.createElement(
  48. "div",
  49. {
  50. className: "showMore",
  51. onClick: function onClick() {
  52. return sGetComment({ page: page + 1 });
  53. }
  54. },
  55. _react2.default.createElement(
  56. "span",
  57. null,
  58. "\u67E5\u770B\u66F4\u591A\u8BC4\u8BBA"
  59. )
  60. )
  61. )
  62. );
  63. }
  64. }]);
  65. return CommentList;
  66. }(_react.Component);
  67. CommentList.propTypes = {};
  68. exports.default = (0, _Comment2.default)(CommentList);
  69. //# sourceMappingURL=index.js.map