"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _icon = require("antd/es/icon"); var _icon2 = _interopRequireDefault(_icon); 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/icon/style/css"); var _react = require("react"); var _react2 = _interopRequireDefault(_react); var _propTypes = require("prop-types"); var _propTypes2 = _interopRequireDefault(_propTypes); var _Comment = require("../../Comment"); var _Comment2 = _interopRequireDefault(_Comment); var _ContentItem = require("./../ContentItem"); var _ContentItem2 = _interopRequireDefault(_ContentItem); var _ReplyItem = require("./../ReplyItem"); var _ReplyItem2 = _interopRequireDefault(_ReplyItem); 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 CommentBox = function (_Component) { _inherits(CommentBox, _Component); function CommentBox(props) { _classCallCheck(this, CommentBox); var _this = _possibleConstructorReturn(this, (CommentBox.__proto__ || Object.getPrototypeOf(CommentBox)).call(this, props)); _this.state = { showReply: true, page: 1 }; _this.handleToggleReply = _this.handleToggleReply.bind(_this); _this.handleGetMoreReply = _this.handleGetMoreReply.bind(_this); _this.renderReplies = _this.renderReplies.bind(_this); return _this; } /** * 切换是否显示回复列表 */ _createClass(CommentBox, [{ key: "handleToggleReply", value: function handleToggleReply() { this.setState({ showReply: !this.state.showReply }); } /** * 获取更多评论 * @param {string} commentId comment id */ }, { key: "handleGetMoreReply", value: function handleGetMoreReply(commentId) { // 从第一页开始获取评论 var page = this.state.page; this.props.app.sGetReply({ commentId: commentId, page: page }); this.setState({ page: page + 1 }); } /** * 渲染回复 DOM * @param {array} replies 回复列表 * @param {number} replies 回复的数量 * @param {boolean} isNoMoreReply 是否没有更多回复 */ // renderReplies(replies, replyCount, isNoMoreReply) { // console.log('replies', replies); // console.log('replyCount', replyCount); // console.log('isNoMoreReply', isNoMoreReply); // const { commentId } = this.props; // const { showReply } = this.state; // if (showReply && replies && replies.length) { // const len = replies.length; // return ( //