Kaynağa Gözat

Merge branch 'master-links123'

# Conflicts:
#	CHANGELOG.md
#	assets/example.html
#	lib/App.js
#	lib/App.js.map
#	lib/components/CommentBox/index.js.map
#	lib/components/CommentList/index.js.map
#	lib/components/ContentItem/index.js.map
#	lib/components/Editor/Upload.js.map
#	lib/components/Editor/index.js.map
#	lib/components/ImagePreviewer/ImagePreviewer.js.map
#	lib/index.js.map
#	lib/lang/index.js.map
#	src/App.js
narrowizard 6 yıl önce
ebeveyn
işleme
547f5348e8

+ 4
- 0
CHANGELOG.md Dosyayı Görüntüle

@@ -4,6 +4,10 @@
4 4
 
5 5
 - [x] 完成通用评论国际化
6 6
 
7
+## 0.6.0
8
+
9
+- [x] 添加pageType slice,用于截断评论,点击查看更多回调进行跳转
10
+
7 11
 ## 0.5.14
8 12
 
9 13
 - [x] 增加onDelete回调

+ 2
- 0
README.md Dosyayı Görüntüle

@@ -204,6 +204,8 @@ main();
204 204
 | token            | string         |                                    | false    | [deprecated] token,用于身份认证,非必须。默认使用 cookie                             |
205 205
 | pageType         | string         | more                               | false    | 分页类别, more-加载更多 pagination-页码                                              |
206 206
 | page             | number         |                                    | false    | 页码受控模式,如果传递了此参数,则需要通过onPageChange回调手动维护page.                 |
207
+| limit             | number         |10                                  | false    | 一次加载的评论数量            |
208
+| onGetMoreBtnClick      | function() |                                    | false    | 点击查看更多按钮的回调                            |
207 209
 | onPageChange     | function(page) |                                    | false    | 页码发生变化时的回调,注意:分页数据获取还是在组件内部处理的                            |
208 210
 | onDelete         | function(type) |                                    | false    | 评论或回复删除成功后的回调, type: "comment" \| "reply" , 用于区分删除的是评论还是回复 |
209 211
 | locales          | string         | 语言                                | false    | 语言,zh-CN/en-US。默认根据 url 中的 lang 参数来获取。所以一般情况可不传入       

+ 1
- 1
assets/example.html Dosyayı Görüntüle

@@ -20,7 +20,7 @@
20 20
   </div>
21 21
   
22 22
   <script src="http://gosspublic.alicdn.com/aliyun-oss-sdk.min.js"></script>
23
-  <script type="text/javascript" src="./static/js/main.f8cafc1c.js"></script>
23
+  <script type="text/javascript" src="./static/js/main.b165c3be.js"></script>
24 24
   <script type="text/javascript" src="example.js"></script>
25 25
 </body>
26 26
 </html>

+ 2
- 0
assets/static/js/main.b165c3be.js
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 0
assets/static/js/main.b165c3be.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 15
- 8
lib/App.js Dosyayı Görüntüle

