mirror of
https://github.com/GuDong2003/xianyu-auto-reply-fix.git
synced 2026-08-28 17:40:45 +08:00
feat(公告): 仪表盘公告卡片支持 summary 摘要并优化卡片布局
- announcement.json/reply_server.py/app.js 增加 summary 字段,前端优先展示摘要、回退到原 message - dashboard.css 调整卡片为垂直居中、消息两行省略、关闭按钮 flex 居中,缓解长公告把卡片撑高的问题
This commit is contained in:
@@ -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",
|
||||
|
||||
+3
-1
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
+3
-1
@@ -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() {
|
||||
</span>
|
||||
<span class="dashboard-announcement-body">
|
||||
${title ? `<span class="dashboard-announcement-title">${escapeHtml(title)}</span>` : ''}
|
||||
${message ? `<span class="dashboard-announcement-message">${escapeHtml(message)}</span>` : ''}
|
||||
${displayMessage ? `<span class="dashboard-announcement-message">${escapeHtml(displayMessage)}</span>` : ''}
|
||||
</span>
|
||||
</button>
|
||||
<div class="dashboard-announcement-actions">
|
||||
|
||||
Reference in New Issue
Block a user