From df39513b5f2d9e012057e92011d1ef4654a7bb1a Mon Sep 17 00:00:00 2001 From: johnniang Date: Wed, 10 Apr 2019 18:37:57 +0800 Subject: [PATCH] Complete posts pagination show --- src/api/post.js | 25 ++++ src/views/dashboard/Dashboard.vue | 13 +- src/views/post/PostList.vue | 223 ++++++++++++++++++++++++++---- 3 files changed, 223 insertions(+), 38 deletions(-) diff --git a/src/api/post.js b/src/api/post.js index 23b09aa64..ffe2a6b5a 100644 --- a/src/api/post.js +++ b/src/api/post.js @@ -11,4 +11,29 @@ postApi.listLatest = () => { }) } +postApi.query = params => { + return service({ + url: baseUrl, + params: params, + method: 'get' + }) +} + +postApi.postStatus = { + PUBLISHED: { + color: 'green', + status: 'success', + text: '已发布' + }, + DRAFT: { + color: 'yellow', + status: 'warning', + text: '草稿' + }, + RECYCLE: { + color: 'red', + status: 'error', + text: '回收站' + } +} export default postApi diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index 9d09d922e..5e81b5877 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -15,6 +15,7 @@ :bodyStyle="{ padding: '0px' }" > - {{ status.statusText }} + {{ status.text }} { // Format the status - post.status = postStatus[post.status] + post.status = postApi.postStatus[post.status] return post }) } diff --git a/src/views/post/PostList.vue b/src/views/post/PostList.vue index c604ce198..c1bc59215 100644 --- a/src/views/post/PostList.vue +++ b/src/views/post/PostList.vue @@ -4,32 +4,63 @@
- + - + - + - + 已发布 草稿箱 回收站 - + - - {{ category.name }} + + {{ category.name }} - + - 查询 - 重置 + 查询 + 重置 @@ -38,12 +69,23 @@
- 写文章 + 写文章 - 移到回收站 - 永久删除 + + 移到回收站 + + 永久删除 批量操作 @@ -52,11 +94,78 @@
- - - 编辑 + + + + {{ statusProperty.text }} + + + + + {{ category.name }} + + + + + + {{ tag.name }} + + + + + {{ createTime | timeAgo }} + + + + {{ updateTime | timeAgo }} + + + + 编辑 - 删除 + 删除
@@ -66,6 +175,8 @@