Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
feat: (#274) 圈子帖子下可以删除自己发布的评论了
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Jun 28, 2018
1 parent a908abb commit 730da50
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
14 changes: 14 additions & 0 deletions src/api/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,17 @@ export function getPostCommentAudits({ after = 0, post = 0 }) {
post
});
}

/**
* 删除帖子评论
* @author mutoe <[email protected]>
* @export
* @param {Number} postID
* @param {Number} commentID
* @returns {Promise}
*/
export function deletePostComment(postID, commentID) {
return api.delete(`/plus-group/group-posts/${postID}/comments/${commentID}`, {
validateStatus: s => s === 204
});
}
22 changes: 14 additions & 8 deletions src/page/group/GroupPostDetail.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<script>
import bus from "@/bus.js";
import markdownIt from "markdown-it";
import plusImagePlugin from "markdown-it-plus-image";
import FeedDetail from "../feed/feedDetail.vue";
import { likeGroupPost, collectGroupPost } from "@/api/group.js";
import bus from "@/bus.js";
import { limit } from "@/api/api.js";
import {
likeGroupPost,
collectGroupPost,
deletePostComment
} from "@/api/group.js";
import wechatShare from "@/util/wechatShare.js";
export default {
Expand Down Expand Up @@ -59,7 +61,7 @@ export default {
return this.feed.comments_count || 0;
},
set(val) {
val > 0, (this.feed.comments_count = val);
val > 0 && (this.feed.comments_count = val);
}
},
images() {
Expand Down Expand Up @@ -191,7 +193,6 @@ export default {
this.fetchComing = false;
});
},
fetchLikes() {
this.$http
.get(
Expand All @@ -208,7 +209,6 @@ export default {
this.feed = { ...this.feed, ...{ likes: data } };
});
},
likeFeed() {
likeGroupPost(this.postID, this.liked)
.then(() => {
Expand Down Expand Up @@ -236,7 +236,6 @@ export default {
this.fetching = false;
});
},
sendComment({ reply_user: replyUser, body }) {
const params = {};
if (body && body.length > 0) {
Expand All @@ -261,6 +260,13 @@ export default {
},
rewardFeed() {
bus.$emit("reward:groupPost", this.postID);
},
deleteComment(commentId) {
deletePostComment(this.postID, commentId).then(() => {
this.fetchFeedComments();
this.commentCount -= 1;
this.$Message.success("删除评论成功");
});
}
},
activated() {
Expand Down

0 comments on commit 730da50

Please sign in to comment.