mirror of https://github.com/halo-dev/halo-admin
Complete admin counts api
parent
9418d99570
commit
1e11a62381
|
@ -0,0 +1,14 @@
|
|||
import service from '@/utils/service'
|
||||
|
||||
const baseUrl = '/admin/api'
|
||||
|
||||
const adminApi = {}
|
||||
|
||||
adminApi.counts = () => {
|
||||
return service({
|
||||
url: `${baseUrl}/counts`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export default adminApi
|
|
@ -50,6 +50,7 @@
|
|||
<script>
|
||||
import postApi from '@/api/post'
|
||||
import commentApi from '@/api/comment'
|
||||
import adminApi from '@/api/admin'
|
||||
|
||||
const postColumns = [
|
||||
{
|
||||
|
@ -95,16 +96,18 @@ export default {
|
|||
components: {},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
postLoading: true,
|
||||
commentLoading: true,
|
||||
countsLoading: true,
|
||||
postColumns,
|
||||
postData: [],
|
||||
commentColumns,
|
||||
commentData: []
|
||||
commentData: [],
|
||||
countsData: { attachmentCount: 0, commentCount: 0, establishDays: 0, postCount: 0 }
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getCounts()
|
||||
this.listLatestPosts()
|
||||
this.listLatestComments()
|
||||
},
|
||||
|
@ -120,6 +123,12 @@ export default {
|
|||
this.commentLoading = false
|
||||
this.commentData = response.data.data
|
||||
})
|
||||
},
|
||||
getCounts() {
|
||||
adminApi.counts().then(response => {
|
||||
this.countsLoading = false
|
||||
this.countsData = response.data.data
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue