通用评论 vedio

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 _pagination = require("antd/es/pagination");
  8. var _pagination2 = _interopRequireDefault(_pagination);
  9. 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; }; }();
  10. require("antd/es/spin/style/css");
  11. require("antd/es/pagination/style/css");
  12. var _react = require("react");
  13. var _react2 = _interopRequireDefault(_react);
  14. var _Comment = require("../../Comment");
  15. var _Comment2 = _interopRequireDefault(_Comment);
  16. var _CommentBox = require("../CommentBox");
  17. var _CommentBox2 = _interopRequireDefault(_CommentBox);
  18. require("./index.css");
  19. var _constant = require("../../constant");
  20. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  21. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  22. 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; }
  23. 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; }
  24. var CommentList = function (_Component) {
  25. _inherits(CommentList, _Component);
  26. function CommentList(props) {
  27. _classCallCheck(this, CommentList);
  28. var _this = _possibleConstructorReturn(this, (CommentList.__proto__ || Object.getPrototypeOf(CommentList)).call(this, props));
  29. _this.state = {};
  30. return _this;
  31. }
  32. _createClass(CommentList, [{
  33. key: "componentWillMount",
  34. value: function componentWillMount() {
  35. this.props.app.sGetComment({ page: this.props.app.page });
  36. }
  37. }, {
  38. key: "renderPagination",
  39. value: function renderPagination() {
  40. var _props$app = this.props.app,
  41. list = _props$app.list,
  42. total = _props$app.total,
  43. page = _props$app.page,
  44. pageType = _props$app.pageType,
  45. isNoMoreComment = _props$app.isNoMoreComment,
  46. sGetComment = _props$app.sGetComment,
  47. onPageChange = _props$app.onPageChange;
  48. if (pageType === "more") {
  49. if (!isNoMoreComment && list.length !== total) {
  50. return _react2.default.createElement(
  51. "div",
  52. {
  53. className: "comment-list-show-more",
  54. onClick: function onClick() {
  55. sGetComment({ page: page + 1 });
  56. onPageChange(page + 1);
  57. }
  58. },
  59. _react2.default.createElement(
  60. "span",
  61. null,
  62. "\u67E5\u770B\u66F4\u591A\u8BC4\u8BBA"
  63. )
  64. );
  65. } else {
  66. return null;
  67. }
  68. } else if (pageType === "pagination") {
  69. return _react2.default.createElement(
  70. "div",
  71. { className: "comment-list-pagination" },
  72. _react2.default.createElement(_pagination2.default, {
  73. pageSize: _constant.LIMIT,
  74. current: page,
  75. total: total,
  76. onChange: function onChange(p) {
  77. sGetComment({ page: p });
  78. onPageChange(p);
  79. }
  80. })
  81. );
  82. }
  83. }
  84. }, {
  85. key: "render",
  86. value: function render() {
  87. var _props$app2 = this.props.app,
  88. list = _props$app2.list,
  89. total = _props$app2.total,
  90. loading = _props$app2.loading;
  91. var spinning = Boolean(loading.sGetComment || loading.sCommentFavor || loading.sReplyFavor);
  92. return _react2.default.createElement(
  93. "div",
  94. null,
  95. _react2.default.createElement(
  96. _spin2.default,
  97. { spinning: spinning },
  98. _react2.default.createElement(
  99. "div",
  100. null,
  101. "\u5171 ",
  102. total,
  103. " \u6761\u8BC4\u8BBA"
  104. ),
  105. list.map(function (item) {
  106. return _react2.default.createElement(_CommentBox2.default, { content: item, key: item.id, commentId: item.id });
  107. }),
  108. this.renderPagination()
  109. )
  110. );
  111. }
  112. }]);
  113. return CommentList;
  114. }(_react.Component);
  115. CommentList.propTypes = {};
  116. exports.default = (0, _Comment2.default)(CommentList);
  117. //# sourceMappingURL=index.js.map