{"version":3,"sources":["../src/App.js"],"names":["App","props","state","loading","oss","list","page","total","isNoMoreComment","initDone","locale","handleChangeLoading","bind","sCreateComment","sDeleteComment","sCommentFavor","sCreateReply","sDeleteReply","errorHandler","sGetComment","sReplyFavor","sGetReply","sOssSts","axios","defaults","withCredentials","token","headers","common","loadLocales","currentLocale","locales","cookieLang","Cookies","get","intl","determineLocale","urlLocaleKey","SUPPORT_LOCALES","find","item","value","version","require","hash","languageURL","LANGUAGE_LINK","fetch","then","response","status","Error","json","init","data","setState","msg","info","showError","error","onError","localResponse","LOCALES_RESPONSE","ERROR_DEFAULT","key","pageType","API","type","businessId","limit","newList","oldList","filter","o","isTemporary","concat","window","scrollTo","onCountChange","catch","finally","commentId","map","id","replies","reply_count","reply_page","isNoMoreReply","content","cb","businessUserId","method","business_id","business_user_id","showAlertComment","success","unshift","res","onDelete","COMMENT_TYPE","COMMENT","showAlertReply","comment_id","push","replyId","REPLY","favored","showAlertFavor","favor_count","r","showEditor","children","showList","marginTop","Component","propTypes","PropTypes","number","isRequired","string","bool","func","userId","onPageChange","onGetMoreBtnClick","defaultProps","LIMIT","Editor","RenderText"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;AACA;;;;AAEA;;;;AACA;;;;AACA;;;;AACA;;AACA;;AACA;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;AACA;;;;;;;;;;;;IAEMA,G;;;AACJ,eAAYC,KAAZ,EAAmB;AAAA;;AAAA,0GACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa;AACXC,eAAS,EADE;;AAGX;AACAC,WAAK,EAJM;;AAMX;AACAC,YAAM,EAPK;AAQXC,YAAM,CARK;AASXC,aAAO,CATI;AAUX;AACAC,uBAAiB,KAXN;AAYXC,gBAAU,KAZC;AAaXC,cAAQ;AAbG,KAAb;AAeA,UAAKC,mBAAL,GAA2B,MAAKA,mBAAL,CAAyBC,IAAzB,OAA3B;AACA,UAAKC,cAAL,GAAsB,MAAKA,cAAL,CAAoB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kBAAgBe,oBAAUI,IARZ,EAQkB;AAChCb,kBAAgBS,oBAAUI,IATZ,EASkB;AAChC9D,aAAW0D,oBAAUI,IAVP,EAUa;AAC3B5D,WAASwD,oBAAUK,IAXL,EAWW;AACzBC,UAAQN,oBAAUC,MAZJ,EAYY;AAC1BpD,YAAUmD,oBAAUG,MAbN,EAac;AAC5BjH,QAAM8G,oBAAUC,MAdF,EAcU;AACxBhD,SAAO+C,oBAAUC,MAfH,EAeW;AACzBM,gBAAcP,oBAAUK,IAhBV,EAgBgB;AAC9BG,qBAAmBR,oBAAUK,IAjBf,EAiBqB;AACnCvB,YAAUkB,oBAAUK,IAlBN;AAmBd1F,WAASqF,oBAAUG,MAnBL,EAmBa;AAC3BzC,iBAAesC,oBAAUK,IApBX,CAoBgB;AApBhB,CAAhB;;AAuBAzH,IAAI6H,YAAJ,GAAmB;AACjBnC,kBAAgB,CADC;AAEjBxB,OAAK,+BAFY;AAGjB8C,YAAU,IAHO;AAIjBF,cAAY,IAJK;AAKjBhB,oBAAkB,KALD;AAMjBO,kBAAgB,KANC;AAOjBM,kBAAgB,KAPC;AAQjBjD,aAAW,IARM;AASjBO,YAAU,MATO;AAUjBI,SAAOyD,eAVU;AAWjBF,qBAAmB,6BAAM,CAAE,CAXV;AAYjBD,gBAAc,4BAAQ,CAAE,CAZP;AAajBzB,YAAU,oBAAM,CAAE,CAbD;AAcjBpB,iBAAe,yBAAM,CAAE;AAdN,CAAnB;;QAiBSiD,M,GAAAA,gB;QAAQC,U,GAAAA,oB;kBAEFhI,G","file":"App.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { message } from \"antd\";\nimport axios from \"axios\";\nimport Cookies from \"js-cookie\";\nimport intl from \"react-intl-universal\";\nimport { ERROR_DEFAULT, LIMIT, COMMENT_TYPE, LANGUAGE_LINK } from \"./constant\";\nimport { CommentContext } from \"./Comment\";\nimport { isFunction } from \"./helper\";\nimport CommentInput from \"./components/CommentInput\";\nimport CommentList from \"./components/CommentList\";\nimport Editor from \"./components/Editor\";\nimport RenderText from \"./components/RenderText\";\nimport { SUPPORT_LOCALES, LOCALES_RESPONSE } from \"./lang\";\nimport \"./App.css\";\n\nclass App extends Component {\n constructor(props) {\n super(props);\n this.state = {\n loading: {},\n\n // oss 配置\n oss: {},\n\n // 评论数据\n list: [],\n page: 1,\n total: 0,\n // 是否没有更多评论了\n isNoMoreComment: false,\n initDone: false,\n locale: \"zh-CN\"\n };\n this.handleChangeLoading = this.handleChangeLoading.bind(this);\n this.sCreateComment = this.sCreateComment.bind(this);\n this.sDeleteComment = this.sDeleteComment.bind(this);\n this.sCommentFavor = this.sCommentFavor.bind(this);\n this.sCreateReply = this.sCreateReply.bind(this);\n this.sDeleteReply = this.sDeleteReply.bind(this);\n this.errorHandler = this.errorHandler.bind(this);\n this.sGetComment = this.sGetComment.bind(this);\n this.sReplyFavor = this.sReplyFavor.bind(this);\n this.sGetReply = this.sGetReply.bind(this);\n this.sOssSts = this.sOssSts.bind(this);\n }\n\n componentWillMount() {\n this.axios = axios;\n this.axios.defaults.withCredentials = true;\n if (this.props.token) {\n this.axios.defaults.headers.common[\"Authorization\"] = `Bearer ${\n this.props.token\n }`;\n }\n }\n\n componentDidMount() {\n this.loadLocales();\n }\n\n /**\n * 加载语言包\n * 只能根据url或者传入的props来确定加载哪个语言包\n * 优先级:传入的props > url\n */\n loadLocales() {\n let { locales: currentLocale } = this.props;\n const cookieLang = Cookies.get(\"lnk_lang\");\n if (!currentLocale) {\n currentLocale =\n cookieLang ||\n intl.determineLocale({\n urlLocaleKey: \"lang\"\n });\n }\n currentLocale = SUPPORT_LOCALES.find(item => item.value === currentLocale)\n ? currentLocale\n : \"zh-CN\";\n const version = require(\"./version.json\").hash;\n // 使用绝对路径\n const languageURL = `${LANGUAGE_LINK}/${currentLocale}.json?v=${version}`;\n return fetch(languageURL)\n .then(response => {\n if (response.status >= 400) {\n throw new Error(\"Bad response from server\");\n }\n return response.json();\n })\n .then(data => {\n // console.log('data: ', data);\n intl\n .init({\n currentLocale,\n locales: {\n [currentLocale]: data\n }\n })\n .then(() => {\n this.setState({ initDone: true, locale: currentLocale });\n });\n });\n }\n\n error(msg, info = {}) {\n if (this.props.showError) {\n message.error(msg);\n }\n if (this.props.onError) {\n this.props.onError(msg, info);\n }\n }\n\n errorHandler(error) {\n const { locale } = this.state;\n const localResponse = LOCALES_RESPONSE[locale];\n if (error.response && error.response.data && error.response.data.msg) {\n this.error(localResponse[error.response.data.msg] || ERROR_DEFAULT, {\n response: error.response\n });\n return;\n }\n this.error(localResponse[error.response.data.msg] || ERROR_DEFAULT, {\n response: error.response\n });\n }\n\n /**\n * 改变 loading 状态\n * @param {string} key key\n * @param {string} value value\n */\n handleChangeLoading(key, value) {\n const { loading } = this.state;\n loading[key] = value;\n this.setState({ loading });\n }\n\n /**\n * 获取评论列表\n */\n sGetComment({ page = 1 } = {}) {\n const { pageType } = this.props;\n this.handleChangeLoading(\"sGetComment\", true);\n const { API, type, businessId, limit } = this.props;\n this.axios\n .get(\n `${API}/comments?type=${type}&business_id=${businessId}&page=${page}&limit=${limit}`\n )\n .then(response => {\n const { list, page, total } = response.data;\n if (list) {\n let newList = list;\n let { list: oldList } = this.state;\n if (pageType === \"more\") {\n if (page > 1) {\n // 删除临时数据\n oldList = oldList.filter(o => !o.isTemporary);\n newList = oldList.concat(newList);\n }\n } else if (pageType === \"pagination\") {\n // TODO 滚动到顶部\n window.scrollTo(0, 0);\n }\n\n this.setState({\n list: newList,\n page,\n total\n });\n this.props.onCountChange(total);\n } else {\n message.info(intl.get(\"message.noMoreComment\"));\n this.setState({\n isNoMoreComment: true\n });\n }\n })\n .catch(this.errorHandler)\n .finally(() => {\n this.handleChangeLoading(\"sGetComment\", false);\n });\n }\n\n /**\n * 获取更多回复\n */\n sGetReply({ commentId, page = 1 } = {}) {\n this.handleChangeLoading(\"sGetReply\", true);\n const { API, limit } = this.props;\n this.axios\n .get(`${API}/replies?comment_id=${commentId}&page=${page}&limit=${limit}`)\n .then(response => {\n if (!response.data.list) {\n message.info(intl.get(\"message.noMoreData\"));\n }\n const list = this.state.list.map(item => {\n if (item.id === commentId) {\n if (!item.replies) item.replies = [];\n if (response.data.list) {\n if (page === 1) {\n // 如果当前页数为第一页,则清空当前所有的 replies\n // 并将获取到的 replies 存放在 state\n item.replies = response.data.list;\n } else {\n item.replies = item.replies\n .filter(o => !o.isTemporary)\n .concat(response.data.list);\n // 如果当前页数非第一页,则合并 replies\n }\n item.reply_count = response.data.total;\n item.reply_page = response.data.page;\n } else {\n item.isNoMoreReply = true;\n }\n }\n return item;\n });\n this.setState({ list });\n })\n .catch(this.errorHandler)\n .finally(() => {\n this.handleChangeLoading(\"sGetReply\", false);\n });\n }\n\n /**\n * 添加评论\n * @param {object} {content} comment content\n */\n sCreateComment({ content } = {}, cb) {\n if (!content) return this.error(intl.get(\"message.notNull\"));\n this.handleChangeLoading(\"sCreateComment\", true);\n const { API, type, businessId, businessUserId } = this.props;\n this.axios(`${API}/comments`, {\n method: \"post\",\n data: {\n type,\n business_id: businessId,\n business_user_id: businessUserId,\n content\n },\n withCredentials: true\n })\n .then(response => {\n if (this.props.showAlertComment) {\n message.success(intl.get(\"message.success\"));\n }\n if (isFunction(cb)) cb();\n // 将数据写入到 list 中\n // 临时插入\n // 等到获取数据之后,删除临时数据\n const { list, total } = this.state;\n list.unshift({\n ...response.data,\n isTemporary: true // 临时的数据\n });\n this.setState({ list, total: total + 1 });\n this.props.onCountChange(total + 1);\n })\n .catch(this.errorHandler)\n .finally(() => {\n this.handleChangeLoading(\"sCreateComment\", false);\n });\n }\n\n /**\n * 删除评论\n */\n sDeleteComment(commentId) {\n this.handleChangeLoading(\"sDeleteComment\", true);\n const { API } = this.props;\n this.axios(`${API}/comments/${commentId}`, {\n method: \"delete\",\n withCredentials: true\n })\n .then(() => {\n const { list, total } = this.state;\n const res = list.filter(item => item.id !== commentId);\n this.setState({ list: res, total: total - 1 });\n this.props.onDelete(COMMENT_TYPE.COMMENT);\n this.props.onCountChange(total - 1);\n })\n .catch(this.errorHandler)\n .finally(() => {\n this.handleChangeLoading(\"sDeleteComment\", false);\n });\n }\n\n /**\n * 添加回复\n * 回复评论/回复回复\n * @param {object} data { comment_id, content, [reply_id] }\n */\n sCreateReply(data, cb) {\n if (!data.content) return this.error(intl.get(\"message.replyNoNull\"));\n this.handleChangeLoading(\"sCreateReply\", true);\n const { API } = this.props;\n this.axios(`${API}/replies`, {\n method: \"post\",\n data,\n withCredentials: true\n })\n .then(response => {\n if (this.props.showAlertReply) {\n message.success(intl.get(\"message.replySuccess\"));\n }\n if (isFunction(cb)) cb();\n // 将数据写入到 list 中\n // 临时插入\n // 等到获取数据之后,删除临时数据\n const list = this.state.list.map(item => {\n if (item.id === data.comment_id) {\n if (!item.replies) item.replies = [];\n item.replies.push({\n ...response.data,\n isTemporary: true // 临时的数据\n });\n item.reply_count += 1;\n }\n return item;\n });\n this.setState({ list });\n })\n .catch(this.errorHandler)\n .finally(() => {\n this.handleChangeLoading(\"sCreateReply\", false);\n });\n }\n\n /**\n * 删除回复\n * @param {*} replyId\n * @param {*} commentId\n */\n sDeleteReply(replyId, commentId) {\n this.handleChangeLoading(\"sDeleteReply\", true);\n const { API } = this.props;\n this.axios(`${API}/replies/${replyId}?CommentID=${commentId}`, {\n method: \"delete\",\n withCredentials: true\n })\n .then(() => {\n const list = this.state.list.map(item => {\n if (item.id === commentId) {\n const replies = item.replies.filter(item => item.id !== replyId);\n item.replies = replies;\n item.reply_count -= 1;\n }\n return item;\n });\n this.setState({ list });\n this.props.onDelete(COMMENT_TYPE.REPLY);\n })\n .catch(this.errorHandler)\n .finally(() => {\n this.handleChangeLoading(\"sDeleteReply\", false);\n });\n }\n\n /**\n * 评论 点赞/取消点赞\n * @param {string} commentId { commentId }\n * @param {boolean} favored 是否已经点过赞\n */\n sCommentFavor(commentId, favored) {\n this.handleChangeLoading(\"sCommentFavor\", true);\n const { API } = this.props;\n this.axios(`${API}/comments/${commentId}/favor`, {\n method: favored ? \"delete\" : \"put\",\n withCredentials: true\n })\n .then(response => {\n if (this.props.showAlertFavor) {\n message.success(\n favored\n ? intl.get(\"message.cancelLickSuccess\")\n : intl.get(\"message.likeSuccess\")\n );\n }\n // 更新 list 中的该项数据的 favored\n const list = this.state.list.map(item => {\n if (item.id === commentId) {\n item.favored = !favored;\n item.favor_count += favored ? -1 : 1;\n }\n return item;\n });\n this.setState({ list });\n })\n .catch(this.errorHandler)\n .finally(() => {\n this.handleChangeLoading(\"sCommentFavor\", false);\n });\n }\n\n /**\n * 回复 点赞/取消点赞\n * @param {string} replyId replyId\n * @param {string} commentId commentId\n * @param {boolean} favored 是否已经点过赞\n */\n sReplyFavor(replyId, commentId, favored) {\n this.handleChangeLoading(\"sReplyFavor\", true);\n const { API } = this.props;\n this.axios(`${API}/replies/${replyId}/favor`, {\n method: favored ? \"delete\" : \"put\",\n data: {\n comment_id: commentId\n },\n withCredentials: true\n })\n .then(response => {\n message.success(\n favored\n ? intl.get(\"message.cancelLickSuccess\")\n : intl.get(\"message.likeSuccess\")\n );\n // 更新 list 中的该项数据的 favored\n const list = this.state.list.map(item => {\n if (item.id === commentId) {\n item.replies = item.replies.map(r => {\n if (r.id === replyId) {\n r.favored = !favored;\n // r.favor_count = response.data.favor_count;\n // 点赞数 +1,而不是使用后端返回的点赞数\n // 不然如果返回的不是增加 1,用户可能以为程序错误\n r.favor_count += favored ? -1 : 1;\n }\n return r;\n });\n }\n return item;\n });\n this.setState({ list });\n })\n .catch(this.errorHandler)\n .finally(() => {\n this.handleChangeLoading(\"sReplyFavor\", false);\n });\n }\n\n /**\n * 获取 OSS 上传的参数\n */\n sOssSts() {\n this.handleChangeLoading(\"sOssSts\", true);\n const { API } = this.props;\n this.axios\n .get(`${API}/oss/sts`)\n .then(response => {\n this.setState({ oss: { ...response.data } });\n })\n .catch(this.errorHandler)\n .finally(() => {\n this.handleChangeLoading(\"sOssSts\", false);\n });\n }\n\n render() {\n // 添加到 Context 的数据\n const value = {\n ...this.state,\n ...this.props,\n sCreateComment: this.sCreateComment,\n sGetComment: this.sGetComment,\n sCommentFavor: this.sCommentFavor,\n sReplyFavor: this.sReplyFavor,\n sCreateReply: this.sCreateReply,\n sGetReply: this.sGetReply,\n sOssSts: this.sOssSts,\n sDeleteComment: this.sDeleteComment,\n sDeleteReply: this.sDeleteReply\n };\n\n return (\n this.state.initDone && (\n \n
\n {this.props.showEditor && (\n \n )}\n {this.props.showList && (\n
\n \n
\n )}\n
\n
\n )\n );\n }\n}\n\nApp.propTypes = {\n type: PropTypes.number.isRequired, // 评论的 type\n businessId: PropTypes.string.isRequired, // 评论的 business_id\n businessUserId: PropTypes.number,\n API: PropTypes.string, // 评论的 API 前缀\n showList: PropTypes.bool, // 是否显示评论列表\n showEditor: PropTypes.bool, // 是否显示评论输入框\n showAlertComment: PropTypes.bool, // 评论成功之后,是否通过 Antd 的 Message 组件进行提示\n showAlertReply: PropTypes.bool, // 回复成功之后,是否通过 Antd 的 Message 组件进行提示\n showAlertFavor: PropTypes.bool, // 点赞/取消点赞成功之后,是否通过 Antd 的 Message 组件进行提示\n showError: PropTypes.bool, // 是否使用Antd的Message组件提示错误信息\n onError: PropTypes.func, // 错误回调, 出错了会被调用\n userId: PropTypes.number, // 用户id, comment内部不维护用户id, 调用组件时传递过来, 目前用于判断是否显示删除按钮\n pageType: PropTypes.string, // 分页类型\n page: PropTypes.number, // 页码\n limit: PropTypes.number, // 一次加载评论数量\n onPageChange: PropTypes.func, // 页码变化回调\n onGetMoreBtnClick: PropTypes.func, // 点击查看更多按钮回调\n onDelete: PropTypes.func,\n locales: PropTypes.string, // 传入的语言环境, en-US/zh-CN\n onCountChange: PropTypes.func // 评论数量变更时的回调\n};\n\nApp.defaultProps = {\n businessUserId: 0,\n API: \"//api.links123.net/comment/v1\",\n showList: true,\n showEditor: true,\n showAlertComment: false,\n showAlertReply: false,\n showAlertFavor: false,\n showError: true,\n pageType: \"more\",\n limit: LIMIT,\n onGetMoreBtnClick: () => {},\n onPageChange: page => {},\n onDelete: () => {},\n onCountChange: () => {}\n};\n\nexport { Editor, RenderText };\n\nexport default App;\n"]}