Add category post count support

pull/3445/head
johnniang 2019-04-23 18:38:31 +08:00
parent 5a2aa0b025
commit 9da6b782a6
3 changed files with 35 additions and 8 deletions

View File

@ -4,9 +4,12 @@ const baseUrl = '/api/admin/categories'
const categoryApi = {} const categoryApi = {}
categoryApi.listAll = () => { categoryApi.listAll = (more = false) => {
return service({ return service({
url: `${baseUrl}`, url: `${baseUrl}`,
params: {
more: more
},
method: 'get' method: 'get'
}) })
} }

View File

@ -1,21 +1,45 @@
<template> <template>
<div class="page-header-index-wide"> <div class="page-header-index-wide">
<a-row :gutter="12"> <a-row :gutter="12">
<a-col :xl="18" :lg="18" :md="18" :sm="24" :xs="24" :style="{'padding-bottom':'12px'}"> <a-col
:xl="18"
:lg="18"
:md="18"
:sm="24"
:xs="24"
:style="{'padding-bottom':'12px'}"
>
<a-card> <a-card>
<a-form layout="vertical"> <a-form layout="vertical">
<a-form-item> <a-form-item>
<codemirror v-model="content" :options="options"></codemirror> <codemirror
v-model="content"
:options="options"
></codemirror>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-button type="primary" @click="handlerSaveContent" :disabled="buttonDisabled">保存</a-button> <a-button
type="primary"
@click="handlerSaveContent"
:disabled="buttonDisabled"
>保存</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-card> </a-card>
</a-col> </a-col>
<a-col :xl="6" :lg="6" :md="6" :sm="24" :xs="24" :style="{'padding-bottom':'12px'}"> <a-col
:xl="6"
:lg="6"
:md="6"
:sm="24"
:xs="24"
:style="{'padding-bottom':'12px'}"
>
<a-card title="Anatole 主题"> <a-card title="Anatole 主题">
<theme-file :files="files" @listenToSelect="catchSelectFile"/> <theme-file
:files="files"
@listenToSelect="catchSelectFile"
/>
</a-card> </a-card>
</a-col> </a-col>
</a-row> </a-row>

View File

@ -122,7 +122,7 @@ const columns = [
}, },
{ {
title: '文章数', title: '文章数',
dataIndex: 'posts.count' dataIndex: 'postCount'
}, },
{ {
title: '操作', title: '操作',
@ -145,7 +145,7 @@ export default {
}, },
methods: { methods: {
loadCategories() { loadCategories() {
categoryApi.listAll().then(response => { categoryApi.listAll(true).then(response => {
this.categories = response.data.data this.categories = response.data.data
}) })
}, },