From 6ec7652c0b965af21b819ebbb04a3d69a8f8b411 Mon Sep 17 00:00:00 2001 From: GuDong <1735590698@qq.com> Date: Tue, 19 May 2026 20:17:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=85=AC=E5=91=8A):=20=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E7=9B=98=E5=85=AC=E5=91=8A=E5=8D=A1=E7=89=87=E6=94=AF=E6=8C=81?= =?UTF-8?q?=20summary=20=E6=91=98=E8=A6=81=E5=B9=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - announcement.json/reply_server.py/app.js 增加 summary 字段,前端优先展示摘要、回退到原 message - dashboard.css 调整卡片为垂直居中、消息两行省略、关闭按钮 flex 居中,缓解长公告把卡片撑高的问题 --- announcement.json | 1 + reply_server.py | 4 +++- static/css/dashboard.css | 17 +++++++++++++++-- static/js/app.js | 4 +++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/announcement.json b/announcement.json index e11d591..e7f86cf 100644 --- a/announcement.json +++ b/announcement.json @@ -5,6 +5,7 @@ "enabled": true, "level": "warning", "title": "v2.0.0 大版本升级提醒", + "summary": "v2.0.0 已发布:本次为大版本升级,涉及登录、滑块、在线客服、商品发布和历史订单等重要调整,建议查看说明后手动升级。", "message": "v2.0.0 已发布,本次包含登录、扫码、滑块验证、Token刷新、在线客服、商品发布、历史订单同步和数据库结构等较大调整。由于涉及依赖、浏览器自动化和运行环境变化,不建议仅通过在线热更新完成升级。升级前请先备份 data 目录。源码部署用户请拉取最新代码后执行 pip install -r requirements.txt、playwright install chromium 并重启服务;Docker 镜像部署用户请拉取最新镜像并重启容器;本地源码构建 Docker 的用户请重新构建容器。若在线更新后出现登录、扫码、滑块或页面异常,请改用手动方式重新部署。", "dismissible": true, "published_at": "2026-05-19T02:00:00+08:00", diff --git a/reply_server.py b/reply_server.py index fe897be..8caed9d 100644 --- a/reply_server.py +++ b/reply_server.py @@ -243,7 +243,8 @@ def _normalize_dashboard_announcement_entry(payload: Any) -> Optional[Dict[str, end_at = _parse_announcement_datetime(payload.get('end_at')) title = str(payload.get('title') or '').strip() message = str(payload.get('message') or '').strip() - if not title and not message: + summary = str(payload.get('summary') or payload.get('brief') or payload.get('short_message') or '').strip() + if not title and not message and not summary: return None level = str(payload.get('level') or 'info').strip().lower() @@ -281,6 +282,7 @@ def _normalize_dashboard_announcement_entry(payload: Any) -> Optional[Dict[str, 'status': status, 'level': level, 'title': title, + 'summary': summary, 'message': message, 'action_text': action_text, 'action_type': action_type, diff --git a/static/css/dashboard.css b/static/css/dashboard.css index 85c8e6f..d4a31a4 100644 --- a/static/css/dashboard.css +++ b/static/css/dashboard.css @@ -28,7 +28,7 @@ .dashboard-announcement-card { display: flex; - align-items: flex-start; + align-items: center; gap: 0.75rem; min-height: 72px; padding: 0.85rem 0.95rem; @@ -89,11 +89,15 @@ font-size: 0.8rem; line-height: 1.45; white-space: pre-line; + overflow: hidden; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; } .dashboard-announcement-actions { display: inline-flex; - align-items: flex-start; + align-items: center; gap: 0.45rem; flex: 0 0 auto; } @@ -118,6 +122,15 @@ .dashboard-announcement-close { width: 32px; padding: 0; + display: inline-flex; + align-items: center; + justify-content: center; + line-height: 1; +} + +.dashboard-announcement-close .bi { + display: block; + line-height: 1; } .dashboard-announcement-action:hover, diff --git a/static/js/app.js b/static/js/app.js index 74322d8..eaa26da 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -574,6 +574,8 @@ function renderDashboardAnnouncement() { : 'info'; const title = String(currentAnnouncement.title || '').trim(); const message = String(currentAnnouncement.message || '').trim(); + const summary = String(currentAnnouncement.summary || currentAnnouncement.brief || currentAnnouncement.short_message || '').trim(); + const displayMessage = summary || message; const actionText = String(currentAnnouncement.action_type ? (currentAnnouncement.action_text || '') : '').trim(); const dismissible = currentAnnouncement.dismissible !== false; @@ -592,7 +594,7 @@ function renderDashboardAnnouncement() { ${title ? `${escapeHtml(title)}` : ''} - ${message ? `` : ''} + ${displayMessage ? `` : ''}