mirror of https://github.com/halo-dev/halo
Fixed some bugs.
parent
99dc4f6b1e
commit
c43c6749b1
|
@ -14,6 +14,21 @@ logApi.listLatest = (top) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logApi.pageBy = logPagination => {
|
||||||
|
return service({
|
||||||
|
url: baseUrl,
|
||||||
|
params: logPagination,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
logApi.clear = () => {
|
||||||
|
return service({
|
||||||
|
url: `${baseUrl}/clear`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
logApi.logType = {
|
logApi.logType = {
|
||||||
BLOG_INITIALIZED: {
|
BLOG_INITIALIZED: {
|
||||||
value: 0,
|
value: 0,
|
||||||
|
|
|
@ -614,4 +614,8 @@ body {
|
||||||
.ant-pagination-options-size-changer.ant-select {
|
.ant-pagination-options-size-changer.ant-select {
|
||||||
margin: 0
|
margin: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pagination {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -115,6 +115,7 @@
|
||||||
</a-row>
|
</a-row>
|
||||||
<div class="page-wrapper">
|
<div class="page-wrapper">
|
||||||
<a-pagination
|
<a-pagination
|
||||||
|
class="pagination"
|
||||||
:total="pagination.total"
|
:total="pagination.total"
|
||||||
:defaultPageSize="pagination.size"
|
:defaultPageSize="pagination.size"
|
||||||
:pageSizeOptions="['18', '36', '54','72','90','108']"
|
:pageSizeOptions="['18', '36', '54','72','90','108']"
|
||||||
|
|
|
@ -431,8 +431,3 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
|
||||||
.pagination {
|
|
||||||
margin-top: 1rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -153,7 +153,7 @@
|
||||||
>{{ item.post.title }}</a>》
|
>{{ item.post.title }}</a>》
|
||||||
</template>
|
</template>
|
||||||
<template slot="actions">
|
<template slot="actions">
|
||||||
<span>回复</span>
|
<span @click="handleCommentReplyClick(item)">回复</span>
|
||||||
</template>
|
</template>
|
||||||
<p slot="content">{{ item.content }}</p>
|
<p slot="content">{{ item.content }}</p>
|
||||||
<a-tooltip
|
<a-tooltip
|
||||||
|
@ -218,9 +218,20 @@
|
||||||
<a-card
|
<a-card
|
||||||
:loading="logLoading"
|
:loading="logLoading"
|
||||||
:bordered="false"
|
:bordered="false"
|
||||||
title="日志记录"
|
|
||||||
:bodyStyle="{ padding: '16px' }"
|
:bodyStyle="{ padding: '16px' }"
|
||||||
>
|
>
|
||||||
|
<template slot="title">
|
||||||
|
操作记录 <a-tooltip
|
||||||
|
slot="action"
|
||||||
|
title="更多"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
href="javascript:void(0);"
|
||||||
|
@click="handleShowLogDrawer"
|
||||||
|
>
|
||||||
|
<a-icon type="ellipsis" /></a>
|
||||||
|
</a-tooltip>
|
||||||
|
</template>
|
||||||
<a-list :dataSource="formattedLogDatas">
|
<a-list :dataSource="formattedLogDatas">
|
||||||
<a-list-item
|
<a-list-item
|
||||||
slot="renderItem"
|
slot="renderItem"
|
||||||
|
@ -236,12 +247,91 @@
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
|
<a-drawer
|
||||||
|
title="操作日志"
|
||||||
|
:width="isMobile()?'100%':'460'"
|
||||||
|
closable
|
||||||
|
:visible="logDrawerVisiable"
|
||||||
|
destroyOnClose
|
||||||
|
@close="onLogDrawerClose"
|
||||||
|
>
|
||||||
|
<a-row
|
||||||
|
type="flex"
|
||||||
|
align="middle"
|
||||||
|
>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-list :dataSource="formattedLogsDatas">
|
||||||
|
<a-list-item
|
||||||
|
slot="renderItem"
|
||||||
|
slot-scope="item, index"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<a-list-item-meta :description="item.createTime | timeAgo">
|
||||||
|
<span slot="title">{{ item.type }}</span>
|
||||||
|
</a-list-item-meta>
|
||||||
|
<div>{{ item.content }}</div>
|
||||||
|
</a-list-item>
|
||||||
|
|
||||||
|
<div class="page-wrapper">
|
||||||
|
<a-pagination
|
||||||
|
class="pagination"
|
||||||
|
:total="logPagination.total"
|
||||||
|
:defaultPageSize="logPagination.size"
|
||||||
|
:pageSizeOptions="['50', '100','150','200']"
|
||||||
|
showSizeChanger
|
||||||
|
@showSizeChange="onPaginationChange"
|
||||||
|
@change="onPaginationChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</a-list>
|
||||||
|
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-divider />
|
||||||
|
<div class="bottom-control">
|
||||||
|
<a-popconfirm
|
||||||
|
title="你确定要清空所有操作日志?"
|
||||||
|
okText="确定"
|
||||||
|
@confirm="handleClearLogs"
|
||||||
|
cancelText="取消"
|
||||||
|
>
|
||||||
|
<a-button type="danger">清空操作日志</a-button>
|
||||||
|
</a-popconfirm>
|
||||||
|
</div>
|
||||||
|
</a-drawer>
|
||||||
|
|
||||||
|
<a-modal
|
||||||
|
v-if="selectComment"
|
||||||
|
:title="'回复给:'+selectComment.author"
|
||||||
|
v-model="selectCommentVisible"
|
||||||
|
>
|
||||||
|
<template slot="footer">
|
||||||
|
<a-button
|
||||||
|
key="submit"
|
||||||
|
type="primary"
|
||||||
|
@click="handleReplyComment"
|
||||||
|
>
|
||||||
|
回复
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
<a-form layout="vertical">
|
||||||
|
<a-form-item>
|
||||||
|
<a-input
|
||||||
|
type="textarea"
|
||||||
|
:autosize="{ minRows: 8 }"
|
||||||
|
v-model="replyComment.content"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</a-modal>
|
||||||
</page-view>
|
</page-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { PageView } from '@/layouts'
|
import { PageView } from '@/layouts'
|
||||||
import AnalysisCard from './components/AnalysisCard'
|
import AnalysisCard from './components/AnalysisCard'
|
||||||
|
import { mixin, mixinDevice } from '@/utils/mixin.js'
|
||||||
|
|
||||||
import postApi from '@/api/post'
|
import postApi from '@/api/post'
|
||||||
import commentApi from '@/api/comment'
|
import commentApi from '@/api/comment'
|
||||||
|
@ -250,6 +340,7 @@ import adminApi from '@/api/admin'
|
||||||
import journalApi from '@/api/journal'
|
import journalApi from '@/api/journal'
|
||||||
export default {
|
export default {
|
||||||
name: 'Dashboard',
|
name: 'Dashboard',
|
||||||
|
mixins: [mixin, mixinDevice],
|
||||||
components: {
|
components: {
|
||||||
PageView,
|
PageView,
|
||||||
AnalysisCard
|
AnalysisCard
|
||||||
|
@ -260,11 +351,21 @@ export default {
|
||||||
activityLoading: true,
|
activityLoading: true,
|
||||||
logLoading: true,
|
logLoading: true,
|
||||||
countsLoading: true,
|
countsLoading: true,
|
||||||
|
logDrawerVisiable: false,
|
||||||
postData: [],
|
postData: [],
|
||||||
commentData: [],
|
commentData: [],
|
||||||
logData: [],
|
logData: [],
|
||||||
countsData: {},
|
countsData: {},
|
||||||
journal: {}
|
journal: {},
|
||||||
|
logPagination: {
|
||||||
|
page: 1,
|
||||||
|
size: 50,
|
||||||
|
sort: null
|
||||||
|
},
|
||||||
|
logs: [],
|
||||||
|
selectCommentVisible: false,
|
||||||
|
selectComment: null,
|
||||||
|
replyComment: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -286,6 +387,12 @@ export default {
|
||||||
log.type = this.logType[log.type].text
|
log.type = this.logType[log.type].text
|
||||||
return log
|
return log
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
formattedLogsDatas() {
|
||||||
|
return this.logs.map(log => {
|
||||||
|
log.type = this.logType[log.type].text
|
||||||
|
return log
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -321,6 +428,48 @@ export default {
|
||||||
this.$message.success('发表成功!')
|
this.$message.success('发表成功!')
|
||||||
this.journal = {}
|
this.journal = {}
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
handleShowLogDrawer() {
|
||||||
|
this.logDrawerVisiable = true
|
||||||
|
this.loadLogs()
|
||||||
|
},
|
||||||
|
loadLogs() {
|
||||||
|
this.logPagination.page = this.logPagination.page - 1
|
||||||
|
logApi.pageBy(this.logPagination).then(response => {
|
||||||
|
this.logs = response.data.data.content
|
||||||
|
this.logPagination.total = response.data.data.total
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleClearLogs() {
|
||||||
|
logApi.clear().then(response => {
|
||||||
|
this.$message.success('清除成功!')
|
||||||
|
this.loadLogs()
|
||||||
|
this.listLatestLogs()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleCommentReplyClick(comment) {
|
||||||
|
this.selectComment = comment
|
||||||
|
this.selectCommentVisible = true
|
||||||
|
this.replyComment.parentId = comment.id
|
||||||
|
this.replyComment.postId = comment.post.id
|
||||||
|
},
|
||||||
|
handleReplyComment() {
|
||||||
|
commentApi.create(this.replyComment).then(response => {
|
||||||
|
this.$message.success('回复成功!')
|
||||||
|
this.replyComment = {}
|
||||||
|
this.selectComment = {}
|
||||||
|
this.selectCommentVisible = false
|
||||||
|
this.listLatestComments()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onLogDrawerClose() {
|
||||||
|
this.logDrawerVisiable = false
|
||||||
|
},
|
||||||
|
onPaginationChange(page, pageSize) {
|
||||||
|
this.$log.debug(`Current: ${page}, PageSize: ${pageSize}`)
|
||||||
|
this.logPagination.page = page
|
||||||
|
this.logPagination.size = pageSize
|
||||||
|
this.loadLogs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,9 +384,3 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.pagination {
|
|
||||||
margin-top: 1rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -116,6 +116,7 @@
|
||||||
<a-pagination
|
<a-pagination
|
||||||
class="pagination"
|
class="pagination"
|
||||||
:total="pagination.total"
|
:total="pagination.total"
|
||||||
|
:defaultPageSize="pagination.size"
|
||||||
:pageSizeOptions="['1', '2', '5', '10', '20', '50', '100']"
|
:pageSizeOptions="['1', '2', '5', '10', '20', '50', '100']"
|
||||||
showSizeChanger
|
showSizeChanger
|
||||||
@showSizeChange="onPaginationChange"
|
@showSizeChange="onPaginationChange"
|
||||||
|
@ -128,6 +129,7 @@
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
|
<!-- 编辑日志弹窗 -->
|
||||||
<a-modal v-model="visible">
|
<a-modal v-model="visible">
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
{{ title }} <a-tooltip
|
{{ title }} <a-tooltip
|
||||||
|
@ -157,6 +159,7 @@
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
|
||||||
|
<!-- 评论回复弹窗 -->
|
||||||
<a-modal
|
<a-modal
|
||||||
v-if="selectComment"
|
v-if="selectComment"
|
||||||
:title="'回复给:'+selectComment.author"
|
:title="'回复给:'+selectComment.author"
|
||||||
|
@ -182,6 +185,7 @@
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
|
||||||
|
<!-- 评论列表抽屉 -->
|
||||||
<a-drawer
|
<a-drawer
|
||||||
title="评论列表"
|
title="评论列表"
|
||||||
:width="isMobile()?'100%':'460'"
|
:width="isMobile()?'100%':'460'"
|
||||||
|
@ -355,8 +359,3 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
|
||||||
.pagination {
|
|
||||||
margin-top: 1rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
Loading…
Reference in New Issue