mirror of https://github.com/halo-dev/halo-admin
Support control more post.
parent
6dc59a5e2a
commit
373d83b4c1
|
@ -134,4 +134,4 @@ themeApi.exists = template => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default themeApi
|
export default themeApi
|
||||||
|
|
|
@ -436,38 +436,44 @@ export default {
|
||||||
handlePublishMore() {
|
handlePublishMore() {
|
||||||
if (this.selectedRowKeys.length <= 0) {
|
if (this.selectedRowKeys.length <= 0) {
|
||||||
this.$message.success('请至少选择一项!')
|
this.$message.success('请至少选择一项!')
|
||||||
|
return
|
||||||
}
|
}
|
||||||
for (let index = 0; index < this.selectedRowKeys.length; index++) {
|
for (let index = 0; index < this.selectedRowKeys.length; index++) {
|
||||||
const element = this.selectedRowKeys[index]
|
const element = this.selectedRowKeys[index]
|
||||||
commentApi.updateStatus(this.type, element, 'PUBLISHED').then(response => {
|
commentApi.updateStatus(this.type, element, 'PUBLISHED').then(response => {
|
||||||
this.$log.debug(`commentId: ${element}, status: PUBLISHED`)
|
this.$log.debug(`commentId: ${element}, status: PUBLISHED`)
|
||||||
|
this.selectedRowKeys = []
|
||||||
|
this.loadComments()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.loadComments()
|
|
||||||
},
|
},
|
||||||
handleRecycleMore() {
|
handleRecycleMore() {
|
||||||
if (this.selectedRowKeys.length <= 0) {
|
if (this.selectedRowKeys.length <= 0) {
|
||||||
this.$message.success('请至少选择一项!')
|
this.$message.success('请至少选择一项!')
|
||||||
|
return
|
||||||
}
|
}
|
||||||
for (let index = 0; index < this.selectedRowKeys.length; index++) {
|
for (let index = 0; index < this.selectedRowKeys.length; index++) {
|
||||||
const element = this.selectedRowKeys[index]
|
const element = this.selectedRowKeys[index]
|
||||||
commentApi.updateStatus(this.type, element, 'RECYCLE').then(response => {
|
commentApi.updateStatus(this.type, element, 'RECYCLE').then(response => {
|
||||||
this.$log.debug(`commentId: ${element}, status: RECYCLE`)
|
this.$log.debug(`commentId: ${element}, status: RECYCLE`)
|
||||||
|
this.selectedRowKeys = []
|
||||||
|
this.loadComments()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.loadComments()
|
|
||||||
},
|
},
|
||||||
handleDeleteMore() {
|
handleDeleteMore() {
|
||||||
if (this.selectedRowKeys.length <= 0) {
|
if (this.selectedRowKeys.length <= 0) {
|
||||||
this.$message.success('请至少选择一项!')
|
this.$message.success('请至少选择一项!')
|
||||||
|
return
|
||||||
}
|
}
|
||||||
for (let index = 0; index < this.selectedRowKeys.length; index++) {
|
for (let index = 0; index < this.selectedRowKeys.length; index++) {
|
||||||
const element = this.selectedRowKeys[index]
|
const element = this.selectedRowKeys[index]
|
||||||
commentApi.delete(this.type, element).then(response => {
|
commentApi.delete(this.type, element).then(response => {
|
||||||
this.$log.debug(`delete: ${element}`)
|
this.$log.debug(`delete: ${element}`)
|
||||||
|
this.selectedRowKeys = []
|
||||||
|
this.loadComments()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.loadComments()
|
|
||||||
},
|
},
|
||||||
onReplyClose() {
|
onReplyClose() {
|
||||||
this.replyComment = {}
|
this.replyComment = {}
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
@click="handleDeleteMore"
|
@click="handlePublishMore"
|
||||||
>
|
>
|
||||||
<span>发布</span>
|
<span>发布</span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -229,7 +229,47 @@
|
||||||
<script>
|
<script>
|
||||||
import categoryApi from '@/api/category'
|
import categoryApi from '@/api/category'
|
||||||
import postApi from '@/api/post'
|
import postApi from '@/api/post'
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: '标题',
|
||||||
|
dataIndex: 'title',
|
||||||
|
scopedSlots: { customRender: 'postTitle' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
className: 'status',
|
||||||
|
dataIndex: 'statusProperty',
|
||||||
|
scopedSlots: { customRender: 'status' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '分类目录',
|
||||||
|
dataIndex: 'categories',
|
||||||
|
scopedSlots: { customRender: 'categories' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '标签',
|
||||||
|
dataIndex: 'tags',
|
||||||
|
scopedSlots: { customRender: 'tags' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '评论量',
|
||||||
|
dataIndex: 'commentCount'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '访问量',
|
||||||
|
dataIndex: 'visits'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '更新时间',
|
||||||
|
dataIndex: 'updateTime',
|
||||||
|
scopedSlots: { customRender: 'updateTime' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
width: '150px',
|
||||||
|
scopedSlots: { customRender: 'action' }
|
||||||
|
}
|
||||||
|
]
|
||||||
export default {
|
export default {
|
||||||
name: 'PostList',
|
name: 'PostList',
|
||||||
components: {},
|
components: {},
|
||||||
|
@ -250,47 +290,7 @@ export default {
|
||||||
status: null
|
status: null
|
||||||
},
|
},
|
||||||
// 表头
|
// 表头
|
||||||
columns: [
|
columns,
|
||||||
{
|
|
||||||
title: '标题',
|
|
||||||
dataIndex: 'title',
|
|
||||||
scopedSlots: { customRender: 'postTitle' }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '状态',
|
|
||||||
className: 'status',
|
|
||||||
dataIndex: 'statusProperty',
|
|
||||||
scopedSlots: { customRender: 'status' }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '分类目录',
|
|
||||||
dataIndex: 'categories',
|
|
||||||
scopedSlots: { customRender: 'categories' }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '标签',
|
|
||||||
dataIndex: 'tags',
|
|
||||||
scopedSlots: { customRender: 'tags' }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '评论量',
|
|
||||||
dataIndex: 'commentCount'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '访问量',
|
|
||||||
dataIndex: 'visits'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '更新时间',
|
|
||||||
dataIndex: 'updateTime',
|
|
||||||
scopedSlots: { customRender: 'updateTime' }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
width: '150px',
|
|
||||||
scopedSlots: { customRender: 'action' }
|
|
||||||
}
|
|
||||||
],
|
|
||||||
selectedRowKeys: [],
|
selectedRowKeys: [],
|
||||||
selectedRows: [],
|
selectedRows: [],
|
||||||
categories: [],
|
categories: [],
|
||||||
|
@ -365,21 +365,53 @@ 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('删除成功!')
|
||||||
this.loadPosts()
|
this.loadPosts()
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
handlePublishMore() {
|
||||||
|
if (this.selectedRowKeys.length <= 0) {
|
||||||
|
this.$message.success('请至少选择一项!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for (let index = 0; index < this.selectedRowKeys.length; index++) {
|
||||||
|
const element = this.selectedRowKeys[index]
|
||||||
|
postApi.updateStatus(element, 'PUBLISHED').then(response => {
|
||||||
|
this.$log.debug(`postId: ${element}, status: PUBLISHED`)
|
||||||
|
this.selectedRowKeys = []
|
||||||
|
this.loadPosts()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleRecycleMore() {
|
||||||
|
if (this.selectedRowKeys.length <= 0) {
|
||||||
|
this.$message.success('请至少选择一项!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for (let index = 0; index < this.selectedRowKeys.length; index++) {
|
||||||
|
const element = this.selectedRowKeys[index]
|
||||||
|
postApi.updateStatus(element, 'RECYCLE').then(response => {
|
||||||
|
this.$log.debug(`postId: ${element}, status: RECYCLE`)
|
||||||
|
this.selectedRowKeys = []
|
||||||
|
this.loadPosts()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleDeleteMore() {
|
||||||
|
if (this.selectedRowKeys.length <= 0) {
|
||||||
|
this.$message.success('请至少选择一项!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for (let index = 0; index < this.selectedRowKeys.length; index++) {
|
||||||
|
const element = this.selectedRowKeys[index]
|
||||||
|
postApi.delete(element).then(response => {
|
||||||
|
this.$log.debug(`delete: ${element}`)
|
||||||
|
this.selectedRowKeys = []
|
||||||
|
this.loadPosts()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue