Refactor Dashboard.vue.

pull/9/head
ruibaby 2019-05-05 00:22:09 +08:00
parent 18e780269a
commit b1345b6850
2 changed files with 22 additions and 5 deletions

View File

@ -4,9 +4,12 @@ const baseUrl = '/api/admin/logs'
const logApi = {} const logApi = {}
logApi.listLatest = () => { logApi.listLatest = (top) => {
return service({ return service({
url: `${baseUrl}/latest`, url: `${baseUrl}/latest`,
params: {
top: top
},
method: 'get' method: 'get'
}) })
} }

View File

@ -101,7 +101,7 @@
:loading="activityLoading" :loading="activityLoading"
:bordered="false" :bordered="false"
title="新动态" title="新动态"
:bodyStyle="{ padding: '16px' }" :bodyStyle="{ padding: 0 }"
> >
<div class="card-container"> <div class="card-container">
<a-tabs <a-tabs
@ -199,7 +199,10 @@
/> />
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-button type="primary" @click="handleCreateJournalClick"></a-button> <a-button
type="primary"
@click="handleCreateJournalClick"
>保存</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-card> </a-card>
@ -218,7 +221,18 @@
title="日志记录" title="日志记录"
:bodyStyle="{ padding: '16px' }" :bodyStyle="{ padding: '16px' }"
> >
日志记录 <a-list :dataSource="logData">
<a-list-item
slot="renderItem"
slot-scope="item, index"
:key="index"
>
<a-list-item-meta :description="item.createTime | timeAgo">
<span slot="title">{{ item.type }}</span>
</a-list-item-meta>
<div>{{ item.content }}</div>
</a-list-item>
</a-list>
</a-card> </a-card>
</a-col> </a-col>
</a-row> </a-row>
@ -281,7 +295,7 @@ export default {
}) })
}, },
listLatestLogs() { listLatestLogs() {
logApi.listLatest().then(response => { logApi.listLatest(5).then(response => {
this.logData = response.data.data this.logData = response.data.data
this.logLoading = false this.logLoading = false
}) })