|
|
@ -300,14 +300,14 @@ export default {
|
|
|
|
interval: null
|
|
|
|
interval: null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
beforeMount() {
|
|
|
|
this.handleLoadStatistics()
|
|
|
|
this.handleLoadStatistics()
|
|
|
|
this.handleListLatestPosts()
|
|
|
|
this.handleListLatestPosts()
|
|
|
|
this.handleListLatestLogs()
|
|
|
|
this.handleListLatestLogs()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
computed: {
|
|
|
|
formattedLogDatas() {
|
|
|
|
formattedLogDatas() {
|
|
|
|
return this.latestLogs.map(log => {
|
|
|
|
return this.latestLogs.map((log) => {
|
|
|
|
log.type = this.logTypes[log.type].text
|
|
|
|
log.type = this.logTypes[log.type].text
|
|
|
|
return log
|
|
|
|
return log
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -319,7 +319,7 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
next(vm => {
|
|
|
|
next((vm) => {
|
|
|
|
vm.interval = setInterval(() => {
|
|
|
|
vm.interval = setInterval(() => {
|
|
|
|
vm.handleLoadStatistics()
|
|
|
|
vm.handleLoadStatistics()
|
|
|
|
}, 5000)
|
|
|
|
}, 5000)
|
|
|
@ -341,7 +341,7 @@ export default {
|
|
|
|
this.activityLoading = true
|
|
|
|
this.activityLoading = true
|
|
|
|
postApi
|
|
|
|
postApi
|
|
|
|
.listLatest(5)
|
|
|
|
.listLatest(5)
|
|
|
|
.then(response => {
|
|
|
|
.then((response) => {
|
|
|
|
this.latestPosts = response.data.data
|
|
|
|
this.latestPosts = response.data.data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
.finally(() => {
|
|
|
@ -354,7 +354,7 @@ export default {
|
|
|
|
this.logLoading = true
|
|
|
|
this.logLoading = true
|
|
|
|
logApi
|
|
|
|
logApi
|
|
|
|
.listLatest(5)
|
|
|
|
.listLatest(5)
|
|
|
|
.then(response => {
|
|
|
|
.then((response) => {
|
|
|
|
this.latestLogs = response.data.data
|
|
|
|
this.latestLogs = response.data.data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
.finally(() => {
|
|
|
@ -366,9 +366,12 @@ export default {
|
|
|
|
handleLoadStatistics() {
|
|
|
|
handleLoadStatistics() {
|
|
|
|
statisticsApi
|
|
|
|
statisticsApi
|
|
|
|
.statistics()
|
|
|
|
.statistics()
|
|
|
|
.then(response => {
|
|
|
|
.then((response) => {
|
|
|
|
this.statisticsData = response.data.data
|
|
|
|
this.statisticsData = response.data.data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(() => {
|
|
|
|
|
|
|
|
clearInterval(this.interval)
|
|
|
|
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
.finally(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.statisticsLoading = false
|
|
|
|
this.statisticsLoading = false
|
|
|
@ -376,7 +379,7 @@ export default {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
handlePostPreview(postId) {
|
|
|
|
handlePostPreview(postId) {
|
|
|
|
postApi.preview(postId).then(response => {
|
|
|
|
postApi.preview(postId).then((response) => {
|
|
|
|
window.open(response.data, '_blank')
|
|
|
|
window.open(response.data, '_blank')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|