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

Commit 87f9681

Browse files
committed
feat: (#608) 举报用户
1 parent 103e68f commit 87f9681

File tree

3 files changed

+36
-6
lines changed

3 files changed

+36
-6
lines changed

src/api/user.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,3 +274,17 @@ export function patchCertification(payload) {
274274
export function getUserVerifyInfo() {
275275
return api.get("/user/certification", { validateStatus: s => s === 200 });
276276
}
277+
278+
/**
279+
* 举报用户
280+
*
281+
* @author mutoe <[email protected]>
282+
* @export
283+
* @param {number} userId
284+
* @param {string} reason
285+
* @returns
286+
*/
287+
export function reportUser(userId, reason) {
288+
const url = `/report/users/${userId}`;
289+
return api.post(url, { reason }, { validateStatus: s => s === 201 });
290+
}

src/components/Report.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<main class="m-box-model m-aln-center m-justify-center">
1111
<div class="m-box-model m-lim-width m-main">
12-
<p class="m-pinned-amount-label">举报 {{ username }} {{ typeText }}</p>
12+
<p class="m-pinned-amount-label">举报 {{ username }} {{ typeText ? `的${typeText}` : '' }}</p>
1313
<div class="reference">
1414
{{ reference }}
1515
</div>
@@ -39,6 +39,7 @@ import { noop } from "@/util";
3939
import { reportFeed } from "@/api/feeds";
4040
import { reportNews } from "@/api/news";
4141
import { reportPost, reportPostComment } from "@/api/group";
42+
import { reportUser } from "@/api/user";
4243
import { reportComment } from "@/api";
4344
import TextareaInput from "@/components/common/TextareaInput";
4445
@@ -47,7 +48,8 @@ const apiMap = {
4748
news: reportNews,
4849
post: reportPost,
4950
postComment: reportPostComment,
50-
comment: reportComment
51+
comment: reportComment,
52+
user: reportUser
5153
};
5254
5355
export default {

src/page/UserHome.vue

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
<span class="m-text-cut">{{ user.name }}</span>
2323
</div>
2424
<div class="m-box m-flex-grow1 m-aln-center m-flex-base0 m-justify-end">
25-
<!-- <svg class="m-style-svg m-svg-def">
26-
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-more"></use>
27-
</svg> -->
25+
<svg class="m-style-svg m-svg-def" @click="onMoreClick">
26+
<use xlink:href="#icon-more"/>
27+
</svg>
2828
</div>
2929
</header>
3030
<div v-if="loading" class="m-pos-f m-spinner">
@@ -461,7 +461,6 @@ export default {
461461
this.tags = data;
462462
});
463463
},
464-
465464
fetchUserFeed(loadmore) {
466465
if (this.fetchFeeding) return;
467466
this.fetchFeeding = true;
@@ -564,6 +563,21 @@ export default {
564563
stopDrag() {
565564
this.dragging = false;
566565
this.dY > 300 && this.scrollTop <= 0 ? this.updateData() : (this.dY = 0);
566+
},
567+
onMoreClick() {
568+
const actions = [];
569+
actions.push({
570+
text: "举报",
571+
method: () => {
572+
this.$bus.$emit("report", {
573+
type: "user",
574+
payload: this.userID,
575+
username: this.user.name,
576+
reference: this.user.bio
577+
});
578+
}
579+
});
580+
this.$bus.$emit("actionSheet", actions);
567581
}
568582
}
569583
};

0 commit comments

Comments
 (0)