@@ -223,9 +223,10 @@ var App = function (_Component) {
223 223
       var _props = this.props,
224 224
           API = _props.API,
225 225
           type = _props.type,
226
-          businessId = _props.businessId;
226
+          businessId = _props.businessId,
227
+          limit = _props.limit;
227 228
 
228
-      this.axios.get(API + "/comments?type=" + type + "&business_id=" + businessId + "&page=" + page + "&limit=" + _constant.LIMIT).then(function (response) {
229
+      this.axios.get(API + "/comments?type=" + type + "&business_id=" + businessId + "&page=" + page + "&limit=" + limit).then(function (response) {
229 230
         var _response$data = response.data,
230 231
             list = _response$data.list,
231 232
             page = _response$data.page,
@@ -279,9 +280,11 @@ var App = function (_Component) {
279 280
           page = _ref2$page === undefined ? 1 : _ref2$page;
280 281
 
281 282
       this.handleChangeLoading("sGetReply", true);
282
-      var API = this.props.API;
283
+      var _props2 = this.props,
284
+          API = _props2.API,
285
+          limit = _props2.limit;
283 286
 
284
-      this.axios.get(API + "/replies?comment_id=" + commentId + "&page=" + page + "&limit=" + _constant.LIMIT).then(function (response) {
287
+      this.axios.get(API + "/replies?comment_id=" + commentId + "&page=" + page + "&limit=" + limit).then(function (response) {
285 288
         if (!response.data.list) {
286 289
           _message3.default.info(_reactIntlUniversal2.default.get("message.noMoreData"));
287 290
         }
@@ -330,10 +333,10 @@ var App = function (_Component) {
330 333
 
331 334
       if (!content) return this.error(_reactIntlUniversal2.default.get("message.notNull"));
332 335
       this.handleChangeLoading("sCreateComment", true);
333
-      var _props2 = this.props,
334
-          API = _props2.API,
335
-          type = _props2.type,
336
-          businessId = _props2.businessId;
336
+      var _props3 = this.props,
337
+          API = _props3.API,
338
+          type = _props3.type,
339
+          businessId = _props3.businessId;
337 340
 
338 341
       this.axios(API + "/comments", {
339 342
         method: "post",
@@ -620,7 +623,9 @@ App.propTypes = {
620 623
   userId: _propTypes2.default.number, // 用户id, comment内部不维护用户id, 调用组件时传递过来, 目前用于判断是否显示删除按钮
621 624
   pageType: _propTypes2.default.string, // 分页类型
622 625
   page: _propTypes2.default.number, // 页码
626
+  limit: _propTypes2.default.number, // 一次加载评论数量
623 627
   onPageChange: _propTypes2.default.func, // 页码变化回调
628
+  onGetMoreBtnClick: _propTypes2.default.func, // 点击查看更多按钮回调
624 629
   onDelete: _propTypes2.default.func,
625 630
   locales: _propTypes2.default.string //  传入的语言环境, en-US/zh-CN
626 631
 };
@@ -634,6 +639,8 @@ App.defaultProps = {
634 639
   showAlertFavor: false,
635 640
   showError: true,
636 641
   pageType: "more",
642
+  limit: _constant.LIMIT,
643
+  onGetMoreBtnClick: function onGetMoreBtnClick() {},
637 644
   onPageChange: function onPageChange(page) {},
638 645
   onDelete: function onDelete() {}
639 646
 };

+ 1
- 1
lib/App.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
lib/Comment.js.map Dosyayı Görüntüle

@@ -1 +1 @@
1
-{"version":3,"sources":["../src/Comment.js"],"names":["Comment","CommentContext","React","createContext","Component","props","app"],"mappings":";;;;;;;;;QAKgBA,O,GAAAA,O;;AALhB;;;;;;AAEA,IAAMC,iBAAiBC,gBAAMC,aAAN,EAAvB;;AAEA;AACO,SAASH,OAAT,CAAiBI,SAAjB,EAA4B;AACjC;AACA,SAAO,UAASC,KAAT,EAAgB;AACrB;AACA;AACA,WACE;AAAC,oBAAD,CAAgB,QAAhB;AAAA;AACG;AAAA,eAAO,8BAAC,SAAD,eAAeA,KAAf,IAAsB,KAAKC,GAA3B,IAAP;AAAA;AADH,KADF;AAKD,GARD;AASD;;QAEQL,c,GAAAA,c;kBAEMD,O","file":"Comment.js","sourcesContent":["import React from \"react\";\n\nconst CommentContext = React.createContext();\n\n// This function takes a component...\nexport function Comment(Component) {\n  // ...and returns another component...\n  return function(props) {\n    // ... and renders the wrapped component with the context theme!\n    // Notice that we pass through any additional props as well\n    return (\n      <CommentContext.Consumer>\n        {app => <Component {...props} app={app} />}\n      </CommentContext.Consumer>\n    );\n  };\n}\n\nexport { CommentContext };\n\nexport default Comment;\n"]}
1
+{"version":3,"sources":["../src/Comment.js"],"names":["Comment","CommentContext","React","createContext","Component","props","app"],"mappings":";;;;;;;;;QAKgBA,O,GAAAA,O;;AALhB;;;;;;AAEA,IAAMC,iBAAiBC,gBAAMC,aAAN,EAAvB;;AAEA;AACO,SAASH,OAAT,CAAiBI,SAAjB,EAA4B;AACjC;AACA,SAAO,UAASC,KAAT,EAAgB;AACrB;AACA;AACA,WACE;AAAC,oBAAD,CAAgB,QAAhB;AAAA;AACG;AAAA,eAAO,8BAAC,SAAD,eAAeA,KAAf,IAAsB,KAAKC,GAA3B,IAAP;AAAA;AADH,KADF;AAKD,GARD;AASD;;QAEQL,c,GAAAA,c;kBAEMD,O","file":"Comment.js","sourcesContent":["import React from \"react\";\r\n\r\nconst CommentContext = React.createContext();\r\n\r\n// This function takes a component...\r\nexport function Comment(Component) {\r\n  // ...and returns another component...\r\n  return function(props) {\r\n    // ... and renders the wrapped component with the context theme!\r\n    // Notice that we pass through any additional props as well\r\n    return (\r\n      <CommentContext.Consumer>\r\n        {app => <Component {...props} app={app} />}\r\n      </CommentContext.Consumer>\r\n    );\r\n  };\r\n}\r\n\r\nexport { CommentContext };\r\n\r\nexport default Comment;\r\n"]}

+ 1
- 1
lib/avatar.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
lib/axios.js.map Dosyayı Görüntüle

@@ -1 +1 @@
1
-{"version":3,"sources":["../src/axios.js"],"names":["axios","defaults","withCredentials","headers","common"],"mappings":";;;;;;AAAA;;;;;;AAEAA,gBAAMC,QAAN,CAAeC,eAAf,GAAiC,IAAjC;AACAF,gBAAMC,QAAN,CAAeE,OAAf,CAAuBC,MAAvB,CAA8B,eAA9B,IAAiD,SAAjD;;kBAEeJ,e","file":"axios.js","sourcesContent":["import axios from \"axios\";\n\naxios.defaults.withCredentials = true;\naxios.defaults.headers.common[\"Authorization\"] = \"Bearer \";\n\nexport default axios;\n"]}
1
+{"version":3,"sources":["../src/axios.js"],"names":["axios","defaults","withCredentials","headers","common"],"mappings":";;;;;;AAAA;;;;;;AAEAA,gBAAMC,QAAN,CAAeC,eAAf,GAAiC,IAAjC;AACAF,gBAAMC,QAAN,CAAeE,OAAf,CAAuBC,MAAvB,CAA8B,eAA9B,IAAiD,SAAjD;;kBAEeJ,e","file":"axios.js","sourcesContent":["import axios from \"axios\";\r\n\r\naxios.defaults.withCredentials = true;\r\naxios.defaults.headers.common[\"Authorization\"] = \"Bearer \";\r\n\r\nexport default axios;\r\n"]}

+ 1
- 1
lib/components/CommentBox/index.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
lib/components/CommentInput/index.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 16
- 5
lib/components/CommentList/index.js Dosyayı Görüntüle

@@ -36,8 +36,6 @@ var _CommentBox2 = _interopRequireDefault(_CommentBox);
36 36
 
37 37
 require("./index.css");
38 38
 
39
-var _constant = require("../../constant");
40
-
41 39
 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
42 40
 
43 41
 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -71,11 +69,24 @@ var CommentList = function (_Component) {
71 69
           total = _props$app.total,
72 70
           page = _props$app.page,
73 71
           pageType = _props$app.pageType,
72
+          limit = _props$app.limit,
74 73
           isNoMoreComment = _props$app.isNoMoreComment,
75 74
           sGetComment = _props$app.sGetComment,
76
-          onPageChange = _props$app.onPageChange;
75
+          onPageChange = _props$app.onPageChange,
76
+          onGetMoreBtnClick = _props$app.onGetMoreBtnClick;
77 77
 
78
-      if (pageType === "more") {
78
+      if (pageType === "slice") {
79
+        // 截断多余评论,通过点击查看更多跳转
80
+        return _react2.default.createElement(
81
+          "div",
82
+          { className: "comment-list-show-more", onClick: onGetMoreBtnClick },
83
+          _react2.default.createElement(
84
+            "span",
85
+            null,
86
+            "\u67E5\u770B\u66F4\u591A"
87
+          )
88
+        );
89
+      } else if (pageType === "more") {
79 90
         if (!isNoMoreComment && list.length !== total) {
80 91
           return _react2.default.createElement(
81 92
             "div",
@@ -100,7 +111,7 @@ var CommentList = function (_Component) {
100 111
           "div",
101 112
           { className: "comment-list-pagination" },
102 113
           _react2.default.createElement(_pagination2.default, {
103
-            pageSize: _constant.LIMIT,
114
+            pageSize: limit,
104 115
             current: page,
105 116
             total: total,
106 117
             onChange: function onChange(p) {

+ 1
- 1
lib/components/CommentList/index.js.map Dosyayı Görüntüle

@@ -1 +1 @@
1
-{"version":3,"sources":["../../../src/components/CommentList/index.js"],"names":["CommentList","props","state","app","sGetComment","page","list","total","pageType","isNoMoreComment","onPageChange","length","intl","get","LIMIT","p","loading","spinning","Boolean","sCommentFavor","sReplyFavor","map","item","id","renderPagination","Component","propTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;AAEA;;;;AACA;;;;AACA;;;;AACA;;AACA;;;;;;;;;;IAEMA,W;;;AACJ,uBAAYC,KAAZ,EAAmB;AAAA;;AAAA,0HACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa,EAAb;AAFiB;AAGlB;;;;yCAEoB;AACnB,WAAKD,KAAL,CAAWE,GAAX,CAAeC,WAAf,CAA2B,EAAEC,MAAM,KAAKJ,KAAL,CAAWE,GAAX,CAAeE,IAAvB,EAA3B;AACD;;;uCAEkB;AAAA,uBASb,KAAKJ,KAAL,CAAWE,GATE;AAAA,UAEfG,IAFe,cAEfA,IAFe;AAAA,UAGfC,KAHe,cAGfA,KAHe;AAAA,UAIfF,IAJe,cAIfA,IAJe;AAAA,UAKfG,QALe,cAKfA,QALe;AAAA,UAMfC,eANe,cAMfA,eANe;AAAA,UAOfL,WAPe,cAOfA,WAPe;AAAA,UAQfM,YARe,cAQfA,YARe;;AAUjB,UAAIF,aAAa,MAAjB,EAAyB;AACvB,YAAI,CAACC,eAAD,IAAoBH,KAAKK,MAAL,KAAgBJ,KAAxC,EAA+C;AAC7C,iBACE;AAAA;AAAA;AACE,yBAAU,wBADZ;AAEE,uBAAS,mBAAM;AACbH,4BAAY,EAAEC,MAAMA,OAAO,CAAf,EAAZ;AACAK,6BAAaL,OAAO,CAApB;AACD;AALH;AAOE;AAAA;AAAA;AAAOO,2CAAKC,GAAL,CAAS,qBAAT;AAAP;AAPF,WADF;AAWD,SAZD,MAYO;AACL,iBAAO,IAAP;AACD;AACF,OAhBD,MAgBO,IAAIL,aAAa,YAAjB,EAA+B;AACpC,eACE;AAAA;AAAA,YAAK,WAAU,yBAAf;AACE;AACE,sBAAUM,eADZ;AAEE,qBAAST,IAFX;AAGE,mBAAOE,KAHT;AAIE,sBAAU,qBAAK;AACbH,0BAAY,EAAEC,MAAMU,CAAR,EAAZ;AACAL,2BAAaK,CAAb;AACD;AAPH;AADF,SADF;AAaD;AACF;;;6BAEQ;AAAA,wBAC0B,KAAKd,KAAL,CAAWE,GADrC;AAAA,UACCG,IADD,eACCA,IADD;AAAA,UACOC,KADP,eACOA,KADP;AAAA,UACcS,OADd,eACcA,OADd;;;AAGP,UAAMC,WAAWC,QACfF,QAAQZ,WAAR,IAAuBY,QAAQG,aAA/B,IAAgDH,QAAQI,WADzC,CAAjB;AAGA,aACE;AAAA;AAAA;AACE;AAAA;AAAA,YAAM,UAAUH,QAAhB;AAEE;AAAA;AAAA;AAAML,yCAAKC,GAAL,CAAS,sBAAT,EAAiC,EAAEN,YAAF,EAAjC;AAAN,WAFF;AAGGD,eAAKe,GAAL,CAAS;AAAA,mBACR,8BAAC,oBAAD,IAAY,SAASC,IAArB,EAA2B,KAAKA,KAAKC,EAArC,EAAyC,WAAWD,KAAKC,EAAzD,GADQ;AAAA,WAAT,CAHH;AAMG,eAAKC,gBAAL;AANH;AADF,OADF;AAYD;;;;EAvEuBC,gB;;AA0E1BzB,YAAY0B,SAAZ,GAAwB,EAAxB;;kBAEe,uBAAQ1B,WAAR,C","file":"index.js","sourcesContent":["import React, { Component } from \"react\";\nimport { Spin, Pagination } from \"antd\";\nimport intl from \"react-intl-universal\";\nimport Comment from \"../../Comment\";\nimport CommentBox from \"../CommentBox\";\nimport \"./index.css\";\nimport { LIMIT } from \"../../constant\";\n\nclass CommentList extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {};\n  }\n\n  componentWillMount() {\n    this.props.app.sGetComment({ page: this.props.app.page });\n  }\n\n  renderPagination() {\n    const {\n      list,\n      total,\n      page,\n      pageType,\n      isNoMoreComment,\n      sGetComment,\n      onPageChange\n    } = this.props.app;\n    if (pageType === \"more\") {\n      if (!isNoMoreComment && list.length !== total) {\n        return (\n          <div\n            className=\"comment-list-show-more\"\n            onClick={() => {\n              sGetComment({ page: page + 1 });\n              onPageChange(page + 1);\n            }}\n          >\n            <span>{intl.get(\"comment.moreComment\")}</span>\n          </div>\n        );\n      } else {\n        return null;\n      }\n    } else if (pageType === \"pagination\") {\n      return (\n        <div className=\"comment-list-pagination\">\n          <Pagination\n            pageSize={LIMIT}\n            current={page}\n            total={total}\n            onChange={p => {\n              sGetComment({ page: p });\n              onPageChange(p);\n            }}\n          />\n        </div>\n      );\n    }\n  }\n\n  render() {\n    const { list, total, loading } = this.props.app;\n\n    const spinning = Boolean(\n      loading.sGetComment || loading.sCommentFavor || loading.sReplyFavor\n    );\n    return (\n      <div>\n        <Spin spinning={spinning}>\n          {/* <div>共 {total} 条评论</div> */}\n          <div>{intl.get(\"comment.totalComment\", { total })}</div>\n          {list.map(item => (\n            <CommentBox content={item} key={item.id} commentId={item.id} />\n          ))}\n          {this.renderPagination()}\n        </Spin>\n      </div>\n    );\n  }\n}\n\nCommentList.propTypes = {};\n\nexport default Comment(CommentList);\n"]}
1
+{"version":3,"sources":["../../../src/components/CommentList/index.js"],"names":["CommentList","props","state","app","sGetComment","page","list","total","pageType","limit","isNoMoreComment","onPageChange","onGetMoreBtnClick","length","intl","get","p","loading","spinning","Boolean","sCommentFavor","sReplyFavor","map","item","id","renderPagination","Component","propTypes"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;AAEA;;;;AACA;;;;AACA;;;;AACA;;;;;;;;;;IAEMA,W;;;AACJ,uBAAYC,KAAZ,EAAmB;AAAA;;AAAA,0HACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa,EAAb;AAFiB;AAGlB;;;;yCAEoB;AACnB,WAAKD,KAAL,CAAWE,GAAX,CAAeC,WAAf,CAA2B,EAAEC,MAAM,KAAKJ,KAAL,CAAWE,GAAX,CAAeE,IAAvB,EAA3B;AACD;;;uCAEkB;AAAA,uBAWb,KAAKJ,KAAL,CAAWE,GAXE;AAAA,UAEfG,IAFe,cAEfA,IAFe;AAAA,UAGfC,KAHe,cAGfA,KAHe;AAAA,UAIfF,IAJe,cAIfA,IAJe;AAAA,UAKfG,QALe,cAKfA,QALe;AAAA,UAMfC,KANe,cAMfA,KANe;AAAA,UAOfC,eAPe,cAOfA,eAPe;AAAA,UAQfN,WARe,cAQfA,WARe;AAAA,UASfO,YATe,cASfA,YATe;AAAA,UAUfC,iBAVe,cAUfA,iBAVe;;AAYjB,UAAIJ,aAAa,OAAjB,EAA0B;AACxB;AACA,eACE;AAAA;AAAA,YAAK,WAAU,wBAAf,EAAwC,SAASI,iBAAjD;AACE;AAAA;AAAA;AAAA;AAAA;AADF,SADF;AAKD,OAPD,MAOO,IAAIJ,aAAa,MAAjB,EAAyB;AAC9B,YAAI,CAACE,eAAD,IAAoBJ,KAAKO,MAAL,KAAgBN,KAAxC,EAA+C;AAC7C,iBACE;AAAA;AAAA;AACE,yBAAU,wBADZ;AAEE,uBAAS,mBAAM;AACbH,4BAAY,EAAEC,MAAMA,OAAO,CAAf,EAAZ;AACAM,6BAAaN,OAAO,CAApB;AACD;AALH;AAOE;AAAA;AAAA;AAAOS,2CAAKC,GAAL,CAAS,qBAAT;AAAP;AAPF,WADF;AAWD,SAZD,MAYO;AACL,iBAAO,IAAP;AACD;AACF,OAhBM,MAgBA,IAAIP,aAAa,YAAjB,EAA+B;AACpC,eACE;AAAA;AAAA,YAAK,WAAU,yBAAf;AACE;AACE,sBAAUC,KADZ;AAEE,qBAASJ,IAFX;AAGE,mBAAOE,KAHT;AAIE,sBAAU,qBAAK;AACbH,0BAAY,EAAEC,MAAMW,CAAR,EAAZ;AACAL,2BAAaK,CAAb;AACD;AAPH;AADF,SADF;AAaD;AACF;;;6BAEQ;AAAA,wBAC0B,KAAKf,KAAL,CAAWE,GADrC;AAAA,UACCG,IADD,eACCA,IADD;AAAA,UACOC,KADP,eACOA,KADP;AAAA,UACcU,OADd,eACcA,OADd;;;AAGP,UAAMC,WAAWC,QACfF,QAAQb,WAAR,IAAuBa,QAAQG,aAA/B,IAAgDH,QAAQI,WADzC,CAAjB;AAGA,aACE;AAAA;AAAA;AACE;AAAA;AAAA,YAAM,UAAUH,QAAhB;AAEE;AAAA;AAAA;AAAMJ,yCAAKC,GAAL,CAAS,sBAAT,EAAiC,EAAER,YAAF,EAAjC;AAAN,WAFF;AAGGD,eAAKgB,GAAL,CAAS;AAAA,mBACR,8BAAC,oBAAD,IAAY,SAASC,IAArB,EAA2B,KAAKA,KAAKC,EAArC,EAAyC,WAAWD,KAAKC,EAAzD,GADQ;AAAA,WAAT,CAHH;AAMG,eAAKC,gBAAL;AANH;AADF,OADF;AAYD;;;;EAhFuBC,gB;;AAmF1B1B,YAAY2B,SAAZ,GAAwB,EAAxB;;kBAEe,uBAAQ3B,WAAR,C","file":"index.js","sourcesContent":["import React, { Component } from \"react\";\r\nimport { Spin, Pagination } from \"antd\";\r\nimport intl from \"react-intl-universal\";\r\nimport Comment from \"../../Comment\";\r\nimport CommentBox from \"../CommentBox\";\r\nimport \"./index.css\";\r\n\r\nclass CommentList extends Component {\r\n  constructor(props) {\r\n    super(props);\r\n    this.state = {};\r\n  }\r\n\r\n  componentWillMount() {\r\n    this.props.app.sGetComment({ page: this.props.app.page });\r\n  }\r\n\r\n  renderPagination() {\r\n    const {\r\n      list,\r\n      total,\r\n      page,\r\n      pageType,\r\n      limit,\r\n      isNoMoreComment,\r\n      sGetComment,\r\n      onPageChange,\r\n      onGetMoreBtnClick\r\n    } = this.props.app;\r\n    if (pageType === \"slice\") {\r\n      // 截断多余评论,通过点击查看更多跳转\r\n      return (\r\n        <div className=\"comment-list-show-more\" onClick={onGetMoreBtnClick}>\r\n          <span>查看更多</span>\r\n        </div>\r\n      );\r\n    } else if (pageType === \"more\") {\r\n      if (!isNoMoreComment && list.length !== total) {\r\n        return (\r\n          <div\r\n            className=\"comment-list-show-more\"\r\n            onClick={() => {\r\n              sGetComment({ page: page + 1 });\r\n              onPageChange(page + 1);\r\n            }}\r\n          >\r\n            <span>{intl.get(\"comment.moreComment\")}</span>\r\n          </div>\r\n        );\r\n      } else {\r\n        return null;\r\n      }\r\n    } else if (pageType === \"pagination\") {\r\n      return (\r\n        <div className=\"comment-list-pagination\">\r\n          <Pagination\r\n            pageSize={limit}\r\n            current={page}\r\n            total={total}\r\n            onChange={p => {\r\n              sGetComment({ page: p });\r\n              onPageChange(p);\r\n            }}\r\n          />\r\n        </div>\r\n      );\r\n    }\r\n  }\r\n\r\n  render() {\r\n    const { list, total, loading } = this.props.app;\r\n\r\n    const spinning = Boolean(\r\n      loading.sGetComment || loading.sCommentFavor || loading.sReplyFavor\r\n    );\r\n    return (\r\n      <div>\r\n        <Spin spinning={spinning}>\r\n          {/* <div>共 {total} 条评论</div> */}\r\n          <div>{intl.get(\"comment.totalComment\", { total })}</div>\r\n          {list.map(item => (\r\n            <CommentBox content={item} key={item.id} commentId={item.id} />\r\n          ))}\r\n          {this.renderPagination()}\r\n        </Spin>\r\n      </div>\r\n    );\r\n  }\r\n}\r\n\r\nCommentList.propTypes = {};\r\n\r\nexport default Comment(CommentList);\r\n"]}

+ 1
- 1
lib/components/ContentItem/index.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
lib/components/Editor/Emoji.js.map Dosyayı Görüntüle

@@ -1 +1 @@
1
-{"version":3,"sources":["../../../src/components/Editor/Emoji.js"],"names":["Emoji","carousel","next","prev","onClick","props","content","curPage","i","length","push","emoji","node","map","page","index","item","value","prefixUrl","ext","title","display","React","Component"],"mappings":";;;;;;;;;;;;;;AAAA;;;;AAEA;;;;AACA;;;;;;;;;;AACA;AACA;;AAEA;;IAEMA,K;;;;;;;;;;;2BACG;AACL,UAAI,KAAKC,QAAT,EAAmB;AACjB,aAAKA,QAAL,CAAcC,IAAd;AACD;AACF;;;2BAEM;AACL,UAAI,KAAKD,QAAT,EAAmB;AACjB,aAAKA,QAAL,CAAcE,IAAd;AACD;AACF;;;6BAEQ;AAAA;;AAAA,UACCC,QADD,GACa,KAAKC,KADlB,CACCD,OADD;;AAEP,UAAME,UAAU,EAAhB;AACA,UAAIC,UAAU,EAAd;AACA,WAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAI,GAApB,EAAyBA,GAAzB,EAA8B;AAC5B,YAAID,QAAQE,MAAR,GAAiB,EAArB,EAAyB;AACvBF,kBAAQG,IAAR,CAAaC,gBAAMH,CAAN,CAAb;AACD,SAFD,MAEO;AACLF,kBAAQI,IAAR,CAAaH,OAAb;AACAA,oBAAU,EAAV;AACD;AACF;AACD,UAAIA,QAAQE,MAAR,GAAiB,CAArB,EAAwB;AACtBH,gBAAQI,IAAR,CAAaH,OAAb;AACD;AACD,aACE;AAAA;AAAA;AACE,eAAK,mBAAQ;AACX,mBAAKN,QAAL,GAAgBW,IAAhB;AACD;AAHH;AAKGN,gBAAQO,GAAR,CAAY,UAACC,IAAD,EAAOC,KAAP;AAAA,iBACX;AAAA;AAAA,cAAK,KAAKA,KAAV,EAAiB,WAAU,OAA3B;AACGD,iBAAKD,GAAL,CAAS,UAACG,IAAD,EAAOD,KAAP;AAAA,qBACR;AAAA;AAAA,kBAAK,WAAU,MAAf,EAAsB,KAAKC,KAAKC,KAAhC;AACE,wDAAM,WAAU,QAAhB,GADF;AAEE;AACE,4BAAQC,gBAAR,GAAoBF,KAAKC,KAAzB,SAAkCD,KAAKG,GADzC;AAEE,uBAAKH,KAAKI,KAFZ;AAGE,yBAAO,EAAEC,SAAS,cAAX,EAHT;AAIE,2BAAS;AAAA,2BAAMjB,SAAQY,KAAKI,KAAb,CAAN;AAAA;AAJX;AAFF,eADQ;AAAA,aAAT;AADH,WADW;AAAA,SAAZ;AALH,OADF;AAuBD;;;;EAnDiBE,gBAAMC,S;;kBAsDXvB,K","file":"Emoji.js","sourcesContent":["import React from \"react\";\nimport { Carousel } from \"antd\";\nimport emoji, { prefixUrl } from \"../../emoji\";\nimport \"./Emoji.css\";\n// 每页 20  5*4\n// 共 20 * 3 = 60 (实际是 54)\n\n// class Emoji\n\nclass Emoji extends React.Component {\n  next() {\n    if (this.carousel) {\n      this.carousel.next();\n    }\n  }\n\n  prev() {\n    if (this.carousel) {\n      this.carousel.prev();\n    }\n  }\n\n  render() {\n    const { onClick } = this.props;\n    const content = [];\n    let curPage = [];\n    for (let i = 0; i < 115; i++) {\n      if (curPage.length < 30) {\n        curPage.push(emoji[i]);\n      } else {\n        content.push(curPage);\n        curPage = [];\n      }\n    }\n    if (curPage.length > 0) {\n      content.push(curPage);\n    }\n    return (\n      <Carousel\n        ref={node => {\n          this.carousel = node;\n        }}\n      >\n        {content.map((page, index) => (\n          <div key={index} className=\"emoji\">\n            {page.map((item, index) => (\n              <div className=\"item\" key={item.value}>\n                <span className=\"helper\" />\n                <img\n                  src={`${prefixUrl}${item.value}.${item.ext}`}\n                  alt={item.title}\n                  style={{ display: \"inline-block\" }}\n                  onClick={() => onClick(item.title)}\n                />\n              </div>\n            ))}\n          </div>\n        ))}\n      </Carousel>\n    );\n  }\n}\n\nexport default Emoji;\n"]}
1
+{"version":3,"sources":["../../../src/components/Editor/Emoji.js"],"names":["Emoji","carousel","next","prev","onClick","props","content","curPage","i","length","push","emoji","node","map","page","index","item","value","prefixUrl","ext","title","display","React","Component"],"mappings":";;;;;;;;;;;;;;AAAA;;;;AAEA;;;;AACA;;;;;;;;;;AACA;AACA;;AAEA;;IAEMA,K;;;;;;;;;;;2BACG;AACL,UAAI,KAAKC,QAAT,EAAmB;AACjB,aAAKA,QAAL,CAAcC,IAAd;AACD;AACF;;;2BAEM;AACL,UAAI,KAAKD,QAAT,EAAmB;AACjB,aAAKA,QAAL,CAAcE,IAAd;AACD;AACF;;;6BAEQ;AAAA;;AAAA,UACCC,QADD,GACa,KAAKC,KADlB,CACCD,OADD;;AAEP,UAAME,UAAU,EAAhB;AACA,UAAIC,UAAU,EAAd;AACA,WAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAI,GAApB,EAAyBA,GAAzB,EAA8B;AAC5B,YAAID,QAAQE,MAAR,GAAiB,EAArB,EAAyB;AACvBF,kBAAQG,IAAR,CAAaC,gBAAMH,CAAN,CAAb;AACD,SAFD,MAEO;AACLF,kBAAQI,IAAR,CAAaH,OAAb;AACAA,oBAAU,EAAV;AACD;AACF;AACD,UAAIA,QAAQE,MAAR,GAAiB,CAArB,EAAwB;AACtBH,gBAAQI,IAAR,CAAaH,OAAb;AACD;AACD,aACE;AAAA;AAAA;AACE,eAAK,mBAAQ;AACX,mBAAKN,QAAL,GAAgBW,IAAhB;AACD;AAHH;AAKGN,gBAAQO,GAAR,CAAY,UAACC,IAAD,EAAOC,KAAP;AAAA,iBACX;AAAA;AAAA,cAAK,KAAKA,KAAV,EAAiB,WAAU,OAA3B;AACGD,iBAAKD,GAAL,CAAS,UAACG,IAAD,EAAOD,KAAP;AAAA,qBACR;AAAA;AAAA,kBAAK,WAAU,MAAf,EAAsB,KAAKC,KAAKC,KAAhC;AACE,wDAAM,WAAU,QAAhB,GADF;AAEE;AACE,4BAAQC,gBAAR,GAAoBF,KAAKC,KAAzB,SAAkCD,KAAKG,GADzC;AAEE,uBAAKH,KAAKI,KAFZ;AAGE,yBAAO,EAAEC,SAAS,cAAX,EAHT;AAIE,2BAAS;AAAA,2BAAMjB,SAAQY,KAAKI,KAAb,CAAN;AAAA;AAJX;AAFF,eADQ;AAAA,aAAT;AADH,WADW;AAAA,SAAZ;AALH,OADF;AAuBD;;;;EAnDiBE,gBAAMC,S;;kBAsDXvB,K","file":"Emoji.js","sourcesContent":["import React from \"react\";\r\nimport { Carousel } from \"antd\";\r\nimport emoji, { prefixUrl } from \"../../emoji\";\r\nimport \"./Emoji.css\";\r\n// 每页 20  5*4\r\n// 共 20 * 3 = 60 (实际是 54)\r\n\r\n// class Emoji\r\n\r\nclass Emoji extends React.Component {\r\n  next() {\r\n    if (this.carousel) {\r\n      this.carousel.next();\r\n    }\r\n  }\r\n\r\n  prev() {\r\n    if (this.carousel) {\r\n      this.carousel.prev();\r\n    }\r\n  }\r\n\r\n  render() {\r\n    const { onClick } = this.props;\r\n    const content = [];\r\n    let curPage = [];\r\n    for (let i = 0; i < 115; i++) {\r\n      if (curPage.length < 30) {\r\n        curPage.push(emoji[i]);\r\n      } else {\r\n        content.push(curPage);\r\n        curPage = [];\r\n      }\r\n    }\r\n    if (curPage.length > 0) {\r\n      content.push(curPage);\r\n    }\r\n    return (\r\n      <Carousel\r\n        ref={node => {\r\n          this.carousel = node;\r\n        }}\r\n      >\r\n        {content.map((page, index) => (\r\n          <div key={index} className=\"emoji\">\r\n            {page.map((item, index) => (\r\n              <div className=\"item\" key={item.value}>\r\n                <span className=\"helper\" />\r\n                <img\r\n                  src={`${prefixUrl}${item.value}.${item.ext}`}\r\n                  alt={item.title}\r\n                  style={{ display: \"inline-block\" }}\r\n                  onClick={() => onClick(item.title)}\r\n                />\r\n              </div>\r\n            ))}\r\n          </div>\r\n        ))}\r\n      </Carousel>\r\n    );\r\n  }\r\n}\r\n\r\nexport default Emoji;\r\n"]}

+ 1
- 1
lib/components/Editor/Upload.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
lib/components/Editor/index.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
lib/components/ImagePreviewer/ImagePreviewer.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
lib/components/RenderText/index.js.map Dosyayı Görüntüle

@@ -1 +1 @@
1
-{"version":3,"sources":["../../../src/components/RenderText/index.js"],"names":["App","__html","text"],"mappings":";;;;;;AAAA;;;;AACA;;;;AAEA,IAAMA,MAAM,SAANA,GAAM;AAAA,SACV;AACE,eAAU,sBADZ;AAEE,6BAAyB;AACvBC,cAAQ,2BAAcC,IAAd;AADe;AAF3B,IADU;AAAA,CAAZ;;kBASeF,G","file":"index.js","sourcesContent":["import React from \"react\";\nimport { renderContent } from \"../../helper\";\n\nconst App = text => (\n  <div\n    className=\"comment-item-content\"\n    dangerouslySetInnerHTML={{\n      __html: renderContent(text)\n    }}\n  />\n);\n\nexport default App;\n"]}
1
+{"version":3,"sources":["../../../src/components/RenderText/index.js"],"names":["App","__html","text"],"mappings":";;;;;;AAAA;;;;AACA;;;;AAEA,IAAMA,MAAM,SAANA,GAAM;AAAA,SACV;AACE,eAAU,sBADZ;AAEE,6BAAyB;AACvBC,cAAQ,2BAAcC,IAAd;AADe;AAF3B,IADU;AAAA,CAAZ;;kBASeF,G","file":"index.js","sourcesContent":["import React from \"react\";\r\nimport { renderContent } from \"../../helper\";\r\n\r\nconst App = text => (\r\n  <div\r\n    className=\"comment-item-content\"\r\n    dangerouslySetInnerHTML={{\r\n      __html: renderContent(text)\r\n    }}\r\n  />\r\n);\r\n\r\nexport default App;\r\n"]}

+ 1
- 1
lib/constant.js.map Dosyayı Görüntüle

@@ -1 +1 @@
1
-{"version":3,"sources":["../src/constant.js"],"names":["ERROR_DEFAULT","LIMIT","OSS_ENDPOINT","OSS_BUCKET","DRIVER_LICENSE_PATH","OSS_LINK","MAX_UPLOAD_NUMBER","URL_REGEXP","REGEXP","AVATAR","IMAGE_SPLIT","IMAGE_PROCESS","IMAGE_PROCESS_SMALL","IMAGE_PROCESS_LARGE","COMMENT_TYPE","COMMENT","REPLY"],"mappings":";;;;;AAAO,IAAMA,wCAAgB,MAAtB;;AAEA,IAAMC,wBAAQ,EAAd,C,CAAkB;;AAElB,IAAMC,sCAAe,6BAArB;AACA,IAAMC,kCAAa,eAAnB;AACA,IAAMC,oDAAsB,UAA5B;;AAEA,IAAMC,8BAAW,6CAAjB;;AAEA,IAAMC,gDAAoB,CAA1B;;AAEA,IAAMC,kCAAa,oGAAnB;;AAEA,IAAMC,0BAAS,eAAf;;AAEA,IAAMC,0BAAS,EAAf;;AAEA,IAAMC,oCAAc,aAApB;;AAEA,IAAMC,wCAAgB,mCAAtB;AACA,IAAMC,oDAAsB,mCAA5B;AACA,IAAMC,oDAAsB,mCAA5B;;AAEA,IAAMC,sCAAe;AAC1BC,WAAS,SADiB;AAE1BC,SAAO;AAFmB,CAArB","file":"constant.js","sourcesContent":["export const ERROR_DEFAULT = \"出错了!\";\n\nexport const LIMIT = 10; // 默认 limit\n\nexport const OSS_ENDPOINT = \"oss-cn-beijing.aliyuncs.com\";\nexport const OSS_BUCKET = \"links-comment\";\nexport const DRIVER_LICENSE_PATH = \"/comment\";\n\nexport const OSS_LINK = \"//links-comment.oss-cn-beijing.aliyuncs.com\";\n\nexport const MAX_UPLOAD_NUMBER = 4;\n\nexport const URL_REGEXP = /((http(s)?:)?\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g;\n\nexport const REGEXP = /\\[[^[\\]]+?\\]/g;\n\nexport const AVATAR = \"\";\n\nexport const IMAGE_SPLIT = \"IMAGE_SPLIT\";\n\nexport const IMAGE_PROCESS = \"?x-oss-process=image/resize,h_350\";\nexport const IMAGE_PROCESS_SMALL = \"?x-oss-process=image/resize,h_100\";\nexport const IMAGE_PROCESS_LARGE = \"?x-oss-process=image/resize,h_500\";\n\nexport const COMMENT_TYPE = {\n  COMMENT: \"comment\",\n  REPLY: \"reply\"\n};\n"]}
1
+{"version":3,"sources":["../src/constant.js"],"names":["ERROR_DEFAULT","LIMIT","OSS_ENDPOINT","OSS_BUCKET","DRIVER_LICENSE_PATH","OSS_LINK","MAX_UPLOAD_NUMBER","URL_REGEXP","REGEXP","AVATAR","IMAGE_SPLIT","IMAGE_PROCESS","IMAGE_PROCESS_SMALL","IMAGE_PROCESS_LARGE","COMMENT_TYPE","COMMENT","REPLY"],"mappings":";;;;;AAAO,IAAMA,wCAAgB,MAAtB;;AAEA,IAAMC,wBAAQ,EAAd,C,CAAkB;;AAElB,IAAMC,sCAAe,6BAArB;AACA,IAAMC,kCAAa,eAAnB;AACA,IAAMC,oDAAsB,UAA5B;;AAEA,IAAMC,8BAAW,6CAAjB;;AAEA,IAAMC,gDAAoB,CAA1B;;AAEA,IAAMC,kCAAa,oGAAnB;;AAEA,IAAMC,0BAAS,eAAf;;AAEA,IAAMC,0BAAS,EAAf;;AAEA,IAAMC,oCAAc,aAApB;;AAEA,IAAMC,wCAAgB,mCAAtB;AACA,IAAMC,oDAAsB,mCAA5B;AACA,IAAMC,oDAAsB,mCAA5B;;AAEA,IAAMC,sCAAe;AAC1BC,WAAS,SADiB;AAE1BC,SAAO;AAFmB,CAArB","file":"constant.js","sourcesContent":["export const ERROR_DEFAULT = \"出错了!\";\r\n\r\nexport const LIMIT = 10; // 默认 limit\r\n\r\nexport const OSS_ENDPOINT = \"oss-cn-beijing.aliyuncs.com\";\r\nexport const OSS_BUCKET = \"links-comment\";\r\nexport const DRIVER_LICENSE_PATH = \"/comment\";\r\n\r\nexport const OSS_LINK = \"//links-comment.oss-cn-beijing.aliyuncs.com\";\r\n\r\nexport const MAX_UPLOAD_NUMBER = 4;\r\n\r\nexport const URL_REGEXP = /((http(s)?:)?\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g;\r\n\r\nexport const REGEXP = /\\[[^[\\]]+?\\]/g;\r\n\r\nexport const AVATAR = \"\";\r\n\r\nexport const IMAGE_SPLIT = \"IMAGE_SPLIT\";\r\n\r\nexport const IMAGE_PROCESS = \"?x-oss-process=image/resize,h_350\";\r\nexport const IMAGE_PROCESS_SMALL = \"?x-oss-process=image/resize,h_100\";\r\nexport const IMAGE_PROCESS_LARGE = \"?x-oss-process=image/resize,h_500\";\r\n\r\nexport const COMMENT_TYPE = {\r\n  COMMENT: \"comment\",\r\n  REPLY: \"reply\"\r\n};\r\n"]}

+ 1
- 1
lib/helper.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
lib/index.example.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
lib/index.js.map Dosyayı Görüntüle

@@ -1 +1 @@
1
-{"version":3,"sources":["../src/index.js"],"names":["Index","props","renderComment","config","id","Error","type","businessId","console","warn","API","userId","ReactDOM","render","document","getElementById","window"],"mappings":";;;;AAAA;;;;AACA;;;;AACA;;;;;;AACA;;AAEA,IAAMA,QAAQ,SAARA,KAAQ;AAAA,SACZ;AAAC,iBAAD;AAAA,eAAK,sBAAL,EAAsB,oBAAtB,EAAqC,oBAArC,EAAoD,eAApD,IAAkEC,KAAlE;AACE,kCAAC,WAAD,IAAQ,WAAW,CAAnB,EAAsB,eAAtB;AADF,GADY;AAAA,CAAd;;AAMA;;;;;;;;AAQA,SAASC,aAAT,CAAuBC,MAAvB,EAA+B;AAC7B,MAAI,CAACA,OAAOC,EAAZ,EAAgB;AACd,UAAM,IAAIC,KAAJ,CAAU,gBAAV,CAAN;AACD;AACD,MAAI,CAACF,OAAOG,IAAZ,EAAkB;AAChB,UAAM,IAAID,KAAJ,CAAU,kBAAV,CAAN;AACD;AACD,MAAI,CAACF,OAAOI,UAAZ,EAAwB;AACtB;AACAC,YAAQC,IAAR,CAAa,+BAAb;AACD;AACD,MAAI,CAACN,OAAOO,GAAZ,EAAiB;AACf;AACAF,YAAQC,IAAR,CACE,sDADF;AAGD;AAhB4B,MAkB3BL,EAlB2B,GAuBzBD,MAvByB,CAkB3BC,EAlB2B;AAAA,qBAuBzBD,MAvByB,CAmB3BG,IAnB2B;AAAA,MAmB3BA,IAnB2B,gCAmBpB,CAnBoB;AAAA,2BAuBzBH,MAvByB,CAoB3BI,UApB2B;AAAA,MAoB3BA,UApB2B,sCAoBd,MApBc;AAAA,oBAuBzBJ,MAvByB,CAqB3BO,GArB2B;AAAA,MAqB3BA,GArB2B,+BAqBrB,oCArBqB;AAAA,MAsB3BC,MAtB2B,GAuBzBR,MAvByB,CAsB3BQ,MAtB2B;;;AAyB7BC,qBAASC,MAAT,CACE,8BAAC,KAAD,IAAO,MAAMP,IAAb,EAAmB,YAAYC,UAA/B,EAA2C,KAAKG,GAAhD,EAAqD,QAAQC,MAA7D,GADF,EAEEG,SAASC,cAAT,CAAwBX,EAAxB,CAFF;AAIA;AACD;;AAEDY,OAAOd,aAAP,GAAuBA,aAAvB;;AAEAA,cAAc;AACZE,MAAI,cADQ;AAEZE,QAAM,CAFM;AAGZC,cAAY;AAHA,CAAd;;AAMA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["import React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport App, { Editor } from \"./App\";\n// import registerServiceWorker from \"./registerServiceWorker\";\n\nconst Index = props => (\n  <App showAlertComment showAlertReply showAlertFavor showError {...props}>\n    <Editor maxUpload={9} autoFocus />\n  </App>\n);\n\n/**\n * 渲染评论组件\n * @param {object} config 编辑器配置\n *  - {string} id 渲染评论的DOM的 ID\n *  - {number} type 评论的 type\n *  - {string} businessId 评论的 businessId\n *  - {string} API, API 前缀, 默认 http://api.links123.net/comment/v1\n */\nfunction renderComment(config) {\n  if (!config.id) {\n    throw new Error(\"id is required\");\n  }\n  if (!config.type) {\n    throw new Error(\"type is required\");\n  }\n  if (!config.businessId) {\n    // throw new Error(\"businessId is required\");\n    console.warn(\"没有传入 businessId 参数,默认使用: test\");\n  }\n  if (!config.API) {\n    // throw new Error(\"API is required\");\n    console.warn(\n      \"没有传入 API 参数,默认使用: http://api.links123.net/comment/v1\"\n    );\n  }\n  const {\n    id,\n    type = 1,\n    businessId = \"test\",\n    API = \"http://api.links123.net/comment/v1\",\n    userId\n  } = config;\n\n  ReactDOM.render(\n    <Index type={type} businessId={businessId} API={API} userId={userId} />,\n    document.getElementById(id)\n  );\n  // registerServiceWorker();\n}\n\nwindow.renderComment = renderComment;\n\nrenderComment({\n  id: \"root-comment\",\n  type: 1,\n  businessId: \"test\"\n});\n\n// renderComment({\n//   id: \"root-comment\",\n//   type: 1,\n//   businessId: \"test\",\n//   API: 'http://api.links123.net/comment/v1',\n// });\n"]}
1
+{"version":3,"sources":["../src/index.js"],"names":["Index","props","renderComment","config","id","Error","type","businessId","console","warn","API","userId","ReactDOM","render","document","getElementById","window"],"mappings":";;;;AAAA;;;;AACA;;;;AACA;;;;;;AACA;;AAEA,IAAMA,QAAQ,SAARA,KAAQ;AAAA,SACZ;AAAC,iBAAD;AAAA,eAAK,sBAAL,EAAsB,oBAAtB,EAAqC,oBAArC,EAAoD,eAApD,IAAkEC,KAAlE;AACE,kCAAC,WAAD,IAAQ,WAAW,CAAnB,EAAsB,eAAtB;AADF,GADY;AAAA,CAAd;;AAMA;;;;;;;;AAQA,SAASC,aAAT,CAAuBC,MAAvB,EAA+B;AAC7B,MAAI,CAACA,OAAOC,EAAZ,EAAgB;AACd,UAAM,IAAIC,KAAJ,CAAU,gBAAV,CAAN;AACD;AACD,MAAI,CAACF,OAAOG,IAAZ,EAAkB;AAChB,UAAM,IAAID,KAAJ,CAAU,kBAAV,CAAN;AACD;AACD,MAAI,CAACF,OAAOI,UAAZ,EAAwB;AACtB;AACAC,YAAQC,IAAR,CAAa,+BAAb;AACD;AACD,MAAI,CAACN,OAAOO,GAAZ,EAAiB;AACf;AACAF,YAAQC,IAAR,CACE,sDADF;AAGD;AAhB4B,MAkB3BL,EAlB2B,GAuBzBD,MAvByB,CAkB3BC,EAlB2B;AAAA,qBAuBzBD,MAvByB,CAmB3BG,IAnB2B;AAAA,MAmB3BA,IAnB2B,gCAmBpB,CAnBoB;AAAA,2BAuBzBH,MAvByB,CAoB3BI,UApB2B;AAAA,MAoB3BA,UApB2B,sCAoBd,MApBc;AAAA,oBAuBzBJ,MAvByB,CAqB3BO,GArB2B;AAAA,MAqB3BA,GArB2B,+BAqBrB,oCArBqB;AAAA,MAsB3BC,MAtB2B,GAuBzBR,MAvByB,CAsB3BQ,MAtB2B;;;AAyB7BC,qBAASC,MAAT,CACE,8BAAC,KAAD,IAAO,MAAMP,IAAb,EAAmB,YAAYC,UAA/B,EAA2C,KAAKG,GAAhD,EAAqD,QAAQC,MAA7D,GADF,EAEEG,SAASC,cAAT,CAAwBX,EAAxB,CAFF;AAIA;AACD;;AAEDY,OAAOd,aAAP,GAAuBA,aAAvB;;AAEAA,cAAc;AACZE,MAAI,cADQ;AAEZE,QAAM,CAFM;AAGZC,cAAY;AAHA,CAAd;;AAMA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["import React from \"react\";\r\nimport ReactDOM from \"react-dom\";\r\nimport App, { Editor } from \"./App\";\r\n// import registerServiceWorker from \"./registerServiceWorker\";\r\n\r\nconst Index = props => (\r\n  <App showAlertComment showAlertReply showAlertFavor showError {...props}>\r\n    <Editor maxUpload={9} autoFocus />\r\n  </App>\r\n);\r\n\r\n/**\r\n * 渲染评论组件\r\n * @param {object} config 编辑器配置\r\n *  - {string} id 渲染评论的DOM的 ID\r\n *  - {number} type 评论的 type\r\n *  - {string} businessId 评论的 businessId\r\n *  - {string} API, API 前缀, 默认 http://api.links123.net/comment/v1\r\n */\r\nfunction renderComment(config) {\r\n  if (!config.id) {\r\n    throw new Error(\"id is required\");\r\n  }\r\n  if (!config.type) {\r\n    throw new Error(\"type is required\");\r\n  }\r\n  if (!config.businessId) {\r\n    // throw new Error(\"businessId is required\");\r\n    console.warn(\"没有传入 businessId 参数,默认使用: test\");\r\n  }\r\n  if (!config.API) {\r\n    // throw new Error(\"API is required\");\r\n    console.warn(\r\n      \"没有传入 API 参数,默认使用: http://api.links123.net/comment/v1\"\r\n    );\r\n  }\r\n  const {\r\n    id,\r\n    type = 1,\r\n    businessId = \"test\",\r\n    API = \"http://api.links123.net/comment/v1\",\r\n    userId\r\n  } = config;\r\n\r\n  ReactDOM.render(\r\n    <Index type={type} businessId={businessId} API={API} userId={userId} />,\r\n    document.getElementById(id)\r\n  );\r\n  // registerServiceWorker();\r\n}\r\n\r\nwindow.renderComment = renderComment;\r\n\r\nrenderComment({\r\n  id: \"root-comment\",\r\n  type: 1,\r\n  businessId: \"test\"\r\n});\r\n\r\n// renderComment({\r\n//   id: \"root-comment\",\r\n//   type: 1,\r\n//   businessId: \"test\",\r\n//   API: 'http://api.links123.net/comment/v1',\r\n// });\r\n"]}

+ 1
- 1
lib/lang/en-US.js.map Dosyayı Görüntüle

@@ -1 +1 @@
1
-{"version":3,"sources":["../../src/lang/en-US.js"],"names":["USdata"],"mappings":";;;;;AAAA,IAAMA,SAAS;AACb,2BAAyB,qCADZ;AAEb,wBAAsB,QAFT;AAGb,sBAAoB,iCAHP;AAIb,sBAAoB,QAJP;AAKb,sBAAoB,iBALP;AAMb,wBAAsB,sCANT;AAOb,sBAAoB,QAPP;;AASb,qBAAmB,SATN;AAUb,0BACE,4DAXW;AAYb,mBAAiB,OAZJ;AAab,yBAAuB,MAbV;;AAeb,sBAAoB,mDAfP;AAgBb,qBAAmB,MAhBN;AAiBb,oBAAkB,eAjBL;;AAmBb,sBAAoB,UAnBP;AAoBb,0BAAwB,uBApBX;;AAsBb,sBAAoB,OAtBP;AAuBb,mBAAiB,IAvBJ;AAwBb,uBAAqB,QAxBR;AAyBb,uBAAqB,QAzBR;;AA2Bb,2BAAyB,iBA3BZ;AA4Bb,wBAAsB,cA5BT;AA6Bb,qBAAmB,kBA7BN;AA8Bb,qBAAmB,iBA9BN;AA+Bb,yBAAuB,gBA/BV;AAgCb,0BAAwB,eAhCX;AAiCb,+BAA6B,qBAjChB;AAkCb,yBAAuB;AAlCV,CAAf;;kBAqCeA,M","file":"en-US.js","sourcesContent":["const USdata = {\n  \"editor.alreadyEntered\": \"already entered {count}/{maxLength}\",\n  \"editor.placeholder\": \"say...\",\n  \"editor.maxLength\": \"Input number must < {maxLength}\",\n  \"editor.SubmitBtn\": \"Submit\",\n  \"editor.uploadTip\": \"Upload Pictures\",\n  \"editor.uploadCount\": \"(You can also upload {count} images)\",\n  \"editor.uploadBtn\": \"upload\",\n\n  \"comment.tourist\": \"tourist\",\n  \"comment.totalComment\":\n    \"total {total, plural, =1 {one comment} other {# comments}}\",\n  \"comment.reply\": \"reply\",\n  \"comment.moreComment\": \"More\",\n\n  \"reply.totalReply\": \"{total, plural, =1 {one reply} other {# replies}}\",\n  \"reply.moreReply\": \"More\",\n  \"reply.collapse\": \"clloasp reply\",\n\n  \"picture.collapse\": \"collapse\",\n  \"picture.viewOriginal\": \"view original picture\",\n\n  \"popConfirm.title\": \"Sure?\",\n  \"popConfirm.ok\": \"Ok\",\n  \"popConfirm.cancel\": \"Cancel\",\n  \"popConfirm.delete\": \"Delete\",\n\n  \"message.noMoreComment\": \"no more comment\",\n  \"message.noMoreData\": \"no more data\",\n  \"message.notNull\": \"comment not null\",\n  \"message.success\": \"comment success\",\n  \"message.replyNoNull\": \"reply not null\",\n  \"message.replySuccess\": \"reply success\",\n  \"message.cancelLickSuccess\": \"cancel like success\",\n  \"message.likeSuccess\": \"like success\"\n};\n\nexport default USdata;\n"]}
1
+{"version":3,"sources":["../../src/lang/en-US.js"],"names":["USdata"],"mappings":";;;;;AAAA,IAAMA,SAAS;AACb,2BAAyB,qCADZ;AAEb,wBAAsB,QAFT;AAGb,sBAAoB,iCAHP;AAIb,sBAAoB,QAJP;AAKb,sBAAoB,iBALP;AAMb,wBAAsB,sCANT;AAOb,sBAAoB,QAPP;;AASb,qBAAmB,SATN;AAUb,0BACE,4DAXW;AAYb,mBAAiB,OAZJ;AAab,yBAAuB,MAbV;;AAeb,sBAAoB,mDAfP;AAgBb,qBAAmB,MAhBN;AAiBb,oBAAkB,eAjBL;;AAmBb,sBAAoB,UAnBP;AAoBb,0BAAwB,uBApBX;;AAsBb,sBAAoB,OAtBP;AAuBb,mBAAiB,IAvBJ;AAwBb,uBAAqB,QAxBR;AAyBb,uBAAqB,QAzBR;;AA2Bb,2BAAyB,iBA3BZ;AA4Bb,wBAAsB,cA5BT;AA6Bb,qBAAmB,kBA7BN;AA8Bb,qBAAmB,iBA9BN;AA+Bb,yBAAuB,gBA/BV;AAgCb,0BAAwB,eAhCX;AAiCb,+BAA6B,qBAjChB;AAkCb,yBAAuB;AAlCV,CAAf;;kBAqCeA,M","file":"en-US.js","sourcesContent":["const USdata = {\r\n  \"editor.alreadyEntered\": \"already entered {count}/{maxLength}\",\r\n  \"editor.placeholder\": \"say...\",\r\n  \"editor.maxLength\": \"Input number must < {maxLength}\",\r\n  \"editor.SubmitBtn\": \"Submit\",\r\n  \"editor.uploadTip\": \"Upload Pictures\",\r\n  \"editor.uploadCount\": \"(You can also upload {count} images)\",\r\n  \"editor.uploadBtn\": \"upload\",\r\n\r\n  \"comment.tourist\": \"tourist\",\r\n  \"comment.totalComment\":\r\n    \"total {total, plural, =1 {one comment} other {# comments}}\",\r\n  \"comment.reply\": \"reply\",\r\n  \"comment.moreComment\": \"More\",\r\n\r\n  \"reply.totalReply\": \"{total, plural, =1 {one reply} other {# replies}}\",\r\n  \"reply.moreReply\": \"More\",\r\n  \"reply.collapse\": \"clloasp reply\",\r\n\r\n  \"picture.collapse\": \"collapse\",\r\n  \"picture.viewOriginal\": \"view original picture\",\r\n\r\n  \"popConfirm.title\": \"Sure?\",\r\n  \"popConfirm.ok\": \"Ok\",\r\n  \"popConfirm.cancel\": \"Cancel\",\r\n  \"popConfirm.delete\": \"Delete\",\r\n\r\n  \"message.noMoreComment\": \"no more comment\",\r\n  \"message.noMoreData\": \"no more data\",\r\n  \"message.notNull\": \"comment not null\",\r\n  \"message.success\": \"comment success\",\r\n  \"message.replyNoNull\": \"reply not null\",\r\n  \"message.replySuccess\": \"reply success\",\r\n  \"message.cancelLickSuccess\": \"cancel like success\",\r\n  \"message.likeSuccess\": \"like success\"\r\n};\r\n\r\nexport default USdata;\r\n"]}

+ 1
- 1
lib/lang/index.js.map Dosyayı Görüntüle

@@ -1 +1 @@
1
-{"version":3,"sources":["../../src/lang/index.js"],"names":["SUPPORT_LOCALES","name","value","LOCALES_RESPONSE"],"mappings":";;;;;AAAA;;;AAGO,IAAMA,4CAAkB,CAC7B;AACEC,QAAM,SADR;AAEEC,SAAO;AAFT,CAD6B,EAK7B;AACED,QAAM,MADR;AAEEC,SAAO;AAFT,CAL6B,CAAxB;;AAWP;AACO,IAAMC,8CAAmB;AAC9B,WAAS;AACP,iBAAa,MADN;AAEP,mBAAe,MAFR;AAGP,6BAAyB,QAHlB;AAIP,4BAAwB,QAJjB;AAKP,mCAA+B,UALxB;AAMP,2BAAuB,UANhB;AAOP,2BAAuB,QAPhB;AAQP,0BAAsB,QARf;AASP,iCAA6B,UATtB;AAUP,0BAAsB;AAVf,GADqB;AAa9B,WAAS;AACP,iBAAa,SADN;AAEP,mBAAe,qBAFR;AAGP,6BAAyB,0BAHlB;AAIP,4BAAwB,uBAJjB;AAKP,mCAA+B,UALxB;AAMP,2BAAuB,gCANhB;AAOP,2BAAuB,qBAPhB;AAQP,0BAAsB,wBARf;AASP,iCAA6B,4BATtB;AAUP,0BAAsB;AAVf;AAbqB,CAAzB","file":"index.js","sourcesContent":["/**\n * 当前支持的语言\n */\nexport const SUPPORT_LOCALES = [\n  {\n    name: \"English\",\n    value: \"en-US\"\n  },\n  {\n    name: \"简体中文\",\n    value: \"zh-CN\"\n  }\n];\n\n// 服务端返回的英文短语和中文提示的对应\nexport const LOCALES_RESPONSE = {\n  \"zh-CN\": {\n    \"not found\": \"没有数据\",\n    \"auth failed\": \"请先登录\",\n    \"create comment failed\": \"创建评论失败\",\n    \"comment favor failed\": \"评论点赞失败\",\n    \"delete comment favor failed\": \"评论取消点赞失败\",\n    \"get comments failed\": \"获取评论列表失败\",\n    \"create reply failed\": \"创建回复失败\",\n    \"reply favor failed\": \"回复点赞失败\",\n    \"delete reply favor failed\": \"删除回复点赞失败\",\n    \"get replies failed\": \"获取回复列表失败\"\n  },\n  \"en-US\": {\n    \"not found\": \"no data\",\n    \"auth failed\": \"please log in first\",\n    \"create comment failed\": \"Failed to create comment\",\n    \"comment favor failed\": \"Comment likes failure\",\n    \"delete comment favor failed\": \"评论取消点赞失败\",\n    \"get comments failed\": \"Comment cancels praise failure\",\n    \"create reply failed\": \"Create reply failed\",\n    \"reply favor failed\": \"Reply to praise failed\",\n    \"delete reply favor failed\": \"Delete reply clicks failed\",\n    \"get replies failed\": \"Failed to get reply list\"\n  }\n};\n"]}
1
+{"version":3,"sources":["../../src/lang/index.js"],"names":["SUPPORT_LOCALES","name","value","LOCALES_RESPONSE"],"mappings":";;;;;AAAA;;;AAGO,IAAMA,4CAAkB,CAC7B;AACEC,QAAM,SADR;AAEEC,SAAO;AAFT,CAD6B,EAK7B;AACED,QAAM,MADR;AAEEC,SAAO;AAFT,CAL6B,CAAxB;;AAWP;AACO,IAAMC,8CAAmB;AAC9B,WAAS;AACP,iBAAa,MADN;AAEP,mBAAe,MAFR;AAGP,6BAAyB,QAHlB;AAIP,4BAAwB,QAJjB;AAKP,mCAA+B,UALxB;AAMP,2BAAuB,UANhB;AAOP,2BAAuB,QAPhB;AAQP,0BAAsB,QARf;AASP,iCAA6B,UATtB;AAUP,0BAAsB;AAVf,GADqB;AAa9B,WAAS;AACP,iBAAa,SADN;AAEP,mBAAe,qBAFR;AAGP,6BAAyB,0BAHlB;AAIP,4BAAwB,uBAJjB;AAKP,mCAA+B,UALxB;AAMP,2BAAuB,gCANhB;AAOP,2BAAuB,qBAPhB;AAQP,0BAAsB,wBARf;AASP,iCAA6B,4BATtB;AAUP,0BAAsB;AAVf;AAbqB,CAAzB","file":"index.js","sourcesContent":["/**\r\n * 当前支持的语言\r\n */\r\nexport const SUPPORT_LOCALES = [\r\n  {\r\n    name: \"English\",\r\n    value: \"en-US\"\r\n  },\r\n  {\r\n    name: \"简体中文\",\r\n    value: \"zh-CN\"\r\n  }\r\n];\r\n\r\n// 服务端返回的英文短语和中文提示的对应\r\nexport const LOCALES_RESPONSE = {\r\n  \"zh-CN\": {\r\n    \"not found\": \"没有数据\",\r\n    \"auth failed\": \"请先登录\",\r\n    \"create comment failed\": \"创建评论失败\",\r\n    \"comment favor failed\": \"评论点赞失败\",\r\n    \"delete comment favor failed\": \"评论取消点赞失败\",\r\n    \"get comments failed\": \"获取评论列表失败\",\r\n    \"create reply failed\": \"创建回复失败\",\r\n    \"reply favor failed\": \"回复点赞失败\",\r\n    \"delete reply favor failed\": \"删除回复点赞失败\",\r\n    \"get replies failed\": \"获取回复列表失败\"\r\n  },\r\n  \"en-US\": {\r\n    \"not found\": \"no data\",\r\n    \"auth failed\": \"please log in first\",\r\n    \"create comment failed\": \"Failed to create comment\",\r\n    \"comment favor failed\": \"Comment likes failure\",\r\n    \"delete comment favor failed\": \"评论取消点赞失败\",\r\n    \"get comments failed\": \"Comment cancels praise failure\",\r\n    \"create reply failed\": \"Create reply failed\",\r\n    \"reply favor failed\": \"Reply to praise failed\",\r\n    \"delete reply favor failed\": \"Delete reply clicks failed\",\r\n    \"get replies failed\": \"Failed to get reply list\"\r\n  }\r\n};\r\n"]}

+ 1
- 1
lib/lang/zh-CN.js.map Dosyayı Görüntüle

@@ -1 +1 @@
1
-{"version":3,"sources":["../../src/lang/zh-CN.js"],"names":["CNdata"],"mappings":";;;;;AAAA,IAAMA,SAAS;AACb,2BAAyB,iBADZ;AAEb,wBAAsB,UAFT;AAGb,sBAAoB,oBAHP;AAIb,sBAAoB,IAJP;AAKb,sBAAoB,MALP;AAMb,wBAAsB,mBANT;AAOb,sBAAoB,IAPP;;AASb,qBAAmB,IATN;AAUb,0BAAwB,aAVX;AAWb,mBAAiB,IAXJ;AAYb,yBAAuB,QAZV;;AAcb,sBAAoB,YAdP;AAeb,qBAAmB,QAfN;AAgBb,oBAAkB,MAhBL;;AAkBb,sBAAoB,IAlBP;AAmBb,0BAAwB,MAnBX;;AAqBb,sBAAoB,QArBP;AAsBb,mBAAiB,IAtBJ;AAuBb,uBAAqB,IAvBR;AAwBb,uBAAqB,IAxBR;;AA0Bb,2BAAyB,SA1BZ;AA2Bb,wBAAsB,UA3BT;AA4Bb,qBAAmB,UA5BN;AA6Bb,qBAAmB,OA7BN;AA8Bb,yBAAuB,UA9BV;AA+Bb,0BAAwB,OA/BX;AAgCb,+BAA6B,SAhChB;AAiCb,yBAAuB;AAjCV,CAAf;;kBAoCeA,M","file":"zh-CN.js","sourcesContent":["const CNdata = {\n  \"editor.alreadyEntered\": \"已输入{count}/140字\",\n  \"editor.placeholder\": \"说点什么吧...\",\n  \"editor.maxLength\": \"字数不过超过{maxLength}字\",\n  \"editor.SubmitBtn\": \"发表\",\n  \"editor.uploadTip\": \"上传图片\",\n  \"editor.uploadCount\": \"(您还能上传{count}张图片)\",\n  \"editor.uploadBtn\": \"上传\",\n\n  \"comment.tourist\": \"游客\",\n  \"comment.totalComment\": \"共{total}条评论\",\n  \"comment.reply\": \"回复\",\n  \"comment.moreComment\": \"查看更多评论\",\n\n  \"reply.totalReply\": \"{total}条回复\",\n  \"reply.moreReply\": \"查看更多回复\",\n  \"reply.collapse\": \"收起回复\",\n\n  \"picture.collapse\": \"收起\",\n  \"picture.viewOriginal\": \"查看原图\",\n\n  \"popConfirm.title\": \"确定要删除吗\",\n  \"popConfirm.ok\": \"确定\",\n  \"popConfirm.cancel\": \"取消\",\n  \"popConfirm.delete\": \"删除\",\n\n  \"message.noMoreComment\": \"没有更多评论了\",\n  \"message.noMoreData\": \"没有更多数据了!\",\n  \"message.notNull\": \"评论内容不能为空\",\n  \"message.success\": \"评论成功!\",\n  \"message.replyNoNull\": \"回复内容不能为空\",\n  \"message.replySuccess\": \"回复成功!\",\n  \"message.cancelLickSuccess\": \"取消点赞成功!\",\n  \"message.likeSuccess\": \"点赞成功!\"\n};\n\nexport default CNdata;\n"]}
1
+{"version":3,"sources":["../../src/lang/zh-CN.js"],"names":["CNdata"],"mappings":";;;;;AAAA,IAAMA,SAAS;AACb,2BAAyB,iBADZ;AAEb,wBAAsB,UAFT;AAGb,sBAAoB,oBAHP;AAIb,sBAAoB,IAJP;AAKb,sBAAoB,MALP;AAMb,wBAAsB,mBANT;AAOb,sBAAoB,IAPP;;AASb,qBAAmB,IATN;AAUb,0BAAwB,aAVX;AAWb,mBAAiB,IAXJ;AAYb,yBAAuB,QAZV;;AAcb,sBAAoB,YAdP;AAeb,qBAAmB,QAfN;AAgBb,oBAAkB,MAhBL;;AAkBb,sBAAoB,IAlBP;AAmBb,0BAAwB,MAnBX;;AAqBb,sBAAoB,QArBP;AAsBb,mBAAiB,IAtBJ;AAuBb,uBAAqB,IAvBR;AAwBb,uBAAqB,IAxBR;;AA0Bb,2BAAyB,SA1BZ;AA2Bb,wBAAsB,UA3BT;AA4Bb,qBAAmB,UA5BN;AA6Bb,qBAAmB,OA7BN;AA8Bb,yBAAuB,UA9BV;AA+Bb,0BAAwB,OA/BX;AAgCb,+BAA6B,SAhChB;AAiCb,yBAAuB;AAjCV,CAAf;;kBAoCeA,M","file":"zh-CN.js","sourcesContent":["const CNdata = {\r\n  \"editor.alreadyEntered\": \"已输入{count}/140字\",\r\n  \"editor.placeholder\": \"说点什么吧...\",\r\n  \"editor.maxLength\": \"字数不过超过{maxLength}字\",\r\n  \"editor.SubmitBtn\": \"发表\",\r\n  \"editor.uploadTip\": \"上传图片\",\r\n  \"editor.uploadCount\": \"(您还能上传{count}张图片)\",\r\n  \"editor.uploadBtn\": \"上传\",\r\n\r\n  \"comment.tourist\": \"游客\",\r\n  \"comment.totalComment\": \"共{total}条评论\",\r\n  \"comment.reply\": \"回复\",\r\n  \"comment.moreComment\": \"查看更多评论\",\r\n\r\n  \"reply.totalReply\": \"{total}条回复\",\r\n  \"reply.moreReply\": \"查看更多回复\",\r\n  \"reply.collapse\": \"收起回复\",\r\n\r\n  \"picture.collapse\": \"收起\",\r\n  \"picture.viewOriginal\": \"查看原图\",\r\n\r\n  \"popConfirm.title\": \"确定要删除吗\",\r\n  \"popConfirm.ok\": \"确定\",\r\n  \"popConfirm.cancel\": \"取消\",\r\n  \"popConfirm.delete\": \"删除\",\r\n\r\n  \"message.noMoreComment\": \"没有更多评论了\",\r\n  \"message.noMoreData\": \"没有更多数据了!\",\r\n  \"message.notNull\": \"评论内容不能为空\",\r\n  \"message.success\": \"评论成功!\",\r\n  \"message.replyNoNull\": \"回复内容不能为空\",\r\n  \"message.replySuccess\": \"回复成功!\",\r\n  \"message.cancelLickSuccess\": \"取消点赞成功!\",\r\n  \"message.likeSuccess\": \"点赞成功!\"\r\n};\r\n\r\nexport default CNdata;\r\n"]}

+ 1
- 1
lib/registerServiceWorker.js.map
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 8
- 4
src/App.js Dosyayı Görüntüle

@@ -132,10 +132,10 @@ class App extends Component {
132 132
   sGetComment({ page = 1 } = {}) {
133 133
     const { pageType } = this.props;
134 134
     this.handleChangeLoading("sGetComment", true);
135
-    const { API, type, businessId } = this.props;
135
+    const { API, type, businessId, limit } = this.props;
136 136
     this.axios
137 137
       .get(
138
-        `${API}/comments?type=${type}&business_id=${businessId}&page=${page}&limit=${LIMIT}`
138
+        `${API}/comments?type=${type}&business_id=${businessId}&page=${page}&limit=${limit}`
139 139
       )
140 140
       .then(response => {
141 141
         const { list, page, total } = response.data;
@@ -176,9 +176,9 @@ class App extends Component {
176 176
    */
177 177
   sGetReply({ commentId, page = 1 } = {}) {
178 178
     this.handleChangeLoading("sGetReply", true);
179
-    const { API } = this.props;
179
+    const { API, limit } = this.props;
180 180
     this.axios
181
-      .get(`${API}/replies?comment_id=${commentId}&page=${page}&limit=${LIMIT}`)
181
+      .get(`${API}/replies?comment_id=${commentId}&page=${page}&limit=${limit}`)
182 182
       .then(response => {
183 183
         if (!response.data.list) {
184 184
           message.info(intl.get("message.noMoreData"));
@@ -492,7 +492,9 @@ App.propTypes = {
492 492
   userId: PropTypes.number, // 用户id, comment内部不维护用户id, 调用组件时传递过来, 目前用于判断是否显示删除按钮
493 493
   pageType: PropTypes.string, // 分页类型
494 494
   page: PropTypes.number, // 页码
495
+  limit: PropTypes.number, // 一次加载评论数量
495 496
   onPageChange: PropTypes.func, // 页码变化回调
497
+  onGetMoreBtnClick: PropTypes.func, // 点击查看更多按钮回调
496 498
   onDelete: PropTypes.func,
497 499
   locales: PropTypes.string //  传入的语言环境, en-US/zh-CN
498 500
 };
@@ -506,6 +508,8 @@ App.defaultProps = {
506 508
   showAlertFavor: false,
507 509
   showError: true,
508 510
   pageType: "more",
511
+  limit: LIMIT,
512
+  onGetMoreBtnClick: () => {},
509 513
   onPageChange: page => {},
510 514
   onDelete: () => {}
511 515
 };

+ 12
- 4
src/components/CommentList/index.js Dosyayı Görüntüle

@@ -4,7 +4,6 @@ import intl from "react-intl-universal";
4 4
 import Comment from "../../Comment";
5 5
 import CommentBox from "../CommentBox";
6 6
 import "./index.css";
7
-import { LIMIT } from "../../constant";
8 7
 
9 8
 class CommentList extends Component {
10 9
   constructor(props) {
@@ -22,11 +21,20 @@ class CommentList extends Component {
22 21
       total,
23 22
       page,
24 23
       pageType,
24
+      limit,
25 25
       isNoMoreComment,
26 26
       sGetComment,
27
-      onPageChange
27
+      onPageChange,
28
+      onGetMoreBtnClick
28 29
     } = this.props.app;
29
-    if (pageType === "more") {
30
+    if (pageType === "slice") {
31
+      // 截断多余评论,通过点击查看更多跳转
32
+      return (
33
+        <div className="comment-list-show-more" onClick={onGetMoreBtnClick}>
34
+          <span>查看更多</span>
35
+        </div>
36
+      );
37
+    } else if (pageType === "more") {
30 38
       if (!isNoMoreComment && list.length !== total) {
31 39
         return (
32 40
           <div
@@ -46,7 +54,7 @@ class CommentList extends Component {
46 54
       return (
47 55
         <div className="comment-list-pagination">
48 56
           <Pagination
49
-            pageSize={LIMIT}
57
+            pageSize={limit}
50 58
             current={page}
51 59
             total={total}
52 60
             onChange={p => {