From 2f775241b700e7631fd8906817d44d59a230ba12 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Mon, 21 Feb 2022 13:59:10 +0800 Subject: [PATCH] refactor: post list component code optimization (halo-dev/console#445) Signed-off-by: Ryan Wang --- src/core/constant.js | 27 +++ src/views/post/PostList.vue | 389 ++++++++++++++++++------------------ 2 files changed, 216 insertions(+), 200 deletions(-) diff --git a/src/core/constant.js b/src/core/constant.js index beeab7ec5..0a99fe91a 100644 --- a/src/core/constant.js +++ b/src/core/constant.js @@ -95,3 +95,30 @@ export const attachmentTypes = { text: 'MinIO' } } + +export const postStatuses = { + PUBLISHED: { + value: 'PUBLISHED', + color: 'green', + status: 'success', + text: '已发布' + }, + DRAFT: { + value: 'DRAFT', + color: 'yellow', + status: 'warning', + text: '草稿' + }, + RECYCLE: { + value: 'RECYCLE', + color: 'red', + status: 'error', + text: '回收站' + }, + INTIMATE: { + value: 'INTIMATE', + color: 'blue', + status: 'success', + text: '私密' + } +} diff --git a/src/views/post/PostList.vue b/src/views/post/PostList.vue index d296803b7..4417e6169 100644 --- a/src/views/post/PostList.vue +++ b/src/views/post/PostList.vue @@ -12,8 +12,8 @@ - - {{ postStatus[status].text }} + + {{ postStatuses[status].text }} @@ -51,32 +51,34 @@ 写文章 - - - 发布 - - - 移到回收站 - - - 草稿 - - - 永久删除 - - + 批量操作 @@ -87,138 +89,153 @@ - - - - - - + + + - + - + - +