From 30b75693c18d511ef2d96928cb2a1619a9b62012 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Mon, 4 Nov 2024 18:48:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E6=A0=8F=E5=92=8C=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../market/controller/OverviewController.kt | 5 +- .../static/component/overview-tab.js | 92 +++++++++++++------ 2 files changed, 67 insertions(+), 30 deletions(-) diff --git a/src/main/kotlin/com/lanyuanxiaoyao/digtal/market/controller/OverviewController.kt b/src/main/kotlin/com/lanyuanxiaoyao/digtal/market/controller/OverviewController.kt index edb1232..e2cc0b8 100644 --- a/src/main/kotlin/com/lanyuanxiaoyao/digtal/market/controller/OverviewController.kt +++ b/src/main/kotlin/com/lanyuanxiaoyao/digtal/market/controller/OverviewController.kt @@ -31,14 +31,15 @@ class OverviewController { "items" to result.content.map { val iframe = (sites.firstOrNull { site -> site.code == it.code }?.properties?.get("iframe")?: "false").toBoolean() mapOf( - "code" to code, + "code" to it.code, "title" to it.title, "subtitle" to it.subtitle, "author" to it.author, "description" to it.description, "url" to it.url, "createTime" to it.createTime, - "iframe" to iframe + "iframe" to iframe, + "category" to it.category, ) }, "total" to result.totalElements, diff --git a/src/main/resources/static/component/overview-tab.js b/src/main/resources/static/component/overview-tab.js index fa4d280..1463fcd 100644 --- a/src/main/resources/static/component/overview-tab.js +++ b/src/main/resources/static/component/overview-tab.js @@ -1,3 +1,31 @@ +function pagination() { + return { + type: 'pagination', + layout: 'total,perPage,pager', + model: 'normal', + maxButtons: 10, + showPageInput: false, + perPageAvailable: [10, 15, 20], + activePage: '${page|default:1}', + total: '${total|default:0}', + className: 'text-right', + onEvent: { + change: { + actions: [ + { + actionType: 'reload', + componentId: 'news_list', + args: { + page: '${event.data.page}', + count: '${event.data.perPage}', + } + } + ] + } + } + } +} + function overviewTab() { return { title: '总览', @@ -14,6 +42,18 @@ function overviewTab() { } }, body: [ + { + type: 'action', + icon: 'fa fa-refresh', + label: '刷新', + className: 'mb-2', + actionType: 'reload', + target: 'news_list', + }, + { + ...pagination(), + className: 'float-right', + }, { type: 'list', listItem: { @@ -92,38 +132,34 @@ function overviewTab() { tpl: '${description}', }, { - type: 'tpl', - className: 'text-sm font-medium mt-1 text-dark', - tpl: '${DATETOSTR(DATE(createTime), \'YYYY-MM-DD HH:mm\')} ${author}', + type: 'wrapper', + size: 'none', + className: 'mt-2', + body: [ + { + type: 'tag', + label: '${DATETOSTR(DATE(createTime), \'YYYY-MM-DD HH:mm\')}', + displayMode: 'rounded', + color: '#4096ff', + }, + { + type: 'tag', + label: '${category}', + displayMode: 'rounded', + color: '#2fa15d', + }, + { + type: 'tag', + label: '${author}', + displayMode: 'rounded', + color: '#ff8888', + }, + ] }, ] }, }, - { - type: 'pagination', - layout: 'total,perPage,pager', - model: 'normal', - maxButtons: 10, - showPageInput: false, - perPageAvailable: [10, 15, 20], - activePage: '${page|default:1}', - total: '${total|default:0}', - className: 'text-right', - onEvent: { - change: { - actions: [ - { - actionType: 'reload', - componentId: 'news_list', - args: { - page: '${event.data.page}', - count: '${event.data.perPage}', - } - } - ] - } - } - } + pagination(), ] } }