通用评论

App.js 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.RenderText = exports.Editor = undefined;
  6. var _message2 = require("antd/es/message");
  7. var _message3 = _interopRequireDefault(_message2);
  8. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  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/message/style/css");
  11. var _react = require("react");
  12. var _react2 = _interopRequireDefault(_react);
  13. var _propTypes = require("prop-types");
  14. var _propTypes2 = _interopRequireDefault(_propTypes);
  15. var _axios = require("axios");
  16. var _axios2 = _interopRequireDefault(_axios);
  17. var _jsCookie = require("js-cookie");
  18. var _jsCookie2 = _interopRequireDefault(_jsCookie);
  19. var _reactIntlUniversal = require("react-intl-universal");
  20. var _reactIntlUniversal2 = _interopRequireDefault(_reactIntlUniversal);
  21. var _constant = require("./constant");
  22. var _Comment = require("./Comment");
  23. var _helper = require("./helper");
  24. var _CommentInput = require("./components/CommentInput");
  25. var _CommentInput2 = _interopRequireDefault(_CommentInput);
  26. var _CommentList = require("./components/CommentList");
  27. var _CommentList2 = _interopRequireDefault(_CommentList);
  28. var _Editor = require("./components/Editor");
  29. var _Editor2 = _interopRequireDefault(_Editor);
  30. var _RenderText = require("./components/RenderText");
  31. var _RenderText2 = _interopRequireDefault(_RenderText);
  32. var _lang = require("./lang");
  33. require("./App.css");
  34. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  35. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  36. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  37. 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; }
  38. 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; }
  39. var App = function (_Component) {
  40. _inherits(App, _Component);
  41. function App(props) {
  42. _classCallCheck(this, App);
  43. var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this, props));
  44. _this.state = {
  45. loading: {},
  46. // oss 配置
  47. oss: {},
  48. // 评论数据
  49. list: [],
  50. page: 1,
  51. total: 0,
  52. // 是否没有更多评论了
  53. isNoMoreComment: false,
  54. initDone: false,
  55. locale: "zh-CN"
  56. };
  57. _this.handleChangeLoading = _this.handleChangeLoading.bind(_this);
  58. _this.sCreateComment = _this.sCreateComment.bind(_this);
  59. _this.sDeleteComment = _this.sDeleteComment.bind(_this);
  60. _this.sCommentFavor = _this.sCommentFavor.bind(_this);
  61. _this.sCreateReply = _this.sCreateReply.bind(_this);
  62. _this.sDeleteReply = _this.sDeleteReply.bind(_this);
  63. _this.errorHandler = _this.errorHandler.bind(_this);
  64. _this.sGetComment = _this.sGetComment.bind(_this);
  65. _this.sReplyFavor = _this.sReplyFavor.bind(_this);
  66. _this.sGetReply = _this.sGetReply.bind(_this);
  67. _this.sOssSts = _this.sOssSts.bind(_this);
  68. return _this;
  69. }
  70. _createClass(App, [{
  71. key: "componentWillMount",
  72. value: function componentWillMount() {
  73. this.axios = _axios2.default;
  74. this.axios.defaults.withCredentials = true;
  75. if (this.props.token) {
  76. this.axios.defaults.headers.common["Authorization"] = "Bearer " + this.props.token;
  77. }
  78. }
  79. }, {
  80. key: "componentDidMount",
  81. value: function componentDidMount() {
  82. this.loadLocales();
  83. }
  84. /**
  85. * 加载语言包
  86. * 只能根据url或者传入的props来确定加载哪个语言包
  87. * 优先级:传入的props > url
  88. */
  89. }, {
  90. key: "loadLocales",
  91. value: function loadLocales() {
  92. var _this2 = this;
  93. var currentLocale = this.props.locales;
  94. var cookieLang = _jsCookie2.default.get("lnk_lang");
  95. if (!currentLocale) {
  96. currentLocale = cookieLang || _reactIntlUniversal2.default.determineLocale({
  97. urlLocaleKey: "lang"
  98. });
  99. }
  100. currentLocale = _lang.SUPPORT_LOCALES.find(function (item) {
  101. return item.value === currentLocale;
  102. }) ? currentLocale : "zh-CN";
  103. var version = require("./version.json").hash;
  104. // 使用绝对路径
  105. var languageURL = _constant.LANGUAGE_LINK + "/" + currentLocale + ".json?v=" + version;
  106. return fetch(languageURL).then(function (response) {
  107. if (response.status >= 400) {
  108. throw new Error("Bad response from server");
  109. }
  110. return response.json();
  111. }).then(function (data) {
  112. // console.log('data: ', data);
  113. _reactIntlUniversal2.default.init({
  114. currentLocale: currentLocale,
  115. locales: _defineProperty({}, currentLocale, data)
  116. }).then(function () {
  117. _this2.setState({ initDone: true, locale: currentLocale });
  118. });
  119. });
  120. }
  121. }, {
  122. key: "error",
  123. value: function error(msg) {
  124. var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  125. if (this.props.showError) {
  126. _message3.default.error(msg);
  127. }
  128. if (this.props.onError) {
  129. this.props.onError(msg, info);
  130. }
  131. }
  132. }, {
  133. key: "errorHandler",
  134. value: function errorHandler(error) {
  135. var locale = this.state.locale;
  136. var localResponse = _lang.LOCALES_RESPONSE[locale];
  137. if (error.response && error.response.data && error.response.data.msg) {
  138. this.error(localResponse[error.response.data.msg] || _constant.ERROR_DEFAULT, {
  139. response: error.response
  140. });
  141. return;
  142. }
  143. this.error(localResponse[error.response.data.msg] || _constant.ERROR_DEFAULT, {
  144. response: error.response
  145. });
  146. }
  147. /**
  148. * 改变 loading 状态
  149. * @param {string} key key
  150. * @param {string} value value
  151. */
  152. }, {
  153. key: "handleChangeLoading",
  154. value: function handleChangeLoading(key, value) {
  155. var loading = this.state.loading;
  156. loading[key] = value;
  157. this.setState({ loading: loading });
  158. }
  159. /**
  160. * 获取评论列表
  161. */
  162. }, {
  163. key: "sGetComment",
  164. value: function sGetComment() {
  165. var _this3 = this;
  166. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  167. _ref$page = _ref.page,
  168. page = _ref$page === undefined ? 1 : _ref$page;
  169. var pageType = this.props.pageType;
  170. this.handleChangeLoading("sGetComment", true);
  171. var _props = this.props,
  172. API = _props.API,
  173. type = _props.type,
  174. businessId = _props.businessId,
  175. limit = _props.limit;
  176. this.axios.get(API + "/comments?type=" + type + "&business_id=" + businessId + "&page=" + page + "&limit=" + limit).then(function (response) {
  177. var _response$data = response.data,
  178. list = _response$data.list,
  179. page = _response$data.page,
  180. total = _response$data.total;
  181. if (list) {
  182. var newList = list;
  183. var oldList = _this3.state.list;
  184. if (pageType === "more") {
  185. if (page > 1) {
  186. // 删除临时数据
  187. oldList = oldList.filter(function (o) {
  188. return !o.isTemporary;
  189. });
  190. newList = oldList.concat(newList);
  191. }
  192. } else if (pageType === "pagination") {
  193. // TODO 滚动到顶部
  194. window.scrollTo(0, 0);
  195. }
  196. _this3.setState({
  197. list: newList,
  198. page: page,
  199. total: total
  200. });
  201. _this3.props.onCountChange(total);
  202. } else {
  203. _message3.default.info(_reactIntlUniversal2.default.get("message.noMoreComment"));
  204. _this3.setState({
  205. isNoMoreComment: true
  206. });
  207. }
  208. }).catch(this.errorHandler).finally(function () {
  209. _this3.handleChangeLoading("sGetComment", false);
  210. });
  211. }
  212. /**
  213. * 获取更多回复
  214. */
  215. }, {
  216. key: "sGetReply",
  217. value: function sGetReply() {
  218. var _this4 = this;
  219. var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  220. commentId = _ref2.commentId,
  221. _ref2$page = _ref2.page,
  222. page = _ref2$page === undefined ? 1 : _ref2$page;
  223. this.handleChangeLoading("sGetReply", true);
  224. var _props2 = this.props,
  225. API = _props2.API,
  226. limit = _props2.limit;
  227. this.axios.get(API + "/replies?comment_id=" + commentId + "&page=" + page + "&limit=" + limit).then(function (response) {
  228. if (!response.data.list) {
  229. _message3.default.info(_reactIntlUniversal2.default.get("message.noMoreData"));
  230. }
  231. var list = _this4.state.list.map(function (item) {
  232. if (item.id === commentId) {
  233. if (!item.replies) item.replies = [];
  234. if (response.data.list) {
  235. if (page === 1) {
  236. // 如果当前页数为第一页,则清空当前所有的 replies
  237. // 并将获取到的 replies 存放在 state
  238. item.replies = response.data.list;
  239. } else {
  240. item.replies = item.replies.filter(function (o) {
  241. return !o.isTemporary;
  242. }).concat(response.data.list);
  243. // 如果当前页数非第一页,则合并 replies
  244. }
  245. item.reply_count = response.data.total;
  246. item.reply_page = response.data.page;
  247. } else {
  248. item.isNoMoreReply = true;
  249. }
  250. }
  251. return item;
  252. });
  253. _this4.setState({ list: list });
  254. }).catch(this.errorHandler).finally(function () {
  255. _this4.handleChangeLoading("sGetReply", false);
  256. });
  257. }
  258. /**
  259. * 添加评论
  260. * @param {object} {content} comment content
  261. */
  262. }, {
  263. key: "sCreateComment",
  264. value: function sCreateComment() {
  265. var _this5 = this;
  266. var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  267. content = _ref3.content;
  268. var cb = arguments[1];
  269. if (!content) return this.error(_reactIntlUniversal2.default.get("message.notNull"));
  270. this.handleChangeLoading("sCreateComment", true);
  271. var _props3 = this.props,
  272. API = _props3.API,
  273. type = _props3.type,
  274. businessId = _props3.businessId,
  275. businessUserId = _props3.businessUserId;
  276. this.axios(API + "/comments", {
  277. method: "post",
  278. data: {
  279. type: type,
  280. business_id: businessId,
  281. business_user_id: businessUserId,
  282. content: content
  283. },
  284. withCredentials: true
  285. }).then(function (response) {
  286. if (_this5.props.showAlertComment) {
  287. _message3.default.success(_reactIntlUniversal2.default.get("message.success"));
  288. }
  289. if ((0, _helper.isFunction)(cb)) cb(response.data);
  290. // 将数据写入到 list 中
  291. // 临时插入
  292. // 等到获取数据之后,删除临时数据
  293. var _state = _this5.state,
  294. list = _state.list,
  295. total = _state.total;
  296. list.unshift(_extends({}, response.data, {
  297. isTemporary: true // 临时的数据
  298. }));
  299. _this5.setState({ list: list, total: total + 1 });
  300. _this5.props.onCountChange(total + 1);
  301. }).catch(this.errorHandler).finally(function () {
  302. _this5.handleChangeLoading("sCreateComment", false);
  303. });
  304. }
  305. /**
  306. * 删除评论
  307. */
  308. }, {
  309. key: "sDeleteComment",
  310. value: function sDeleteComment(commentId) {
  311. var _this6 = this;
  312. this.handleChangeLoading("sDeleteComment", true);
  313. var API = this.props.API;
  314. this.axios(API + "/comments/" + commentId, {
  315. method: "delete",
  316. withCredentials: true
  317. }).then(function () {
  318. var _state2 = _this6.state,
  319. list = _state2.list,
  320. total = _state2.total;
  321. var res = list.filter(function (item) {
  322. return item.id !== commentId;
  323. });
  324. var deletedItem = list.find(function (item) {
  325. return item.id === commentId;
  326. });
  327. _this6.setState({ list: res, total: total - 1 });
  328. _this6.props.onDelete(_constant.COMMENT_TYPE.COMMENT, deletedItem);
  329. _this6.props.onCountChange(total - 1);
  330. }).catch(this.errorHandler).finally(function () {
  331. _this6.handleChangeLoading("sDeleteComment", false);
  332. });
  333. }
  334. /**
  335. * 添加回复
  336. * 回复评论/回复回复
  337. * @param {object} data { comment_id, content, [reply_id] }
  338. */
  339. }, {
  340. key: "sCreateReply",
  341. value: function sCreateReply(data, cb) {
  342. var _this7 = this;
  343. if (!data.content) return this.error(_reactIntlUniversal2.default.get("message.replyNoNull"));
  344. this.handleChangeLoading("sCreateReply", true);
  345. var API = this.props.API;
  346. this.axios(API + "/replies", {
  347. method: "post",
  348. data: data,
  349. withCredentials: true
  350. }).then(function (response) {
  351. if (_this7.props.showAlertReply) {
  352. _message3.default.success(_reactIntlUniversal2.default.get("message.replySuccess"));
  353. }
  354. if ((0, _helper.isFunction)(cb)) cb(response.data);
  355. // 将数据写入到 list 中
  356. // 临时插入
  357. // 等到获取数据之后,删除临时数据
  358. var list = _this7.state.list.map(function (item) {
  359. if (item.id === data.comment_id) {
  360. if (!item.replies) item.replies = [];
  361. item.replies.push(_extends({}, response.data, {
  362. isTemporary: true // 临时的数据
  363. }));
  364. item.reply_count += 1;
  365. }
  366. return item;
  367. });
  368. _this7.setState({ list: list });
  369. }).catch(this.errorHandler).finally(function () {
  370. _this7.handleChangeLoading("sCreateReply", false);
  371. });
  372. }
  373. /**
  374. * 删除回复
  375. * @param {*} replyId
  376. * @param {*} commentId
  377. */
  378. }, {
  379. key: "sDeleteReply",
  380. value: function sDeleteReply(replyId, commentId) {
  381. var _this8 = this;
  382. this.handleChangeLoading("sDeleteReply", true);
  383. var API = this.props.API;
  384. this.axios(API + "/replies/" + replyId + "?CommentID=" + commentId, {
  385. method: "delete",
  386. withCredentials: true
  387. }).then(function () {
  388. var deletedItem = null;
  389. var list = _this8.state.list.map(function (item) {
  390. if (item.id === commentId) {
  391. var replies = item.replies.filter(function (item) {
  392. return item.id !== replyId;
  393. });
  394. deletedItem = item.replies.find(function (item) {
  395. return item.id === replyId;
  396. });
  397. item.replies = replies;
  398. item.reply_count -= 1;
  399. }
  400. return item;
  401. });
  402. _this8.setState({ list: list });
  403. _this8.props.onDelete(_constant.COMMENT_TYPE.REPLY, deletedItem);
  404. }).catch(this.errorHandler).finally(function () {
  405. _this8.handleChangeLoading("sDeleteReply", false);
  406. });
  407. }
  408. /**
  409. * 评论 点赞/取消点赞
  410. * @param {string} commentId { commentId }
  411. * @param {boolean} favored 是否已经点过赞
  412. */
  413. }, {
  414. key: "sCommentFavor",
  415. value: function sCommentFavor(commentId, favored) {
  416. var _this9 = this;
  417. this.handleChangeLoading("sCommentFavor", true);
  418. var API = this.props.API;
  419. this.axios(API + "/comments/" + commentId + "/favor", {
  420. method: favored ? "delete" : "put",
  421. withCredentials: true
  422. }).then(function (response) {
  423. if (_this9.props.showAlertFavor) {
  424. _message3.default.success(favored ? _reactIntlUniversal2.default.get("message.cancelLickSuccess") : _reactIntlUniversal2.default.get("message.likeSuccess"));
  425. }
  426. // 更新 list 中的该项数据的 favored
  427. var list = _this9.state.list.map(function (item) {
  428. if (item.id === commentId) {
  429. item.favored = !favored;
  430. item.favor_count += favored ? -1 : 1;
  431. }
  432. return item;
  433. });
  434. _this9.setState({ list: list });
  435. }).catch(this.errorHandler).finally(function () {
  436. _this9.handleChangeLoading("sCommentFavor", false);
  437. });
  438. }
  439. /**
  440. * 回复 点赞/取消点赞
  441. * @param {string} replyId replyId
  442. * @param {string} commentId commentId
  443. * @param {boolean} favored 是否已经点过赞
  444. */
  445. }, {
  446. key: "sReplyFavor",
  447. value: function sReplyFavor(replyId, commentId, favored) {
  448. var _this10 = this;
  449. this.handleChangeLoading("sReplyFavor", true);
  450. var API = this.props.API;
  451. this.axios(API + "/replies/" + replyId + "/favor", {
  452. method: favored ? "delete" : "put",
  453. data: {
  454. comment_id: commentId
  455. },
  456. withCredentials: true
  457. }).then(function (response) {
  458. _message3.default.success(favored ? _reactIntlUniversal2.default.get("message.cancelLickSuccess") : _reactIntlUniversal2.default.get("message.likeSuccess"));
  459. // 更新 list 中的该项数据的 favored
  460. var list = _this10.state.list.map(function (item) {
  461. if (item.id === commentId) {
  462. item.replies = item.replies.map(function (r) {
  463. if (r.id === replyId) {
  464. r.favored = !favored;
  465. // r.favor_count = response.data.favor_count;
  466. // 点赞数 +1,而不是使用后端返回的点赞数
  467. // 不然如果返回的不是增加 1,用户可能以为程序错误
  468. r.favor_count += favored ? -1 : 1;
  469. }
  470. return r;
  471. });
  472. }
  473. return item;
  474. });
  475. _this10.setState({ list: list });
  476. }).catch(this.errorHandler).finally(function () {
  477. _this10.handleChangeLoading("sReplyFavor", false);
  478. });
  479. }
  480. /**
  481. * 获取 OSS 上传的参数
  482. */
  483. }, {
  484. key: "sOssSts",
  485. value: function sOssSts() {
  486. var _this11 = this;
  487. this.handleChangeLoading("sOssSts", true);
  488. var API = this.props.API;
  489. this.axios.get(API + "/oss/sts").then(function (response) {
  490. _this11.setState({ oss: _extends({}, response.data) });
  491. }).catch(this.errorHandler).finally(function () {
  492. _this11.handleChangeLoading("sOssSts", false);
  493. });
  494. }
  495. }, {
  496. key: "render",
  497. value: function render() {
  498. // 添加到 Context 的数据
  499. var value = _extends({}, this.state, this.props, {
  500. sCreateComment: this.sCreateComment,
  501. sGetComment: this.sGetComment,
  502. sCommentFavor: this.sCommentFavor,
  503. sReplyFavor: this.sReplyFavor,
  504. sCreateReply: this.sCreateReply,
  505. sGetReply: this.sGetReply,
  506. sOssSts: this.sOssSts,
  507. sDeleteComment: this.sDeleteComment,
  508. sDeleteReply: this.sDeleteReply
  509. });
  510. return this.state.initDone && _react2.default.createElement(
  511. _Comment.CommentContext.Provider,
  512. { value: value },
  513. _react2.default.createElement(
  514. "div",
  515. { className: "comment" },
  516. this.props.showEditor && _react2.default.createElement(_CommentInput2.default, { content: this.props.children }),
  517. this.props.showList && _react2.default.createElement(
  518. "div",
  519. { style: { marginTop: 20 } },
  520. _react2.default.createElement(_CommentList2.default, null)
  521. )
  522. )
  523. );
  524. }
  525. }]);
  526. return App;
  527. }(_react.Component);
  528. App.propTypes = {
  529. type: _propTypes2.default.number.isRequired, // 评论的 type
  530. businessId: _propTypes2.default.string.isRequired, // 评论的 business_id
  531. businessUserId: _propTypes2.default.number,
  532. API: _propTypes2.default.string, // 评论的 API 前缀
  533. showList: _propTypes2.default.bool, // 是否显示评论列表
  534. showEditor: _propTypes2.default.bool, // 是否显示评论输入框
  535. showAlertComment: _propTypes2.default.bool, // 评论成功之后,是否通过 Antd 的 Message 组件进行提示
  536. showAlertReply: _propTypes2.default.bool, // 回复成功之后,是否通过 Antd 的 Message 组件进行提示
  537. showAlertFavor: _propTypes2.default.bool, // 点赞/取消点赞成功之后,是否通过 Antd 的 Message 组件进行提示
  538. showError: _propTypes2.default.bool, // 是否使用Antd的Message组件提示错误信息
  539. onError: _propTypes2.default.func, // 错误回调, 出错了会被调用
  540. userId: _propTypes2.default.number, // 用户id, comment内部不维护用户id, 调用组件时传递过来, 目前用于判断是否显示删除按钮
  541. pageType: _propTypes2.default.string, // 分页类型
  542. page: _propTypes2.default.number, // 页码
  543. limit: _propTypes2.default.number, // 一次加载评论数量
  544. onPageChange: _propTypes2.default.func, // 页码变化回调
  545. onGetMoreBtnClick: _propTypes2.default.func, // 点击查看更多按钮回调
  546. onDelete: _propTypes2.default.func,
  547. locales: _propTypes2.default.string, // 传入的语言环境, en-US/zh-CN
  548. onCountChange: _propTypes2.default.func // 评论数量变更时的回调
  549. };
  550. App.defaultProps = {
  551. businessUserId: 0,
  552. API: "//api.links123.net/comment/v1",
  553. showList: true,
  554. showEditor: true,
  555. showAlertComment: false,
  556. showAlertReply: false,
  557. showAlertFavor: false,
  558. showError: true,
  559. pageType: "more",
  560. limit: _constant.LIMIT,
  561. onGetMoreBtnClick: function onGetMoreBtnClick() {},
  562. onPageChange: function onPageChange(page) {},
  563. onDelete: function onDelete() {},
  564. onCountChange: function onCountChange() {}
  565. };
  566. exports.Editor = _Editor2.default;
  567. exports.RenderText = _RenderText2.default;
  568. exports.default = App;
  569. //# sourceMappingURL=App.js.map