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>
|
<script>
|
||||||
import postApi from '@/api/post'
|
import postApi from '@/api/post'
|
||||||
import commentApi from '@/api/comment'
|
import commentApi from '@/api/comment'
|
||||||
|
import adminApi from '@/api/admin'
|
||||||
|
|
||||||
const postColumns = [
|
const postColumns = [
|
||||||
{
|
{
|
||||||
|
@ -95,16 +96,18 @@ export default {
|
||||||
components: {},
|
components: {},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: true,
|
|
||||||
postLoading: true,
|
postLoading: true,
|
||||||
commentLoading: true,
|
commentLoading: true,
|
||||||
|
countsLoading: true,
|
||||||
postColumns,
|
postColumns,
|
||||||
postData: [],
|
postData: [],
|
||||||
commentColumns,
|
commentColumns,
|
||||||
commentData: []
|
commentData: [],
|
||||||
|
countsData: { attachmentCount: 0, commentCount: 0, establishDays: 0, postCount: 0 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.getCounts()
|
||||||
this.listLatestPosts()
|
this.listLatestPosts()
|
||||||
this.listLatestComments()
|
this.listLatestComments()
|
||||||
},
|
},
|
||||||
|
@ -120,6 +123,12 @@ export default {
|
||||||
this.commentLoading = false
|
this.commentLoading = false
|
||||||
this.commentData = response.data.data
|
this.commentData = response.data.data
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
getCounts() {
|
||||||
|
adminApi.counts().then(response => {
|
||||||
|
this.countsLoading = false
|
||||||
|
this.countsData = response.data.data
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue