新增功能:
- 主题发现模块:扫描 templates/ 目录下含 theme.json 的目录
- 站点设置新增 site.theme 键,DB 持久化 + 内存缓存
- 运行时切换主题:保存后即时重载 Gin 模板 + 静态资源哈希
- 管理后台 '外观主题' 页面:列表展示、选择、一键切换
- 动态静态资源服务:根据当前主题目录提供 CSS/JS
修复:
- account.html 残留孤儿 {{end}} 模板语法错误
- 动态静态资源 handler 误判 Gin *filepath 路径前缀为绝对路径
变更文件(12 modified + 3 new):
- cmd/server/main.go: 动态主题加载 + 运行时重载 + 动态静态服务
- internal/theme/discovery.go: 新增主题扫描
- internal/config/site_settings.go: ThemeName()
- internal/service/site_setting_service.go: ThemeReloader + UpdateTheme
- internal/controller/admin/: ISP 扩展 + GetThemes/UpdateTheme/ThemePage
- internal/controller/auth_controller.go: 准则路径动态化
- internal/router/: InjectThemeReloader + 新路由
- templates/: 外观主题页面 + JS + CSS + 子导航
This commit is contained in:
@ -123,3 +123,30 @@
|
||||
.toggle-switch input:disabled + .toggle-slider {
|
||||
opacity: 0.4; cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* --- 下拉选择器 + 保存按钮 --- */
|
||||
.setting-select {
|
||||
padding: 6px 10px; border: 1px solid var(--border);
|
||||
border-radius: 4px; font-size: 13px; min-width: 220px;
|
||||
outline: none; background: #fff; cursor: pointer;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
.setting-select:focus { border-color: var(--primary); }
|
||||
.btn-save-select { min-width: 56px; text-align: center; }
|
||||
.btn-save-select:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
|
||||
/* --- 主题信息详情 --- */
|
||||
.setting-info-detail {
|
||||
flex: 1; min-width: 0;
|
||||
font-size: 13px; color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* --- 主题状态提示 --- */
|
||||
.status-success .section-body {
|
||||
background: #e8f5e9; border-left: 3px solid #4caf50;
|
||||
padding: 12px 20px;
|
||||
}
|
||||
.status-error .section-body {
|
||||
background: #fce4ec; border-left: 3px solid #f44336;
|
||||
padding: 12px 20px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user