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

Commit

Permalink
feat: (#608) 举报帖子
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Nov 12, 2018
1 parent 7eb13aa commit 9c17005
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/api/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,3 +542,17 @@ export function moveoutBlackList(groupId, memberId) {
const url = `/plus-group/groups/${groupId}/blacklist/${memberId}`;
return api.delete(url, { validateStatus: s => s === 204 });
}

/**
* 举报帖子
*
* @author mutoe <[email protected]>
* @export
* @param {number} postId
* @param {string} reason 举报理由
* @returns
*/
export function reportPost(postId, reason) {
const url = `/plus-group/reports/posts/${postId}`;
return api.post(url, { content: reason }, { validateStatus: s => s === 201 });
}
7 changes: 6 additions & 1 deletion src/components/FeedCard/GroupFeedCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,12 @@ export default {
actions.push({
text: "举报",
method: () => {
this.$Message.info("举报功能开发中,敬请期待");
this.$bus.$emit("report", {
type: "post",
payload: this.feedID,
username: this.user.name,
reference: this.title
});
}
});
}
Expand Down
6 changes: 5 additions & 1 deletion src/components/Report.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@
import { noop } from "@/util";
import { reportFeed } from "@/api/feeds";
import { reportNews } from "@/api/news";
import { reportPost } from "@/api/group";
import TextareaInput from "@/components/common/TextareaInput";
const apiMap = {
feed: reportFeed,
news: reportNews
news: reportNews,
post: reportPost
};
export default {
Expand Down Expand Up @@ -71,6 +73,8 @@ export default {
return "动态";
case "news":
return "资讯";
case "group":
return "帖子";
default:
return "";
}
Expand Down
13 changes: 13 additions & 0 deletions src/page/group/detail/GroupPostDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,19 @@ export default {
}
});
}
if (!this.isMine) {
actions.push({
text: "举报",
method: () => {
this.$bus.$emit("report", {
type: "post",
payload: this.feed.id,
username: this.user.name,
reference: this.title
});
}
});
}
this.$bus.$emit("actionSheet", actions, "取消");
},
Expand Down

0 comments on commit 9c17005

Please sign in to comment.