Browse Source

update lib

adam 3 years ago
parent
commit
dfe89e7078

+ 10
- 2
lib/App.js View File

484
       var _this8 = this;
484
       var _this8 = this;
485
 
485
 
486
       var commentId = _ref5.commentId,
486
       var commentId = _ref5.commentId,
487
-          content = _ref5.content;
487
+          content = _ref5.content,
488
+          successCallback = _ref5.successCallback;
488
 
489
 
489
       this.handleChangeLoading("sUpdateComment", true);
490
       this.handleChangeLoading("sUpdateComment", true);
490
       var API = this.props.API;
491
       var API = this.props.API;
508
         });
509
         });
509
         _this8.props.onUpdateComment("comment");
510
         _this8.props.onUpdateComment("comment");
510
         _this8.setState({ list: list });
511
         _this8.setState({ list: list });
512
+        if (successCallback) {
513
+          successCallback();
514
+        }
511
       }).catch(function (error) {
515
       }).catch(function (error) {
512
         _this8.props.onCommentFail(error.response.status, error.response.data);
516
         _this8.props.onCommentFail(error.response.status, error.response.data);
513
         _this8.errorHandler(error);
517
         _this8.errorHandler(error);
613
       var commentId = _ref6.commentId,
617
       var commentId = _ref6.commentId,
614
           content = _ref6.content,
618
           content = _ref6.content,
615
           replyId = _ref6.replyId,
619
           replyId = _ref6.replyId,
616
-          replyPage = _ref6.replyPage;
620
+          replyPage = _ref6.replyPage,
621
+          successCallback = _ref6.successCallback;
617
 
622
 
618
       this.handleChangeLoading("sUpdateReply", true);
623
       this.handleChangeLoading("sUpdateReply", true);
619
       var API = this.props.API;
624
       var API = this.props.API;
629
         for (var i = 1; i <= replyPage; i++) {
634
         for (var i = 1; i <= replyPage; i++) {
630
           _this11.sGetReply({ commentId: commentId, page: i });
635
           _this11.sGetReply({ commentId: commentId, page: i });
631
         }
636
         }
637
+        if (successCallback) {
638
+          successCallback();
639
+        }
632
         _this11.props.onUpdateComment("reply");
640
         _this11.props.onUpdateComment("reply");
633
       }).catch(function (error) {
641
       }).catch(function (error) {
634
         _this11.props.onCommentFail(error.response.status, error.response.data);
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
   _createClass(EditComment, [{
69
   _createClass(EditComment, [{
70
     key: "handleSubmit",
70
     key: "handleSubmit",
71
     value: function handleSubmit(_ref) {
71
     value: function handleSubmit(_ref) {
72
+      var _this2 = this;
73
+
72
       var _ref$text = _ref.text,
74
       var _ref$text = _ref.text,
73
           text = _ref$text === undefined ? "" : _ref$text,
75
           text = _ref$text === undefined ? "" : _ref$text,
74
           _ref$files = _ref.files,
76
           _ref$files = _ref.files,
92
       if (value.substr(-1) === ",") {
94
       if (value.substr(-1) === ",") {
93
         value = value.slice(0, -1);
95
         value = value.slice(0, -1);
94
       }
96
       }
97
+      // 成功回调,失败不自动关闭
98
+      var successCallback = function successCallback() {
99
+        _this2.props.handleClose();
100
+      };
95
       if (action === "comment") {
101
       if (action === "comment") {
96
-        app.sUpdateComment({ commentId: commentId, content: value });
102
+        app.sUpdateComment({ commentId: commentId, content: value, successCallback: successCallback });
97
       } else {
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
     key: "getInitValue",
114
     key: "getInitValue",
168
   }, {
179
   }, {
169
     key: "render",
180
     key: "render",
170
     value: function render() {
181
     value: function render() {
171
-      var _this2 = this;
182
+      var _this3 = this;
172
 
183
 
173
       return _react2.default.createElement(
184
       return _react2.default.createElement(
174
         _modal2.default,
185
         _modal2.default,
195
             fileList: this.state.fileList,
206
             fileList: this.state.fileList,
196
             value: this.props.preRenderValue && this.props.preRenderValue(this.state.value),
207
             value: this.props.preRenderValue && this.props.preRenderValue(this.state.value),
197
             onChange: function onChange(value) {
208
             onChange: function onChange(value) {
198
-              _this2.setState({
209
+              _this3.setState({
199
                 value: value
210
                 value: value
200
               });
211
               });
201
             },
212
             },
202
             handleChangeFileList: function handleChangeFileList(fileList) {
213
             handleChangeFileList: function handleChangeFileList(fileList) {
203
-              _this2.setState({
214
+              _this3.setState({
204
                 fileList: fileList
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
 {
1
 {
2
     "name":       "comment",
2
     "name":       "comment",
3
     "buildDate":  1604847384031,
3
     "buildDate":  1604847384031,
4
-    "version":    "1.2.4",
4
+    "version":    "1.2.3",
5
     "numCommits": 225,
5
     "numCommits": 225,
6
     "hash":       "1377102",
6
     "hash":       "1377102",
7
     "dirty":      true
7
     "dirty":      true