Journal comment list.

pull/9/head
ruibaby 2019-05-04 02:27:18 +08:00
parent b7517ef0ab
commit 4bfb865f07
4 changed files with 172 additions and 15 deletions

View File

@ -53,13 +53,28 @@
<a-dropdown> <a-dropdown>
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item key="1"> <a-menu-item key="1">
<a-icon type="check" />通过 <a
href="javascript:void(0);"
@click="handlePublishMore"
>
通过
</a>
</a-menu-item> </a-menu-item>
<a-menu-item key="2"> <a-menu-item key="2">
<a-icon type="delete" />移到回收站 <a
href="javascript:void(0);"
@click="handleRecycleMore"
>
移到回收站
</a>
</a-menu-item> </a-menu-item>
<a-menu-item key="3"> <a-menu-item key="3">
<a-icon type="delete" />永久删除 <a
href="javascript:void(0);"
@click="handleDeleteMore"
>
永久删除
</a>
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
<a-button> <a-button>
@ -350,12 +365,28 @@ export default {
this.queryParam.status = null this.queryParam.status = null
this.loadComments() this.loadComments()
}, },
handlePublishMore() {
if (this.selectedRowKeys.length <= 0) {
this.$message.success('请至少选择一项!')
}
},
handleRecycleMore() {
if (this.selectedRowKeys.length <= 0) {
this.$message.success('请至少选择一项!')
}
},
handleDeleteMore() {
if (this.selectedRowKeys.length <= 0) {
this.$message.success('请至少选择一项!')
}
},
onReplyClose() { onReplyClose() {
this.replyComment = {} this.replyComment = {}
this.selectComment = {} this.selectComment = {}
this.replyCommentVisible = false this.replyCommentVisible = false
}, },
onSelectionChange(selectedRowKeys) { onSelectionChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
this.$log.debug(`SelectedRowKeys: ${selectedRowKeys}`) this.$log.debug(`SelectedRowKeys: ${selectedRowKeys}`)
}, },
getCheckboxProps(comment) { getCheckboxProps(comment) {

View File

@ -75,10 +75,20 @@
<a-dropdown> <a-dropdown>
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item key="1"> <a-menu-item key="1">
<a-icon type="delete" />移到回收站 <a
href="javascript:void(0);"
@click="handleRecycleMore"
>
<span>移到回收站</span>
</a>
</a-menu-item> </a-menu-item>
<a-menu-item key="2"> <a-menu-item key="2">
<a-icon type="delete" />永久删除 <a
href="javascript:void(0);"
@click="handleDeleteMore"
>
<span>永久删除</span>
</a>
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
<a-button style="margin-left: 8px;"> <a-button style="margin-left: 8px;">
@ -296,6 +306,7 @@ export default {
this.$router.push({ name: 'PostEdit', query: { postId: post.id } }) this.$router.push({ name: 'PostEdit', query: { postId: post.id } })
}, },
onSelectionChange(selectedRowKeys) { onSelectionChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
this.$log.debug(`SelectedRowKeys: ${selectedRowKeys}`) this.$log.debug(`SelectedRowKeys: ${selectedRowKeys}`)
}, },
getCheckboxProps(post) { getCheckboxProps(post) {
@ -328,6 +339,16 @@ export default {
this.loadPosts() this.loadPosts()
}) })
}, },
handleRecycleMore() {
if (this.selectedRowKeys.length <= 0) {
this.$message.success('请至少选择一项!')
}
},
handleDeleteMore() {
if (this.selectedRowKeys.length <= 0) {
this.$message.success('请至少选择一项!')
}
},
handleDeleteClick(postId) { handleDeleteClick(postId) {
postApi.delete(postId).then(response => { postApi.delete(postId).then(response => {
this.$message.success('删除成功!') this.$message.success('删除成功!')

View File

@ -63,6 +63,7 @@
</a-form-item> </a-form-item>
<a-form-item label="自定义模板:"> <a-form-item label="自定义模板:">
<a-select v-model="sheetToStage.template"> <a-select v-model="sheetToStage.template">
<a-select-option key="" value=""></a-select-option>
<a-select-option <a-select-option
v-for="tpl in customTpls" v-for="tpl in customTpls"
:key="tpl" :key="tpl"

View File

@ -65,18 +65,26 @@
> >
<template slot="actions"> <template slot="actions">
<span> <span>
<a
href="javascript:void(0);"
>
<a-icon <a-icon
type="like-o" type="like-o"
style="margin-right: 8px" style="margin-right: 8px"
/> />{{ item.likes }}
{{ item.likes }} </a>
</span> </span>
<span> <span>
<a
href="javascript:void(0);"
@click="handleCommentShow(item)"
>
<a-icon <a-icon
type="message" type="message"
style="margin-right: 8px" style="margin-right: 8px"
/> />{{ item.commentCount }}
{{ item.commentCount }} </a>
</span> </span>
</template> </template>
<template slot="extra"> <template slot="extra">
@ -142,19 +150,108 @@
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
<a-drawer
title="评论列表"
:width="isMobile()?'100%':'460'"
closable
:visible="commentVisiable"
destroyOnClose
@close="onCommentDrawerClose"
>
<a-row
type="flex"
align="middle"
>
<a-col :span="24">
<blockquote>
<a-comment>
<template slot="actions">
<span>
<a-icon type="like" />
<span style="padding-left: '8px';cursor: 'auto'">
{{ journal.likes }}
</span>
</span>
<span>
<a-icon type="message" />
<span style="padding-left: '8px';cursor: 'auto'">
{{ journal.commentCount }}
</span>
</span>
</template>
<a-avatar
:src="user.avatar"
:alt="user.nickname"
slot="avatar"
/>
<p slot="content">{{ journal.content }}</p>
<span slot="datetime">{{ journal.createTime | moment }}</span>
</a-comment>
</blockquote>
</a-col>
<a-divider />
<a-col :span="24">
<a-comment>
<span slot="actions">回复</span>
<a slot="author"> {{ user.nickname }} </a>
<a-avatar
slot="avatar"
:src="user.avatar"
:alt="user.nickname"
/>
<p slot="content">{{ journal.content }}</p>
<a-comment>
<span slot="actions">回复</span>
<a slot="author"> {{ user.nickname }} </a>
<a-avatar
slot="avatar"
:src="user.avatar"
:alt="user.nickname"
/>
<p slot="content">{{ journal.content }}</p>
<a-comment>
<span slot="actions">回复</span>
<a slot="author"> {{ user.nickname }} </a>
<a-avatar
slot="avatar"
:src="user.avatar"
:alt="user.nickname"
/>
<p slot="content">{{ journal.content }}</p>
</a-comment>
<a-comment>
<span slot="actions">回复</span>
<a slot="author"> {{ user.nickname }} </a>
<a-avatar
slot="avatar"
:src="user.avatar"
:alt="user.nickname"
/>
<p slot="content">{{ journal.content }}</p>
</a-comment>
</a-comment>
</a-comment>
</a-col>
</a-row>
</a-drawer>
</div> </div>
</template> </template>
<script> <script>
import { mixin, mixinDevice } from '@/utils/mixin.js'
import journalApi from '@/api/journal' import journalApi from '@/api/journal'
import userApi from '@/api/user' import userApi from '@/api/user'
export default { export default {
mixins: [mixin, mixinDevice],
data() { data() {
return { return {
title: '发表', title: '发表',
listLoading: false, listLoading: false,
visible: false, visible: false,
commentVisiable: false,
pagination: { pagination: {
page: 1, page: 1,
size: 10, size: 10,
@ -211,6 +308,10 @@ export default {
this.loadJournals() this.loadJournals()
}) })
}, },
handleCommentShow(journal) {
this.journal = journal
this.commentVisiable = true
},
createOrUpdateJournal() { createOrUpdateJournal() {
if (this.journal.id) { if (this.journal.id) {
journalApi.update(this.journal.id, this.journal).then(response => { journalApi.update(this.journal.id, this.journal).then(response => {
@ -234,6 +335,9 @@ export default {
resetParam() { resetParam() {
this.queryParam.keyword = null this.queryParam.keyword = null
this.loadJournals() this.loadJournals()
},
onCommentDrawerClose() {
this.commentVisiable = false
} }
} }
} }