...
|
...
|
@@ -34,6 +34,7 @@ export default { |
|
|
const uid = get(await this.$sdk.getUser(), 'uid', 0);
|
|
|
const commentId = this.$attrs['dest-id'];
|
|
|
const articleId = this.$attrs['article-id'];
|
|
|
const directComment = this.$attrs['direct-comment'] || ''; // 是否直接调用评论框,不弹出actionSheet
|
|
|
const commentType = this.$attrs.commentType;
|
|
|
|
|
|
let menu = [];
|
...
|
...
|
@@ -61,58 +62,64 @@ export default { |
|
|
];
|
|
|
}
|
|
|
|
|
|
this.$createActionSheet({
|
|
|
data: menu,
|
|
|
zIndex: 200,
|
|
|
onSelect: item => {
|
|
|
switch (item.content) {
|
|
|
case ITEM.comment: {
|
|
|
this.$refs.placeholder.openComentInput();
|
|
|
break;
|
|
|
}
|
|
|
case ITEM.remove: {
|
|
|
this.setCommentStatus({ type: 1, commentId }).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
this.$createToast({
|
|
|
txt: '已删除',
|
|
|
type: 'correct',
|
|
|
time: 2000
|
|
|
}).show();
|
|
|
this.$emit('remove-comment', { commentId, commentType, articleId });
|
|
|
} else {
|
|
|
this.$createToast({
|
|
|
txt: '删除失败,请重试',
|
|
|
type: 'warn',
|
|
|
time: 2000
|
|
|
}).show();
|
|
|
}
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
case ITEM.report: {
|
|
|
this.setCommentStatus({ type: 2, commentId }).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
this.$createToast({
|
|
|
txt: '已举报',
|
|
|
type: 'correct',
|
|
|
time: 2000
|
|
|
}).show();
|
|
|
} else {
|
|
|
this.$createToast({
|
|
|
txt: '举报失败,请重试',
|
|
|
type: 'warn',
|
|
|
time: 2000
|
|
|
}).show();
|
|
|
}
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
default: {
|
|
|
// pass
|
|
|
if (directComment) {
|
|
|
return this.$refs.placeholder.openComentInput();
|
|
|
} else {
|
|
|
this.$createActionSheet({
|
|
|
data: menu,
|
|
|
zIndex: 200,
|
|
|
onSelect: item => {
|
|
|
switch (item.content) {
|
|
|
case ITEM.comment: {
|
|
|
this.$refs.placeholder.openComentInput();
|
|
|
break;
|
|
|
}
|
|
|
case ITEM.remove: {
|
|
|
this.setCommentStatus({ type: 1, commentId }).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
this.$createToast({
|
|
|
txt: '已删除',
|
|
|
type: 'correct',
|
|
|
time: 2000
|
|
|
}).show();
|
|
|
this.$emit('remove-comment', { commentId, commentType, articleId });
|
|
|
} else {
|
|
|
this.$createToast({
|
|
|
txt: '删除失败,请重试',
|
|
|
type: 'warn',
|
|
|
time: 2000
|
|
|
}).show();
|
|
|
}
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
case ITEM.report: {
|
|
|
this.setCommentStatus({ type: 2, commentId }).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
this.$createToast({
|
|
|
txt: '已举报',
|
|
|
type: 'correct',
|
|
|
time: 2000
|
|
|
}).show();
|
|
|
} else {
|
|
|
this.$createToast({
|
|
|
txt: '举报失败,请重试',
|
|
|
type: 'warn',
|
|
|
time: 2000
|
|
|
}).show();
|
|
|
}
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
|
default: {
|
|
|
// pass
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}).show();
|
|
|
}).show();
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
};
|
...
|
...
|
|