@jx3box/jx3box-ui 2.4.25 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-ui",
3
- "version": "2.4.25",
3
+ "version": "2.4.27",
4
4
  "description": "JX3BOX Vue3 UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -98,6 +98,7 @@ export const POST = function (url, queryParams, body) {
98
98
  return $
99
99
  .post(url, body, {
100
100
  params: queryParams,
101
+ validateStatus: (status) => status === 200,
101
102
  })
102
103
  .then((res) => res.data)
103
104
  .catch((err) => __handleError(err));
@@ -92,7 +92,8 @@ export default {
92
92
  align-items: center;
93
93
  .u-link {
94
94
  .mr(3px);
95
- .r(50%);
95
+ .r(4px);
96
+ overflow: hidden;
96
97
  .flex;
97
98
  justify-content: center;
98
99
  align-items: center;
@@ -341,14 +341,23 @@ export default {
341
341
  },
342
342
  attachmentUploadFinish(data) {
343
343
  this.disableSubmitBtn = false;
344
- this.$emit("addNewReply", {
345
- content: this.newComment.content,
346
- attachmentList: data,
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 === submittedContent) {
133
- this.newComment = {
134
- content: "",
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.$emit("doReply", {
105
- content: this.content,
106
- attachmentList: data,
107
- });
108
- this.content = "";
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
- (replyData.replyForUID = this.reply.userId),
100
- (replyData.replyForCommentId = this.reply.id),
101
- this.$emit("addReply", replyData);
102
- this.showReplyForReplyFrom = false;
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
  };
@@ -255,17 +255,7 @@ export default {
255
255
  },
256
256
  userSubmitInputForm(data, clearSubmittedContent) {
257
257
  POST(`${this.baseAPI}/comment`, null, data)
258
- .then((responseJSON) => {
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", "评论成功!"),