Complete log and option api

pull/3445/head
johnniang 2019-03-21 10:43:20 +08:00
parent 1e11a62381
commit 8cdba1b824
4 changed files with 1300 additions and 217 deletions

1469
package-lock.json generated

File diff suppressed because it is too large Load Diff

14
src/api/log.js Normal file
View File

@ -0,0 +1,14 @@
import service from '@/utils/service'
const baseUrl = '/admin/api/logs'
const logApi = {}
logApi.listLatest = () => {
return service({
url: `${baseUrl}/latest`,
method: 'get'
})
}
export default logApi

22
src/api/option.js Normal file
View File

@ -0,0 +1,22 @@
import service from '@/util/service'
const baseUrl = '/admin/api/options'
const optionApi = {}
optionApi.listAll = () => {
return service({
url: baseUrl,
method: 'get'
})
}
optionApi.save = options => {
return service({
url: `${baseUrl}/saving`,
method: 'post',
data: options
})
}
export default optionApi

View File

@ -50,6 +50,7 @@
<script>
import postApi from '@/api/post'
import commentApi from '@/api/comment'
import logApi from '@/api/log'
import adminApi from '@/api/admin'
const postColumns = [
@ -98,18 +99,21 @@ export default {
return {
postLoading: true,
commentLoading: true,
logLoading: true,
countsLoading: true,
postColumns,
postData: [],
commentColumns,
commentData: [],
countsData: { attachmentCount: 0, commentCount: 0, establishDays: 0, postCount: 0 }
logData: [],
countsData: null
}
},
created() {
this.getCounts()
this.listLatestPosts()
this.listLatestComments()
this.listLatestLogs()
},
methods: {
listLatestPosts() {
@ -124,6 +128,12 @@ export default {
this.commentData = response.data.data
})
},
listLatestLogs() {
logApi.listLatest().then(response => {
this.logLoading = false
this.logData = response.data.data
})
},
getCounts() {
adminApi.counts().then(response => {
this.countsLoading = false