mirror of https://github.com/halo-dev/halo-admin
parent
a4a08a5d97
commit
60f5c09280
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "halo-admin",
|
"name": "halo-admin",
|
||||||
"version": "1.3.0-beta.1",
|
"version": "1.3.0-beta.2",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
"build": "vue-cli-service build",
|
"build": "vue-cli-service build",
|
||||||
|
|
|
@ -185,13 +185,13 @@ export const asyncRouterMap = [
|
||||||
component: () => import('@/views/system/ToolList'),
|
component: () => import('@/views/system/ToolList'),
|
||||||
meta: { title: '小工具', hiddenHeaderContent: false }
|
meta: { title: '小工具', hiddenHeaderContent: false }
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
path: '/system/tools/staticpages',
|
// path: '/system/tools/staticpages',
|
||||||
name: 'StaticPagesManage',
|
// name: 'StaticPagesManage',
|
||||||
hidden: true,
|
// hidden: true,
|
||||||
component: () => import('@/views/system/staticpages/StaticPagesManage'),
|
// component: () => import('@/views/system/staticpages/StaticPagesManage'),
|
||||||
meta: { title: '静态部署', hiddenHeaderContent: false }
|
// meta: { title: '静态部署', hiddenHeaderContent: false }
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
path: '/system/about',
|
path: '/system/about',
|
||||||
name: 'About',
|
name: 'About',
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
:style="{ marginBottom: '12px' }"
|
:style="{ marginBottom: '12px' }"
|
||||||
>
|
>
|
||||||
<analysis-card
|
<analysis-card
|
||||||
:loading="countsLoading"
|
:loading="statisticsLoading"
|
||||||
title="文章"
|
title="文章"
|
||||||
:number="statisticsData.postCount"
|
:number="statisticsData.postCount"
|
||||||
>
|
>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
:style="{ marginBottom: '12px' }"
|
:style="{ marginBottom: '12px' }"
|
||||||
>
|
>
|
||||||
<analysis-card
|
<analysis-card
|
||||||
:loading="countsLoading"
|
:loading="statisticsLoading"
|
||||||
title="评论"
|
title="评论"
|
||||||
:number="statisticsData.commentCount"
|
:number="statisticsData.commentCount"
|
||||||
>
|
>
|
||||||
|
@ -52,18 +52,13 @@
|
||||||
:style="{ marginBottom: '12px' }"
|
:style="{ marginBottom: '12px' }"
|
||||||
>
|
>
|
||||||
<analysis-card
|
<analysis-card
|
||||||
:loading="countsLoading"
|
:loading="statisticsLoading"
|
||||||
title="阅读量"
|
title="阅读量"
|
||||||
:number="statisticsData.visitCount"
|
:number="statisticsData.visitCount"
|
||||||
>
|
>
|
||||||
<a-tooltip slot="action">
|
<a-tooltip slot="action">
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
文章阅读共
|
文章阅读共 {{ statisticsData.visitCount }} 次
|
||||||
<countTo
|
|
||||||
:startVal="0"
|
|
||||||
:endVal="statisticsData.visitCount"
|
|
||||||
:duration="3000"
|
|
||||||
></countTo>次
|
|
||||||
</template>
|
</template>
|
||||||
<a href="javascript:void(0);">
|
<a href="javascript:void(0);">
|
||||||
<a-icon type="info-circle-o" />
|
<a-icon type="info-circle-o" />
|
||||||
|
@ -80,7 +75,7 @@
|
||||||
:style="{ marginBottom: '12px' }"
|
:style="{ marginBottom: '12px' }"
|
||||||
>
|
>
|
||||||
<analysis-card
|
<analysis-card
|
||||||
:loading="countsLoading"
|
:loading="statisticsLoading"
|
||||||
title="建立天数"
|
title="建立天数"
|
||||||
:number="statisticsData.establishDays"
|
:number="statisticsData.establishDays"
|
||||||
>
|
>
|
||||||
|
@ -114,7 +109,7 @@
|
||||||
key="1"
|
key="1"
|
||||||
tab="最近文章"
|
tab="最近文章"
|
||||||
>
|
>
|
||||||
<a-list :dataSource="postData">
|
<a-list :dataSource="latestPosts">
|
||||||
<a-list-item
|
<a-list-item
|
||||||
slot="renderItem"
|
slot="renderItem"
|
||||||
slot-scope="item, index"
|
slot-scope="item, index"
|
||||||
|
@ -134,11 +129,12 @@
|
||||||
@click="handlePostPreview(item.id)"
|
@click="handlePostPreview(item.id)"
|
||||||
>{{ item.title }}</a>
|
>{{ item.title }}</a>
|
||||||
<a
|
<a
|
||||||
v-else
|
v-else-if="item.status=='RECYCLE'"
|
||||||
|
slot="title"
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
disabled
|
disabled
|
||||||
>
|
>
|
||||||
{{ text }}
|
{{ item.title }}
|
||||||
</a>
|
</a>
|
||||||
</a-list-item-meta>
|
</a-list-item-meta>
|
||||||
<div>{{ item.createTime | timeAgo }}</div>
|
<div>{{ item.createTime | timeAgo }}</div>
|
||||||
|
@ -237,7 +233,7 @@
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
@click="handleShowLogDrawer"
|
@click="()=>this.logListDrawerVisible = true"
|
||||||
>
|
>
|
||||||
<a-icon type="ellipsis" />
|
<a-icon type="ellipsis" />
|
||||||
</a>
|
</a>
|
||||||
|
@ -259,72 +255,18 @@
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<a-drawer
|
<LogListDrawer
|
||||||
title="操作日志"
|
:visible="logListDrawerVisible"
|
||||||
:width="isMobile()?'100%':'480'"
|
@close="handleLogListClose"
|
||||||
closable
|
/>
|
||||||
:visible="logDrawerVisible"
|
|
||||||
destroyOnClose
|
|
||||||
@close="()=>this.logDrawerVisible = false"
|
|
||||||
>
|
|
||||||
<a-row
|
|
||||||
type="flex"
|
|
||||||
align="middle"
|
|
||||||
>
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-skeleton
|
|
||||||
active
|
|
||||||
:loading="logsLoading"
|
|
||||||
:paragraph="{rows: 18}"
|
|
||||||
>
|
|
||||||
<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>
|
|
||||||
</a-list>
|
|
||||||
</a-skeleton>
|
|
||||||
|
|
||||||
<div class="page-wrapper">
|
|
||||||
<a-pagination
|
|
||||||
class="pagination"
|
|
||||||
:current="logPagination.page"
|
|
||||||
:total="logPagination.total"
|
|
||||||
:defaultPageSize="logPagination.size"
|
|
||||||
:pageSizeOptions="['50', '100','150','200']"
|
|
||||||
showSizeChanger
|
|
||||||
@showSizeChange="handlePaginationChange"
|
|
||||||
@change="handlePaginationChange"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
<a-divider class="divider-transparent" />
|
|
||||||
<div class="bottom-control">
|
|
||||||
<a-popconfirm
|
|
||||||
title="你确定要清空所有操作日志?"
|
|
||||||
okText="确定"
|
|
||||||
@confirm="handleClearLogs"
|
|
||||||
cancelText="取消"
|
|
||||||
>
|
|
||||||
<a-button type="danger">清空操作日志</a-button>
|
|
||||||
</a-popconfirm>
|
|
||||||
</div>
|
|
||||||
</a-drawer>
|
|
||||||
</page-view>
|
</page-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mixin, mixinDevice } from '@/utils/mixin.js'
|
|
||||||
import { PageView } from '@/layouts'
|
import { PageView } from '@/layouts'
|
||||||
import AnalysisCard from './components/AnalysisCard'
|
import AnalysisCard from './components/AnalysisCard'
|
||||||
import RecentCommentTab from './components/RecentCommentTab'
|
import RecentCommentTab from './components/RecentCommentTab'
|
||||||
|
import LogListDrawer from './components/LogListDrawer'
|
||||||
import countTo from 'vue-count-to'
|
import countTo from 'vue-count-to'
|
||||||
|
|
||||||
import postApi from '@/api/post'
|
import postApi from '@/api/post'
|
||||||
|
@ -333,40 +275,26 @@ import statisticsApi from '@/api/statistics'
|
||||||
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,
|
||||||
RecentCommentTab,
|
RecentCommentTab,
|
||||||
countTo
|
countTo,
|
||||||
|
LogListDrawer
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
startVal: 0,
|
|
||||||
logType: logApi.logType,
|
logType: logApi.logType,
|
||||||
activityLoading: true,
|
activityLoading: true,
|
||||||
writeLoading: true,
|
writeLoading: true,
|
||||||
logLoading: true,
|
logLoading: true,
|
||||||
logsLoading: true,
|
statisticsLoading: true,
|
||||||
countsLoading: true,
|
logListDrawerVisible: false,
|
||||||
logDrawerVisible: false,
|
latestPosts: [],
|
||||||
postData: [],
|
latestLogs: [],
|
||||||
logData: [],
|
|
||||||
statisticsData: {},
|
statisticsData: {},
|
||||||
journal: {
|
journal: {
|
||||||
content: '',
|
content: ''
|
||||||
photos: []
|
|
||||||
},
|
|
||||||
logs: [],
|
|
||||||
logPagination: {
|
|
||||||
page: 1,
|
|
||||||
size: 50,
|
|
||||||
sort: null
|
|
||||||
},
|
|
||||||
logQueryParam: {
|
|
||||||
page: 0,
|
|
||||||
size: 50,
|
|
||||||
sort: null
|
|
||||||
},
|
},
|
||||||
interval: null
|
interval: null
|
||||||
}
|
}
|
||||||
|
@ -377,29 +305,16 @@ export default {
|
||||||
this.listLatestLogs()
|
this.listLatestLogs()
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
formattedPostData() {
|
|
||||||
return Object.assign([], this.postData).map(post => {
|
|
||||||
// Format the status
|
|
||||||
post.status = postApi.postStatus[post.status]
|
|
||||||
return post
|
|
||||||
})
|
|
||||||
},
|
|
||||||
formattedLogDatas() {
|
formattedLogDatas() {
|
||||||
return this.logData.map(log => {
|
return this.latestLogs.map(log => {
|
||||||
log.type = this.logType[log.type].text
|
|
||||||
return log
|
|
||||||
})
|
|
||||||
},
|
|
||||||
formattedLogsDatas() {
|
|
||||||
return this.logs.map(log => {
|
|
||||||
log.type = this.logType[log.type].text
|
log.type = this.logType[log.type].text
|
||||||
return log
|
return log
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
destroyed: function() {
|
destroyed: function() {
|
||||||
if (this.logDrawerVisible) {
|
if (this.logListDrawerVisible) {
|
||||||
this.logDrawerVisible = false
|
this.logListDrawerVisible = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeRouteEnter(to, from, next) {
|
beforeRouteEnter(to, from, next) {
|
||||||
|
@ -415,29 +330,29 @@ export default {
|
||||||
this.interval = null
|
this.interval = null
|
||||||
this.$log.debug('Cleared interval')
|
this.$log.debug('Cleared interval')
|
||||||
}
|
}
|
||||||
if (this.logDrawerVisible) {
|
if (this.logListDrawerVisible) {
|
||||||
this.logDrawerVisible = false
|
this.logListDrawerVisible = false
|
||||||
}
|
}
|
||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
listLatestPosts() {
|
async listLatestPosts() {
|
||||||
postApi.listLatest(5).then(response => {
|
postApi.listLatest(5).then(response => {
|
||||||
this.postData = response.data.data
|
this.latestPosts = response.data.data
|
||||||
this.activityLoading = false
|
this.activityLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
listLatestLogs() {
|
async listLatestLogs() {
|
||||||
logApi.listLatest(5).then(response => {
|
logApi.listLatest(5).then(response => {
|
||||||
this.logData = response.data.data
|
this.latestLogs = response.data.data
|
||||||
this.logLoading = false
|
this.logLoading = false
|
||||||
this.writeLoading = false
|
this.writeLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getStatistics() {
|
async getStatistics() {
|
||||||
statisticsApi.statistics().then(response => {
|
statisticsApi.statistics().then(response => {
|
||||||
this.statisticsData = response.data.data
|
this.statisticsData = response.data.data
|
||||||
this.countsLoading = false
|
this.statisticsLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleEditPostClick(post) {
|
handleEditPostClick(post) {
|
||||||
|
@ -456,40 +371,13 @@ export default {
|
||||||
this.journal = {}
|
this.journal = {}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleShowLogDrawer() {
|
|
||||||
this.logDrawerVisible = true
|
|
||||||
this.loadLogs()
|
|
||||||
},
|
|
||||||
loadLogs() {
|
|
||||||
this.logsLoading = true
|
|
||||||
setTimeout(() => {
|
|
||||||
this.logsLoading = false
|
|
||||||
}, 500)
|
|
||||||
this.logQueryParam.page = this.logPagination.page - 1
|
|
||||||
this.logQueryParam.size = this.logPagination.size
|
|
||||||
this.logQueryParam.sort = this.logPagination.sort
|
|
||||||
logApi.pageBy(this.logQueryParam).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()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handlePostPreview(postId) {
|
handlePostPreview(postId) {
|
||||||
postApi.preview(postId).then(response => {
|
postApi.preview(postId).then(response => {
|
||||||
window.open(response.data, '_blank')
|
window.open(response.data, '_blank')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handlePaginationChange(page, pageSize) {
|
handleLogListClose() {
|
||||||
this.$log.debug(`Current: ${page}, PageSize: ${pageSize}`)
|
this.logListDrawerVisible = false
|
||||||
this.logPagination.page = page
|
|
||||||
this.logPagination.size = pageSize
|
|
||||||
this.loadLogs()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,144 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<a-drawer
|
||||||
|
title="操作日志"
|
||||||
|
:width="isMobile()?'100%':'480'"
|
||||||
|
closable
|
||||||
|
:visible="visible"
|
||||||
|
destroyOnClose
|
||||||
|
@close="onClose"
|
||||||
|
>
|
||||||
|
<a-row
|
||||||
|
type="flex"
|
||||||
|
align="middle"
|
||||||
|
>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-skeleton
|
||||||
|
active
|
||||||
|
:loading="loading"
|
||||||
|
:paragraph="{rows: 18}"
|
||||||
|
>
|
||||||
|
<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>
|
||||||
|
</a-list>
|
||||||
|
</a-skeleton>
|
||||||
|
|
||||||
|
<div class="page-wrapper">
|
||||||
|
<a-pagination
|
||||||
|
class="pagination"
|
||||||
|
:current="pagination.page"
|
||||||
|
:total="pagination.total"
|
||||||
|
:defaultPageSize="pagination.size"
|
||||||
|
:pageSizeOptions="['50', '100','150','200']"
|
||||||
|
showSizeChanger
|
||||||
|
@showSizeChange="handlePaginationChange"
|
||||||
|
@change="handlePaginationChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-divider class="divider-transparent" />
|
||||||
|
<div class="bottom-control">
|
||||||
|
<a-popconfirm
|
||||||
|
title="你确定要清空所有操作日志?"
|
||||||
|
okText="确定"
|
||||||
|
@confirm="handleClearLogs"
|
||||||
|
cancelText="取消"
|
||||||
|
>
|
||||||
|
<a-button type="danger">清空操作日志</a-button>
|
||||||
|
</a-popconfirm>
|
||||||
|
</div>
|
||||||
|
</a-drawer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mixin, mixinDevice } from '@/utils/mixin.js'
|
||||||
|
import logApi from '@/api/log'
|
||||||
|
export default {
|
||||||
|
name: 'LogListDrawer',
|
||||||
|
mixins: [mixin, mixinDevice],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
logType: logApi.logType,
|
||||||
|
loading: true,
|
||||||
|
logs: [],
|
||||||
|
pagination: {
|
||||||
|
page: 1,
|
||||||
|
size: 50,
|
||||||
|
sort: null,
|
||||||
|
total: null
|
||||||
|
},
|
||||||
|
logQueryParam: {
|
||||||
|
page: 0,
|
||||||
|
size: 50,
|
||||||
|
sort: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
formattedLogsDatas() {
|
||||||
|
return this.logs.map(log => {
|
||||||
|
log.type = this.logType[log.type].text
|
||||||
|
return log
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
visible: function(newValue, oldValue) {
|
||||||
|
if (newValue) {
|
||||||
|
this.loadSkeleton()
|
||||||
|
this.loadLogs()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
loadSkeleton() {
|
||||||
|
this.loading = true
|
||||||
|
setTimeout(() => {
|
||||||
|
this.loading = false
|
||||||
|
}, 500)
|
||||||
|
},
|
||||||
|
loadLogs() {
|
||||||
|
this.logQueryParam.page = this.pagination.page - 1
|
||||||
|
this.logQueryParam.size = this.pagination.size
|
||||||
|
this.logQueryParam.sort = this.pagination.sort
|
||||||
|
logApi.pageBy(this.logQueryParam).then(response => {
|
||||||
|
this.logs = response.data.data.content
|
||||||
|
this.pagination.total = response.data.data.total
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleClearLogs() {
|
||||||
|
logApi.clear().then(response => {
|
||||||
|
this.$message.success('清除成功!')
|
||||||
|
this.loadLogs()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handlePaginationChange(page, pageSize) {
|
||||||
|
this.$log.debug(`Current: ${page}, PageSize: ${pageSize}`)
|
||||||
|
this.pagination.page = page
|
||||||
|
this.pagination.size = pageSize
|
||||||
|
this.loadLogs()
|
||||||
|
},
|
||||||
|
onClose() {
|
||||||
|
this.$emit('close', false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -26,7 +26,7 @@
|
||||||
>进入</a-button>
|
>进入</a-button>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col
|
<!-- <a-col
|
||||||
:xl="6"
|
:xl="6"
|
||||||
:lg="6"
|
:lg="6"
|
||||||
:md="12"
|
:md="12"
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
@click="handleToStaticPagesManage"
|
@click="handleToStaticPagesManage"
|
||||||
>管理</a-button>
|
>管理</a-button>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col> -->
|
||||||
<a-col
|
<a-col
|
||||||
:xl="6"
|
:xl="6"
|
||||||
:lg="6"
|
:lg="6"
|
||||||
|
@ -151,9 +151,9 @@ export default {
|
||||||
handleToDeveloperOptions() {
|
handleToDeveloperOptions() {
|
||||||
this.$router.push({ name: 'DeveloperOptions' })
|
this.$router.push({ name: 'DeveloperOptions' })
|
||||||
},
|
},
|
||||||
handleToStaticPagesManage() {
|
// handleToStaticPagesManage() {
|
||||||
this.$router.push({ name: 'StaticPagesManage' })
|
// this.$router.push({ name: 'StaticPagesManage' })
|
||||||
},
|
// },
|
||||||
onUploadClose() {
|
onUploadClose() {
|
||||||
this.$refs.upload.handleClearFileList()
|
this.$refs.upload.handleClearFileList()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue