Browse Source

update lib

adam 4 years ago
parent
commit
dfe89e7078

+ 10
- 2
lib/App.js View File

@@ -484,7 +484,8 @@ var App = function (_Component) {
484 484
       var _this8 = this;
485 485
 
486 486
       var commentId = _ref5.commentId,
487
-          content = _ref5.content;
487
+          content = _ref5.content,
488
+          successCallback = _ref5.successCallback;
488 489
 
489 490
       this.handleChangeLoading("sUpdateComment", true);
490 491
       var API = this.props.API;
@@ -508,6 +509,9 @@ var App = function (_Component) {
508 509
         });
509 510
         _this8.props.onUpdateComment("comment");
510 511
         _this8.setState({ list: list });
512
+        if (successCallback) {
513
+          successCallback();
514
+        }
511 515
       }).catch(function (error) {
512 516
         _this8.props.onCommentFail(error.response.status, error.response.data);
513 517
         _this8.errorHandler(error);
@@ -613,7 +617,8 @@ var App = function (_Component) {
613 617
       var commentId = _ref6.commentId,
614 618
           content = _ref6.content,
615 619
           replyId = _ref6.replyId,
616
-          replyPage = _ref6.replyPage;
620
+          replyPage = _ref6.replyPage,
621
+          successCallback = _ref6.successCallback;
617 622
 
618 623
       this.handleChangeLoading("sUpdateReply", true);
619 624
       var API = this.props.API;
@@ -629,6 +634,9 @@ var App = function (_Component) {
629 634
         for (var i = 1; i <= replyPage; i++) {
630 635
           _this11.sGetReply({ commentId: commentId, page: i });
631 636
         }
637
+        if (successCallback) {
638
+          successCallback();
639
+        }
632 640
         _this11.props.onUpdateComment("reply");
633 641
       }).catch(function (error) {
634 642
         _this11.props.onCommentFail(error.response.status, error.response.data);

+ 1
- 1
lib/App.js.map
File diff suppressed because it is too large
View File


+ 17
- 6
lib/components/EditComment/EditComment.js View File

@@ -69,6 +69,8 @@ var EditComment = function (_React$Component) {
69 69
   _createClass(EditComment, [{
70 70
     key: "handleSubmit",
71 71
     value: function handleSubmit(_ref) {
72
+      var _this2 = this;
73
+
72 74
       var _ref$text = _ref.text,
73 75
           text = _ref$text === undefined ? "" : _ref$text,
74 76
           _ref$files = _ref.files,
@@ -92,12 +94,21 @@ var EditComment = function (_React$Component) {
92 94
       if (value.substr(-1) === ",") {
93 95
         value = value.slice(0, -1);
94 96
       }
97
+      // 成功回调,失败不自动关闭
98
+      var successCallback = function successCallback() {
99
+        _this2.props.handleClose();
100
+      };
95 101
       if (action === "comment") {
96
-        app.sUpdateComment({ commentId: commentId, content: value });
102
+        app.sUpdateComment({ commentId: commentId, content: value, successCallback: successCallback });
97 103
       } else {
98
-        app.sUpdateReply({ commentId: commentId, content: value, replyId: replyId, replyPage: replyPage });
104
+        app.sUpdateReply({
105
+          commentId: commentId,
106
+          content: value,
107
+          replyId: replyId,
108
+          replyPage: replyPage,
109
+          successCallback: successCallback
110
+        });
99 111
       }
100
-      this.props.handleClose();
101 112
     }
102 113
   }, {
103 114
     key: "getInitValue",
@@ -168,7 +179,7 @@ var EditComment = function (_React$Component) {
168 179
   }, {
169 180
     key: "render",
170 181
     value: function render() {
171
-      var _this2 = this;
182
+      var _this3 = this;
172 183
 
173 184
       return _react2.default.createElement(
174 185
         _modal2.default,
@@ -195,12 +206,12 @@ var EditComment = function (_React$Component) {
195 206
             fileList: this.state.fileList,
196 207
             value: this.props.preRenderValue && this.props.preRenderValue(this.state.value),
197 208
             onChange: function onChange(value) {
198
-              _this2.setState({
209
+              _this3.setState({
199 210
                 value: value
200 211
               });
201 212
             },
202 213
             handleChangeFileList: function handleChangeFileList(fileList) {
203
-              _this2.setState({
214
+              _this3.setState({
204 215
                 fileList: fileList
205 216
               });
206 217
             },

+ 1
- 1
lib/components/EditComment/EditComment.js.map
File diff suppressed because it is too large
View File


+ 1
- 1
lib/version.json View File

@@ -1,7 +1,7 @@
1 1
 {
2 2
     "name":       "comment",
3 3
     "buildDate":  1604847384031,
4
-    "version":    "1.2.4",
4
+    "version":    "1.2.3",
5 5
     "numCommits": 225,
6 6
     "hash":       "1377102",
7 7
     "dirty":      true