소스 검색

fix:编辑相关调整

zhengyingya 5 년 전
부모
커밋
5200566444

+ 4
- 0
lib/App.css 파일 보기

@@ -28,3 +28,7 @@
28 28
 .comment-img {
29 29
   max-width: 100%;
30 30
 }
31
+
32
+.ant-upload-picture-card-wrapper {
33
+  width: 100%;
34
+}

+ 2
- 1
lib/App.js 파일 보기

@@ -406,6 +406,7 @@ var App = function (_Component) {
406 406
             total = _state.total;
407 407
 
408 408
         list.unshift(_extends({}, response.data, {
409
+          replies: [],
409 410
           isTemporary: true // 临时的数据
410 411
         }));
411 412
         _this5.setState({ list: list, total: total + 1 });
@@ -789,7 +790,7 @@ App.defaultProps = {
789 790
   onPageChange: function onPageChange(page) {},
790 791
   onDelete: function onDelete() {},
791 792
   onUpdateComment: function onUpdateComment() {},
792
-  onReforeUpdateComment: function onReforeUpdateComment() {},
793
+  onBeforeUpdateComment: function onBeforeUpdateComment() {},
793 794
   onCountChange: function onCountChange() {}
794 795
 };
795 796
 

+ 1
- 1
lib/App.js.map
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 7
- 3
lib/components/CommentInput/index.js 파일 보기

@@ -77,14 +77,17 @@ var CommentInput = function (_Component) {
77 77
       if (action === "comment") {
78 78
         this.props.app.sCreateComment({
79 79
           content: value
80
-        }, cb);
80
+        }, function (data) {
81
+          return cb(data, action);
82
+        });
81 83
       } else if (action === "reply") {
82 84
         this.props.app.sCreateReply({
83 85
           comment_id: commentId,
84 86
           content: value,
85 87
           business_user_id: userId
86 88
         }, function (data) {
87
-          return callback && callback(data);
89
+          callback && callback(data);
90
+          cb(data, action);
88 91
         });
89 92
       } else if (action === "replyToReply") {
90 93
         this.props.app.sCreateReply({
@@ -93,7 +96,8 @@ var CommentInput = function (_Component) {
93 96
           reply_id: replyId,
94 97
           business_user_id: userId
95 98
         }, function (data) {
96
-          return callback && callback(data);
99
+          callback && callback(data);
100
+          cb(data, action);
97 101
         });
98 102
       }
99 103
     }

+ 1
- 1
lib/components/CommentInput/index.js.map
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 5
- 1
lib/components/ContentItem/index.css 파일 보기

@@ -71,7 +71,7 @@
71 71
   background: url(../../assert/icon_answer@2x.png);
72 72
   background-size: 100% 100%;
73 73
   margin-right: 18px;
74
-  margin-left: 10px;
74
+  /* margin-left: 10px; */
75 75
 }
76 76
 .comment-item-like {
77 77
   background: url(../../assert/icon_like@2x.png);
@@ -83,6 +83,10 @@
83 83
   margin-left: 20px;
84 84
   cursor: pointer;
85 85
   color: red;
86
+} 
87
+.comment-item-bottom-left {
88
+  color: #71c135;
89
+  margin-right: 20px;
86 90
 }
