feat: comment management page adds a list of comments to the journal (#480)

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/481/head
Ryan Wang 2022-03-04 17:42:41 +08:00 committed by GitHub
parent fa08257918
commit 7e244c74e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 72 additions and 16 deletions

View File

@ -12,7 +12,7 @@
</template> </template>
<template #content> <template #content>
<p v-html="$options.filters.markdownRender(comment.content)"></p> <div class="comment-modal-content" v-html="$options.filters.markdownRender(comment.content)"></div>
</template> </template>
<template #datetime> <template #datetime>

View File

@ -627,7 +627,7 @@ body {
} }
img { img {
width: 100%; width: 50%;
} }
margin-bottom: 0; margin-bottom: 0;
@ -773,9 +773,9 @@ body {
} }
.journal-list-content, .journal-list-content,
.comment-drawer-content { .comment-modal-content {
img { img {
width: 50%; width: 50% !important;
} }
} }

View File

@ -2,12 +2,15 @@
<page-view> <page-view>
<div class="card-container"> <div class="card-container">
<a-tabs type="card"> <a-tabs type="card">
<a-tab-pane key="1" tab="文章"> <a-tab-pane key="post" tab="文章">
<comment-tab target="post"></comment-tab> <comment-tab target="post"></comment-tab>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" tab="页面"> <a-tab-pane key="sheet" tab="页面">
<comment-tab target="sheet"></comment-tab> <comment-tab target="sheet"></comment-tab>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="journal" tab="日志">
<comment-tab target="journal"></comment-tab>
</a-tab-pane>
</a-tabs> </a-tabs>
</div> </div>
</page-view> </page-view>

View File

@ -144,12 +144,15 @@
<a-list-item-meta> <a-list-item-meta>
<template #description> <template #description>
发表在 发表在
<a v-if="targetName === 'posts'" :href="item.post.fullPath" target="_blank" <a v-if="targetName === 'posts'" :href="item.post.fullPath" target="_blank">
>{{ item.post.title }}</a {{ item.post.title }}
> </a>
<a v-if="targetName === 'sheets'" :href="item.sheet.fullPath" target="_blank" <a v-if="targetName === 'sheets'" :href="item.sheet.fullPath" target="_blank">
>{{ item.sheet.title }}</a {{ item.sheet.title }}
> </a>
<a v-if="targetName === 'journals'" href="javascript:void(0);">
{{ item.journal.createTime | moment }}
</a>
</template> </template>
<template #avatar> <template #avatar>
@ -169,7 +172,7 @@
</div> </div>
</template> </template>
</a-list-item-meta> </a-list-item-meta>
<p v-html="$options.filters.markdownRender(item.content)"></p> <div class="comment-content-wrapper" v-html="$options.filters.markdownRender(item.content)"></div>
</a-list-item> </a-list-item>
</template> </template>
</a-list> </a-list>
@ -195,7 +198,7 @@
</template> </template>
<template #content="content"> <template #content="content">
<p class="comment-content-wrapper" v-html="$options.filters.markdownRender(content)"></p> <div class="comment-content-wrapper" v-html="$options.filters.markdownRender(content)"></div>
</template> </template>
<template #status="status"> <template #status="status">
@ -214,6 +217,10 @@
</a> </a>
</template> </template>
<template v-if="targetName === 'journals'" #journal="journal">
<p class="comment-content-wrapper" v-html="journal.content"></p>
</template>
<template #createTime="createTime"> <template #createTime="createTime">
<a-tooltip placement="top"> <a-tooltip placement="top">
<template #title> <template #title>
@ -391,6 +398,46 @@ const sheetColumns = [
} }
] ]
const journalColumns = [
{
title: '昵称',
dataIndex: 'author',
width: '150px',
ellipsis: true,
scopedSlots: { customRender: 'author' }
},
{
title: '内容',
dataIndex: 'content',
scopedSlots: { customRender: 'content' }
},
{
title: '状态',
dataIndex: 'status',
width: '100px',
scopedSlots: { customRender: 'status' }
},
{
title: '评论日志',
dataIndex: 'journal',
width: '400px',
ellipsis: true,
scopedSlots: { customRender: 'journal' }
},
{
title: '日期',
dataIndex: 'createTime',
width: '170px',
scopedSlots: { customRender: 'createTime' }
},
{
title: '操作',
dataIndex: 'action',
width: '180px',
scopedSlots: { customRender: 'action' }
}
]
export default { export default {
name: 'CommentTab', name: 'CommentTab',
components: { CommentReplyModal }, components: { CommentReplyModal },
@ -441,7 +488,10 @@ export default {
} }
}, },
columns() { columns() {
return this.targetName === 'posts' ? postColumns : sheetColumns if (this.targetName === 'posts') return postColumns
if (this.targetName === 'sheets') return sheetColumns
if (this.targetName === 'journals') return journalColumns
return {}
}, },
targetName() { targetName() {
return `${this.target}s` return `${this.target}s`
@ -456,6 +506,9 @@ export default {
if (this.targetName === 'sheets') { if (this.targetName === 'sheets') {
return this.selectedComment.sheet.id return this.selectedComment.sheet.id
} }
if (this.targetName === 'journals') {
return this.selectedComment.journal.id
}
return 0 return 0
} }
}, },

View File

@ -70,7 +70,7 @@
<a-list-item-meta> <a-list-item-meta>
<template slot="description"> <template slot="description">
<p class="journal-list-content" v-html="item.content"></p> <div class="journal-list-content" v-html="item.content"></div>
</template> </template>
<span slot="title">{{ item.createTime | moment }}</span> <span slot="title">{{ item.createTime | moment }}</span>
<a-avatar slot="avatar" :src="user.avatar" size="large" /> <a-avatar slot="avatar" :src="user.avatar" size="large" />