Support journal delete.

pull/9/head
ruibaby 2019-04-26 23:09:04 +08:00
parent b7518ac23d
commit 6808e2ad3a
2 changed files with 21 additions and 1 deletions

View File

@ -28,4 +28,11 @@ journalApi.update = (journalId, journal) => {
})
}
journalApi.delete = journalId => {
return service({
url: `${baseUrl}/${journalId}`,
method: 'delete'
})
}
export default journalApi

View File

@ -87,7 +87,14 @@
@click="handleEdit(item)"
>编辑</a>
<a-divider type="vertical" />
<a-popconfirm
title="你确定要删除这条日志?"
@confirm="handleDelete(item.id)"
okText="确定"
cancelText="取消"
>
<a href="javascript:void(0);">删除</a>
</a-popconfirm>
</template>
<a-list-item-meta :description="item.content">
<span slot="title">{{ item.createTime | moment }}</span>
@ -193,6 +200,12 @@ export default {
this.journal = item
this.visible = true
},
handleDelete(id) {
journalApi.delete(id).then(response => {
this.$message.success('删除成功!')
this.loadJournals()
})
},
createOrUpdateJournal() {
if (this.journal.id) {
journalApi.update(this.journal.id, this.journal).then(response => {