@jx3box/jx3box-ui 2.4.26 → 2.4.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/service/comment.js +1 -0
- package/src/comment/CommentContent.vue +13 -4
- package/src/comment/CommentInputForm.vue +5 -5
- package/src/comment/CommentWithReply.vue +4 -2
- package/src/comment/ReplyForReply.vue +14 -5
- package/src/comment/ReplyItem.vue +9 -5
- package/src/comment/ReplyList.vue +2 -2
- package/src/single/Comment.vue +1 -11
package/package.json
CHANGED
package/service/comment.js
CHANGED
|
@@ -341,14 +341,23 @@ export default {
|
|
|
341
341
|
},
|
|
342
342
|
attachmentUploadFinish(data) {
|
|
343
343
|
this.disableSubmitBtn = false;
|
|
344
|
-
this
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
344
|
+
const submittedContent = this.newComment.content;
|
|
345
|
+
this.$emit(
|
|
346
|
+
"addNewReply",
|
|
347
|
+
{
|
|
348
|
+
content: submittedContent,
|
|
349
|
+
attachmentList: data,
|
|
350
|
+
},
|
|
351
|
+
() => this.clearSubmittedContent(submittedContent)
|
|
352
|
+
);
|
|
348
353
|
this.showUploader = false;
|
|
354
|
+
},
|
|
355
|
+
clearSubmittedContent(submittedContent) {
|
|
356
|
+
if (this.newComment.content !== submittedContent) return false;
|
|
349
357
|
this.newComment = {
|
|
350
358
|
content: "",
|
|
351
359
|
};
|
|
360
|
+
return true;
|
|
352
361
|
},
|
|
353
362
|
attachmentUplodError() {
|
|
354
363
|
this.disableSubmitBtn = false;
|
|
@@ -129,11 +129,11 @@ export default {
|
|
|
129
129
|
},
|
|
130
130
|
clearSubmittedContent(submittedContent) {
|
|
131
131
|
// 请求成功后才清空;若等待响应期间用户已修改内容,则保留新草稿。
|
|
132
|
-
if (this.newComment.content
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
if (this.newComment.content !== submittedContent) return false;
|
|
133
|
+
this.newComment = {
|
|
134
|
+
content: "",
|
|
135
|
+
};
|
|
136
|
+
return true;
|
|
137
137
|
},
|
|
138
138
|
attachmentUploadError() {
|
|
139
139
|
this.disableSubmitBtn = false;
|
|
@@ -214,7 +214,7 @@ export default {
|
|
|
214
214
|
setWhiteComment(white) {
|
|
215
215
|
this.$emit("setWhiteComment", this.item.id, white);
|
|
216
216
|
},
|
|
217
|
-
addNewReply(data) {
|
|
217
|
+
addNewReply(data, clearSubmittedContent) {
|
|
218
218
|
POST(`${this.baseApi}/comment/${this.item.id}/reply`, null, data)
|
|
219
219
|
.then(() => {
|
|
220
220
|
this.$notify({
|
|
@@ -224,7 +224,9 @@ export default {
|
|
|
224
224
|
duration: 3000,
|
|
225
225
|
position: "bottom-right",
|
|
226
226
|
});
|
|
227
|
-
|
|
227
|
+
if (typeof clearSubmittedContent === "function") {
|
|
228
|
+
clearSubmittedContent();
|
|
229
|
+
}
|
|
228
230
|
this.loadReplyList(this.pager.index);
|
|
229
231
|
})
|
|
230
232
|
.catch(() => {});
|
|
@@ -101,13 +101,22 @@ export default {
|
|
|
101
101
|
},
|
|
102
102
|
attachmentUploadFinish(data) {
|
|
103
103
|
this.disableSubmitBtn = false;
|
|
104
|
-
this
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
const submittedContent = this.content;
|
|
105
|
+
this.$emit(
|
|
106
|
+
"doReply",
|
|
107
|
+
{
|
|
108
|
+
content: submittedContent,
|
|
109
|
+
attachmentList: data,
|
|
110
|
+
},
|
|
111
|
+
() => this.clearSubmittedContent(submittedContent)
|
|
112
|
+
);
|
|
109
113
|
this.showUploader = false;
|
|
110
114
|
},
|
|
115
|
+
clearSubmittedContent(submittedContent) {
|
|
116
|
+
if (this.content !== submittedContent) return false;
|
|
117
|
+
this.content = "";
|
|
118
|
+
return true;
|
|
119
|
+
},
|
|
111
120
|
attachmentUploadError() {
|
|
112
121
|
this.disableSubmitBtn = false;
|
|
113
122
|
},
|
|
@@ -95,11 +95,15 @@ export default {
|
|
|
95
95
|
setLikeComment(setLike) {
|
|
96
96
|
this.$emit("setLikeComment", this.reply.id, setLike);
|
|
97
97
|
},
|
|
98
|
-
doReply(replyData) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
doReply(replyData, clearSubmittedContent) {
|
|
99
|
+
replyData.replyForUID = this.reply.userId;
|
|
100
|
+
replyData.replyForCommentId = this.reply.id;
|
|
101
|
+
this.$emit("addReply", replyData, () => {
|
|
102
|
+
const contentCleared = clearSubmittedContent?.();
|
|
103
|
+
if (contentCleared !== false) {
|
|
104
|
+
this.showReplyForReplyFrom = false;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
103
107
|
},
|
|
104
108
|
},
|
|
105
109
|
};
|
|
@@ -95,8 +95,8 @@ export default {
|
|
|
95
95
|
setLikeComment(id, isLike) {
|
|
96
96
|
this.$emit("setLikeComment", id, isLike);
|
|
97
97
|
},
|
|
98
|
-
addReply(data) {
|
|
99
|
-
this.$emit("addNewReply", data);
|
|
98
|
+
addReply(data, clearSubmittedContent) {
|
|
99
|
+
this.$emit("addNewReply", data, clearSubmittedContent);
|
|
100
100
|
},
|
|
101
101
|
},
|
|
102
102
|
};
|
package/src/single/Comment.vue
CHANGED
|
@@ -255,17 +255,7 @@ export default {
|
|
|
255
255
|
},
|
|
256
256
|
userSubmitInputForm(data, clearSubmittedContent) {
|
|
257
257
|
POST(`${this.baseAPI}/comment`, null, data)
|
|
258
|
-
.then((
|
|
259
|
-
if (!responseJSON || Number(responseJSON.code) !== 0) {
|
|
260
|
-
this.$notify({
|
|
261
|
-
title: this.$jx3boxT("jx3boxUi.comment.commentFailed", "评论失败"),
|
|
262
|
-
message: responseJSON?.msg || "",
|
|
263
|
-
type: "error",
|
|
264
|
-
duration: 3000,
|
|
265
|
-
position: "bottom-right",
|
|
266
|
-
});
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
258
|
+
.then(() => {
|
|
269
259
|
this.$notify({
|
|
270
260
|
title: "",
|
|
271
261
|
message: this.$jx3boxT("jx3boxUi.comment.commentSuccess", "评论成功!"),
|