announcement v3

This commit is contained in:
tamakyi
2026-10-22 15:28:04 +08:00
parent 33fa643465
commit 2981731d4f
4 changed files with 15 additions and 3 deletions
+7
View File
@@ -178,3 +178,10 @@
- 时间格式:`2006-01-02 15:04` / 带秒 / 纯日期 / RFC3339;裸时间按服务器本地时区(容器是 UTC),启动 INFO 打印解析结果。
- 时间写错只 WARN 关公告不阻断启动(与未知键口径一致);窗口左闭右开。
- 预览验证:TEST_PREVIEW=1 + 临时 test 设 conf.Announcement 渲染 question/list,chrome --headless=old 截图 OK(亮/暗都看过)。
- 公告间距修复:`.tb-announce` 自身的 margin-bottom 会被 UIkit 的
`.uk-container > :last-child { margin-bottom: 0 }` 清零 → 间距必须挂在容器类
`.tb-announce-wrap { margin-bottom: 20px }` 上。这是容器内末元素贴边的通用坑,
以后在 `.uk-container` 里加末位区块都绕这条。
- 环境坑:沙箱 go 是 1.25.5,go.mod 要 1.27.3,GOTOOLCHAIN=auto 需下载工具链模块,
而 GOSUMDB=off 会卡住校验 → 下载工具链那次要放开 GOSUMDB(goproxy.cn 会代理 sumdb)。
+1 -1
View File
@@ -10,7 +10,7 @@ var (
BuildCommit = "dev"
// StaticVersion 静态资源缓存版本号:base.css 与主题 css 共用,改样式只改这一处。
StaticVersion = "20261022a"
StaticVersion = "20261022b"
)
// 文本审核通道取值([security] text_censor_source)。定义在 conf 侧,
+6 -1
View File
@@ -779,11 +779,16 @@ a.tb-chip:hover {
/* 站内公告:配置驱动(conf/app.ini [announcement]),位于导航栏下方、正文之上。
时间窗由服务端判定,窗口外模板整块不渲染,因此这里不需要任何隐藏状态类。 */
/* 与下方正文的间距挂在容器上:UIkit 的 `.uk-container > :last-child { margin-bottom: 0 }`
会把公告条自身的 margin-bottom 清零,表现为公告紧贴下方卡片(改动前就是这样)。 */
.tb-announce-wrap {
margin-bottom: 20px;
}
.tb-announce {
display: flex;
align-items: flex-start;
gap: 10px;
margin: 0 0 16px;
margin: 0;
padding: 10px 14px;
border: 1px solid var(--tb-border);
border-left: 3px solid var(--tb-primary);
+1 -1
View File
@@ -374,7 +374,7 @@ document.addEventListener("DOMContentLoaded", function() {
{{ with announcement }}
<!-- 站内公告:内容与展示时间窗来自 conf/app.ini 的 [announcement] 段。
由服务端按当前时间判定,窗口外整块不渲染,不留空白占位。 -->
<div class="uk-container uk-container-xsmall">
<div class="uk-container uk-container-xsmall tb-announce-wrap">
<div class="tb-announce" role="status">
<span class="tb-announce-icon" aria-hidden="true"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" focusable="false"><path d="M3 11v2a1 1 0 0 0 1 1h2l5 4V6L6 10H4a1 1 0 0 0-1 1z"/><path d="M16 8.5a5 5 0 0 1 0 7"/><path d="M19 6a9 9 0 0 1 0 12"/></svg></span>
<div class="tb-announce-body">{{ . }}</div>