123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- "use strict";
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _spin = require("antd/es/spin");
-
- var _spin2 = _interopRequireDefault(_spin);
-
- var _pagination = require("antd/es/pagination");
-
- var _pagination2 = _interopRequireDefault(_pagination);
-
- 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; }; }();
-
- require("antd/es/spin/style/css");
-
- require("antd/es/pagination/style/css");
-
- var _react = require("react");
-
- var _react2 = _interopRequireDefault(_react);
-
- var _Comment = require("../../Comment");
-
- var _Comment2 = _interopRequireDefault(_Comment);
-
- var _CommentBox = require("../CommentBox");
-
- var _CommentBox2 = _interopRequireDefault(_CommentBox);
-
- require("./index.css");
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- 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; }
-
- 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; }
- // import intl from "react-intl-universal";
-
-
- var CommentList = function (_Component) {
- _inherits(CommentList, _Component);
-
- function CommentList(props) {
- _classCallCheck(this, CommentList);
-
- var _this = _possibleConstructorReturn(this, (CommentList.__proto__ || Object.getPrototypeOf(CommentList)).call(this, props));
-
- _this.state = {};
- return _this;
- }
-
- _createClass(CommentList, [{
- key: "componentWillMount",
- value: function componentWillMount() {
- this.props.app.sGetComment({ page: this.props.app.page });
- }
- }, {
- key: "renderPagination",
- value: function renderPagination() {
- var _props$app = this.props.app,
- list = _props$app.list,
- total = _props$app.total,
- page = _props$app.page,
- pageType = _props$app.pageType,
- limit = _props$app.limit,
- isNoMoreComment = _props$app.isNoMoreComment,
- sGetComment = _props$app.sGetComment,
- onPageChange = _props$app.onPageChange,
- onGetMoreBtnClick = _props$app.onGetMoreBtnClick;
-
- if (pageType === "slice") {
- // 截断多余评论,通过点击查看更多跳转
- return _react2.default.createElement(
- "div",
- { className: "comment-list-show-more", onClick: onGetMoreBtnClick },
- _react2.default.createElement(
- "span",
- null,
- "\u67E5\u770B\u66F4\u591A"
- )
- );
- } else if (pageType === "more") {
- if (!isNoMoreComment && list.length !== total) {
- return _react2.default.createElement(
- "div",
- {
- className: "comment-list-show-more",
- onClick: function onClick() {
- sGetComment({ page: page + 1 });
- onPageChange(page + 1);
- }
- },
- _react2.default.createElement(
- "span",
- null,
- "\u66F4\u591A\u8BC4\u8BBA"
- )
- );
- } else {
- return null;
- }
- } else if (pageType === "pagination") {
- return _react2.default.createElement(
- "div",
- { className: "comment-list-pagination" },
- _react2.default.createElement(_pagination2.default, {
- pageSize: limit,
- current: page,
- total: total,
- onChange: function onChange(p) {
- sGetComment({ page: p });
- onPageChange(p);
- }
- })
- );
- }
- }
- }, {
- key: "render",
- value: function render() {
- var _props$app2 = this.props.app,
- list = _props$app2.list,
- total = _props$app2.total,
- loading = _props$app2.loading;
-
-
- var spinning = Boolean(loading.sGetComment || loading.sCommentFavor || loading.sReplyFavor);
- return _react2.default.createElement(
- "div",
- null,
- _react2.default.createElement(
- _spin2.default,
- { spinning: spinning },
- list.map(function (item) {
- return _react2.default.createElement(_CommentBox2.default, { content: item, key: item.id, commentId: item.id });
- }),
- this.renderPagination()
- )
- );
- }
- }]);
-
- return CommentList;
- }(_react.Component);
-
- CommentList.propTypes = {};
-
- exports.default = (0, _Comment2.default)(CommentList);
- //# sourceMappingURL=index.js.map
|