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 103e68f commit 87f9681
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
14 changes: 14 additions & 0 deletions src/api/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,17 @@ export function patchCertification(payload) {
export function getUserVerifyInfo() {
return api.get("/user/certification", { validateStatus: s => s === 200 });
}

/**
* 举报用户
*
* @author mutoe <[email protected]>
* @export
* @param {number} userId
* @param {string} reason
* @returns
*/
export function reportUser(userId, reason) {
const url = `/report/users/${userId}`;
return api.post(url, { reason }, { validateStatus: s => s === 201 });
}
6 changes: 4 additions & 2 deletions src/components/Report.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<main class="m-box-model m-aln-center m-justify-center">
<div class="m-box-model m-lim-width m-main">
<p class="m-pinned-amount-label">举报 {{ username }} {{ typeText }}</p>
<p class="m-pinned-amount-label">举报 {{ username }} {{ typeText ? `的${typeText}` : '' }}</p>
<div class="reference">
{{ reference }}
</div>
Expand Down Expand Up @@ -39,6 +39,7 @@ import { noop } from "@/util";
import { reportFeed } from "@/api/feeds";
import { reportNews } from "@/api/news";
import { reportPost, reportPostComment } from "@/api/group";
import { reportUser } from "@/api/user";
import { reportComment } from "@/api";
import TextareaInput from "@/components/common/TextareaInput";
Expand All @@ -47,7 +48,8 @@ const apiMap = {
news: reportNews,
post: reportPost,
postComment: reportPostComment,
comment: reportComment
comment: reportComment,
user: reportUser
};
export default {
Expand Down
22 changes: 18 additions & 4 deletions src/page/UserHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
<span class="m-text-cut">{{ user.name }}</span>
</div>
<div class="m-box m-flex-grow1 m-aln-center m-flex-base0 m-justify-end">
<!-- <svg class="m-style-svg m-svg-def">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-more"></use>
</svg> -->
<svg class="m-style-svg m-svg-def" @click="onMoreClick">
<use xlink:href="#icon-more"/>
</svg>
</div>
</header>
<div v-if="loading" class="m-pos-f m-spinner">
Expand Down Expand Up @@ -461,7 +461,6 @@ export default {
this.tags = data;
});
},
fetchUserFeed(loadmore) {
if (this.fetchFeeding) return;
this.fetchFeeding = true;
Expand Down Expand Up @@ -564,6 +563,21 @@ export default {
stopDrag() {
this.dragging = false;
this.dY > 300 && this.scrollTop <= 0 ? this.updateData() : (this.dY = 0);
},
onMoreClick() {
const actions = [];
actions.push({
text: "举报",
method: () => {
this.$bus.$emit("report", {
type: "user",
payload: this.userID,
username: this.user.name,
reference: this.user.bio
});
}
});
this.$bus.$emit("actionSheet", actions);
}
}
};
Expand Down

0 comments on commit 87f9681

Please sign in to comment.