通用评论

index.js 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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: "componentWillMount",
  30. value: function componentWillMount() {
  31. this.props.app.sGetComment();
  32. }
  33. }, {
  34. key: "render",
  35. value: function render() {
  36. var _props$app = this.props.app,
  37. list = _props$app.list,
  38. page = _props$app.page,
  39. loading = _props$app.loading,
  40. isNoMoreComment = _props$app.isNoMoreComment,
  41. sGetComment = _props$app.sGetComment;
  42. var spinning = Boolean(loading.sGetComment || loading.sCommentFavor);
  43. return _react2.default.createElement(
  44. "div",
  45. null,
  46. _react2.default.createElement(
  47. _spin2.default,
  48. { spinning: spinning },
  49. list.map(function (item) {
  50. return _react2.default.createElement(_CommentBox2.default, { content: item, key: item.id, commentId: item.id });
  51. }),
  52. !isNoMoreComment && _react2.default.createElement(
  53. "div",
  54. {
  55. className: "showMore",
  56. onClick: function onClick() {
  57. return sGetComment({ page: page + 1 });
  58. }
  59. },
  60. _react2.default.createElement(
  61. "span",
  62. null,
  63. "\u67E5\u770B\u66F4\u591A\u8BC4\u8BBA"
  64. )
  65. )
  66. )
  67. );
  68. }
  69. }]);
  70. return CommentList;
  71. }(_react.Component);
  72. CommentList.propTypes = {};
  73. exports.default = (0, _Comment2.default)(CommentList);
  74. //# sourceMappingURL=index.js.map