87 91
 .comment-favor {
88 92
   font-size: 20px;

+ 0
- 1
lib/components/ContentItem/index.js 파일 보기

@@ -203,7 +203,6 @@ var CommentItem = function (_Component) {
203 203
           showEdit = _props$app.showEdit;
204 204
       var showInput = this.state.showInput;
205 205
 
206
-
207 206
       var newContent = content.content;
208 207
       var images = "";
209 208
       if (newContent.indexOf(_constant.IMAGE_SPLIT) !== -1) {

+ 1
- 1
lib/components/ContentItem/index.js.map
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 16
- 3
lib/components/EditComment/EditComment.css 파일 보기

@@ -58,7 +58,6 @@
58 58
 .editCommetModal .comment-toolbar-right .ant-btn {
59 59
   height: 36px;
60 60
 }
61
-
62 61
 .expression-btn-wrap,
63 62
 .picture-btn-wrap {
64 63
   float: left;
@@ -71,8 +70,8 @@
71 70
   font-size: 24px !important;
72 71
   margin: 0 !important;
73 72
 }
74
-.expression-btn-wrap .text,
75
-.picture-btn-wrap .text {
73
+.expression-btn-wrap .icon-tool-text,
74
+.picture-btn-wrap .icon-tool-text {
76 75
   float: left;
77 76
   font-size: 16px;
78 77
   color: #393939;
@@ -84,3 +83,17 @@
84 83
 .picture-btn-wrap .icon {
85 84
   color: rgba(113, 193, 53, 1);
86 85
 }
86
+
87
+@media (max-width: 575px) {
88
+  .editCommetModal .ant-modal,
89
+  .editCommetModal .ant-modal-content {
90
+    width: 100% !important;
91
+    height: 286px;
92
+  }
93
+  .editCommetModal .icon-tool-text {
94
+    display: none;
95
+  }
96
+  .editCommetModal .picture-btn-wrap {
97
+    margin-left: 18px;
98
+  }
99
+}

+ 4
- 4
lib/components/EditComment/EditComment.js 파일 보기

@@ -137,7 +137,7 @@ var EditComment = function (_React$Component) {
137 137
         _react2.default.createElement(_icon2.default, { type: "smile", className: "icon" }),
138 138
         _react2.default.createElement(
139 139
           "span",
140
-          { className: "text" },
140
+          { className: "icon-tool-text" },
141 141
           _reactIntlUniversal2.default.get("bilingually.emoji")
142 142
         )
143 143
       );
@@ -151,7 +151,7 @@ var EditComment = function (_React$Component) {
151 151
         _react2.default.createElement(_icon2.default, { type: "picture", className: "icon" }),
152 152
         _react2.default.createElement(
153 153
           "span",
154
-          { className: "text" },
154
+          { className: "icon-tool-text" },
155 155
           _reactIntlUniversal2.default.get("bilingually.pic")
156 156
         )
157 157
       );
@@ -185,7 +185,7 @@ var EditComment = function (_React$Component) {
185 185
         _react2.default.createElement(
186 186
           "div",
187 187
           { className: "title" },
188
-          _reactIntlUniversal2.default.get("bilingually.imgtxt.edit_imgtxt")
188
+          _reactIntlUniversal2.default.get("comment.edit")
189 189
         ),
190 190
         _react2.default.createElement(_CommentInput2.default, {
191 191
           content: _react2.default.createElement(_Editor2.default, {
@@ -213,7 +213,7 @@ var EditComment = function (_React$Component) {
213 213
             imageToolIcon: this.getImageToolIcon(),
214 214
             emojiPopoverPlacement: "bottom",
215 215
             uploadPopoverPlacement: "bottom",
216
-            btnSubmitText: _reactIntlUniversal2.default.get("bilingually.imgtxt.update")
216
+            btnSubmitText: _reactIntlUniversal2.default.get("comment.update")
217 217
           })
218 218
         })
219 219
       );

+ 1
- 1
lib/components/EditComment/EditComment.js.map
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 5
- 4
lib/components/Editor/index.js 파일 보기

@@ -247,18 +247,18 @@ var Editor = function (_React$Component) {
247 247
       if (this.props.beforeSubmit) {
248 248
         Promise.resolve(this.props.beforeSubmit({ text: value, files: files })).then(function (res) {
249 249
           if (!(res === false)) {
250
-            _this2.props.onSubmit({ text: value, files: files }, function (res) {
250
+            _this2.props.onSubmit({ text: value, files: files }, function (res, action) {
251 251
               _this2.resetState();
252
-              if (_this2.props.onCommentSuccess) {
252
+              if (action === "comment" && _this2.props.onCommentSuccess) {
253 253
                 _this2.props.onCommentSuccess(res);
254 254
               }
255 255
             });
256 256
           }
257 257
         });
258 258
       } else {
259
-        this.props.onSubmit({ text: value, files: files }, function (res) {
259
+        this.props.onSubmit({ text: value, files: files }, function (res, action) {
260 260
           _this2.resetState();
261
-          if (_this2.props.onCommentSuccess) {
261
+          if (action === "comment" && _this2.props.onCommentSuccess) {
262 262
             _this2.props.onCommentSuccess(res);
263 263
           }
264 264
         });
@@ -267,6 +267,7 @@ var Editor = function (_React$Component) {
267 267
   }, {
268 268
     key: "resetState",
269 269
     value: function resetState() {
270
+      this.handleChange("");
270 271
       this.setState({
271 272
         showUpload: false,
272 273
         value: "",

+ 1
- 1
lib/components/Editor/index.js.map
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 9
- 2
lib/index.js 파일 보기

@@ -35,8 +35,15 @@ var Index = function (_React$Component) {
35 35
     var _this = _possibleConstructorReturn(this, (Index.__proto__ || Object.getPrototypeOf(Index)).call(this, props));
36 36
 
37 37
     _this.state = {
38
-      fileList: [],
39
-      value: ""
38
+      fileList: [
39
+        // {
40
+        //   url:
41
+        //     "//links-comment.oss-cn-beijing.aliyuncs.com/comment/20190727/YQ-4VC1bL.jpeg",
42
+        //   type: "image/jpeg",
43
+        //   uid: "rc-upload-1564206005248-2"
44
+        // }
45
+      ],
46
+      value: "2"
40 47
     };
41 48
     return _this;
42 49
   }

+ 1
- 1
lib/index.js.map
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 3
- 3
lib/version.json 파일 보기

@@ -1,8 +1,8 @@
1 1
 {
2 2
     "name":       "comment",
3
-    "buildDate":  1564144081929,
3
+    "buildDate":  1564190100286,
4 4
     "version":    "1.0.4",
5
-    "numCommits": 172,
6
-    "hash":       "aef6d87",
5
+    "numCommits": 173,
6
+    "hash":       "b9eeb6a",
7 7
     "dirty":      true
8 8
 }

+ 4
- 0
src/App.css 파일 보기

@@ -28,3 +28,7 @@
28 28
 .comment-img {
29 29
   max-width: 100%;
30 30
 }
31
+
32
+.ant-upload-picture-card-wrapper {
33
+  width: 100%;
34
+}

+ 5
- 4
src/App.js 파일 보기

@@ -61,9 +61,9 @@ class App extends Component {
61 61
     this.axios = axios;
62 62
     this.axios.defaults.withCredentials = true;
63 63
     if (this.props.token) {
64
-      this.axios.defaults.headers.common["Authorization"] = `Bearer ${
65
-        this.props.token
66
-      }`;
64
+      this.axios.defaults.headers.common[
65
+        "Authorization"
66
+      ] = `Bearer ${this.props.token}`;
67 67
     }
68 68
   }
69 69
 
@@ -287,6 +287,7 @@ class App extends Component {
287 287
         const { list, total } = this.state;
288 288
         list.unshift({
289 289
           ...response.data,
290
+          replies: [],
290 291
           isTemporary: true // 临时的数据
291 292
         });
292 293
         this.setState({ list, total: total + 1 });
@@ -641,7 +642,7 @@ App.defaultProps = {
641 642
   onPageChange: page => {},
642 643
   onDelete: () => {},
643 644
   onUpdateComment: () => {},
644
-  onReforeUpdateComment: () => {},
645
+  onBeforeUpdateComment: () => {},
645 646
   onCountChange: () => {}
646 647
 };
647 648
 

+ 9
- 3
src/components/CommentInput/index.js 파일 보기

@@ -33,7 +33,7 @@ class CommentInput extends Component {
33 33
         {
34 34
           content: value
35 35
         },
36
-        cb
36
+        data => cb(data, action)
37 37
       );
38 38
     } else if (action === "reply") {
39 39
       this.props.app.sCreateReply(
@@ -42,7 +42,10 @@ class CommentInput extends Component {
42 42
           content: value,
43 43
           business_user_id: userId
44 44
         },
45
-        data => callback && callback(data)
45
+        data => {
46
+          callback && callback(data);
47
+          cb(data, action);
48
+        }
46 49
       );
47 50
     } else if (action === "replyToReply") {
48 51
       this.props.app.sCreateReply(
@@ -52,7 +55,10 @@ class CommentInput extends Component {
52 55
           reply_id: replyId,
53 56
           business_user_id: userId
54 57
         },
55
-        data => callback && callback(data)
58
+        data => {
59
+          callback && callback(data);
60
+          cb(data, action);
61
+        }
56 62
       );
57 63
     }
58 64
   }

+ 5
- 1
src/components/ContentItem/index.css 파일 보기

@@ -71,7 +71,7 @@
71 71
   background: url(../../assert/icon_answer@2x.png);
72 72
   background-size: 100% 100%;
73 73
   margin-right: 18px;
74
-  margin-left: 10px;
74
+  /* margin-left: 10px; */
75 75
 }
76 76
 .comment-item-like {
77 77
   background: url(../../assert/icon_like@2x.png);
@@ -84,6 +84,10 @@
84 84
   cursor: pointer;
85 85
   color: red;
86 86
 }
87
+.comment-item-bottom-left {
88
+  color: #71c135;
89
+  margin-right: 20px;
90
+}
87 91
 .comment-favor {
88 92
   font-size: 20px;
89 93
 }

+ 0
- 1
src/components/ContentItem/index.js 파일 보기

@@ -105,7 +105,6 @@ class CommentItem extends Component {
105 105
     } = this.props;
106 106
     const { locale, showHoverCard, showEdit } = this.props.app;
107 107
     const { showInput } = this.state;
108
-
109 108
     let newContent = content.content;
110 109
     let images = "";
111 110
     if (newContent.indexOf(IMAGE_SPLIT) !== -1) {

+ 16
- 3
src/components/EditComment/EditComment.css 파일 보기

@@ -58,7 +58,6 @@
58 58
 .editCommetModal .comment-toolbar-right .ant-btn {
59 59
   height: 36px;
60 60
 }
61
-
62 61
 .expression-btn-wrap,
63 62
 .picture-btn-wrap {
64 63
   float: left;
@@ -71,8 +70,8 @@
71 70
   font-size: 24px !important;
72 71
   margin: 0 !important;
73 72
 }
74
-.expression-btn-wrap .text,
75
-.picture-btn-wrap .text {
73
+.expression-btn-wrap .icon-tool-text,
74
+.picture-btn-wrap .icon-tool-text {
76 75
   float: left;
77 76
   font-size: 16px;
78 77
   color: #393939;
@@ -84,3 +83,17 @@
84 83
 .picture-btn-wrap .icon {
85 84
   color: rgba(113, 193, 53, 1);
86 85
 }
86
+
87
+@media (max-width: 575px) {
88
+  .editCommetModal .ant-modal,
89
+  .editCommetModal .ant-modal-content {
90
+    width: 100% !important;
91
+    height: 286px;
92
+  }
93
+  .editCommetModal .icon-tool-text {
94
+    display: none;
95
+  }
96
+  .editCommetModal .picture-btn-wrap {
97
+    margin-left: 18px;
98
+  }
99
+}

+ 4
- 6
src/components/EditComment/EditComment.js 파일 보기

@@ -66,7 +66,7 @@ class EditComment extends React.Component {
66 66
     return (
67 67
       <div className="expression-btn-wrap">
68 68
         <Icon type="smile" className="icon" />
69
-        <span className="text">{intl.get("bilingually.emoji")}</span>
69
+        <span className="icon-tool-text">{intl.get("bilingually.emoji")}</span>
70 70
       </div>
71 71
     );
72 72
   }
@@ -75,7 +75,7 @@ class EditComment extends React.Component {
75 75
     return (
76 76
       <div className="picture-btn-wrap">
77 77
         <Icon type="picture" className="icon" />
78
-        <span className="text">{intl.get("bilingually.pic")}</span>
78
+        <span className="icon-tool-text">{intl.get("bilingually.pic")}</span>
79 79
       </div>
80 80
     );
81 81
   }
@@ -100,9 +100,7 @@ class EditComment extends React.Component {
100 100
         wrapClassName="editCommetModal"
101 101
         onCancel={this.props.handleClose}
102 102
       >
103
-        <div className="title">
104
-          {intl.get("bilingually.imgtxt.edit_imgtxt")}
105
-        </div>
103
+        <div className="title">{intl.get("comment.edit")}</div>
106 104
         <CommentInput
107 105
           content={
108 106
             <Editor
@@ -130,7 +128,7 @@ class EditComment extends React.Component {
130 128
               imageToolIcon={this.getImageToolIcon()}
131 129
               emojiPopoverPlacement="bottom"
132 130
               uploadPopoverPlacement="bottom"
133
-              btnSubmitText={intl.get("bilingually.imgtxt.update")}
131
+              btnSubmitText={intl.get("comment.update")}
134 132
             />
135 133
           }
136 134
         />

+ 5
- 4
src/components/Editor/index.js 파일 보기

@@ -147,9 +147,9 @@ class Editor extends React.Component {
147 147
       Promise.resolve(this.props.beforeSubmit({ text: value, files })).then(
148 148
         res => {
149 149
           if (!(res === false)) {
150
-            this.props.onSubmit({ text: value, files }, res => {
150
+            this.props.onSubmit({ text: value, files }, (res, action) => {
151 151
               this.resetState();
152
-              if (this.props.onCommentSuccess) {
152
+              if (action === "comment" && this.props.onCommentSuccess) {
153 153
                 this.props.onCommentSuccess(res);
154 154
               }
155 155
             });
@@ -157,9 +157,9 @@ class Editor extends React.Component {
157 157
         }
158 158
       );
159 159
     } else {
160
-      this.props.onSubmit({ text: value, files }, res => {
160
+      this.props.onSubmit({ text: value, files }, (res, action) => {
161 161
         this.resetState();
162
-        if (this.props.onCommentSuccess) {
162
+        if (action === "comment" && this.props.onCommentSuccess) {
163 163
           this.props.onCommentSuccess(res);
164 164
         }
165 165
       });
@@ -167,6 +167,7 @@ class Editor extends React.Component {
167 167
   }
168 168
 
169 169
   resetState() {
170
+    this.handleChange("");
170 171
     this.setState({
171 172
       showUpload: false,
172 173
       value: "",

+ 9
- 2
src/index.js 파일 보기

@@ -7,8 +7,15 @@ class Index extends React.Component {
7 7
   constructor(props) {
8 8
     super(props);
9 9
     this.state = {
10
-      fileList: [],
11
-      value: ""
10
+      fileList: [
11
+        // {
12
+        //   url:
13
+        //     "//links-comment.oss-cn-beijing.aliyuncs.com/comment/20190727/YQ-4VC1bL.jpeg",
14
+        //   type: "image/jpeg",
15
+        //   uid: "rc-upload-1564206005248-2"
16
+        // }
17
+      ],
18
+      value: "2"
12 19
     };
13 20
   }
14 21