feat(announcement): 新增首页弹窗公告功能并完成弹窗UI视觉重构

- 数据库与后端:announcements 表增加 is_popup 字段及迁移脚本,提供前台弹窗接口与多公告优先级选取,补全选优单测
- 管理后台:总后台与分销后台公告编辑新增「弹窗公告」开关与列表标签展示
- 前台交互:前台 PC/移动端首页引入 AnnouncementPopup,支持同一用户同一天同一公告仅弹一次的关闭记录
- 视觉优化:重构弹窗结构,顶栏镶嵌品牌橙流光细条与浅暖橙通知徽标,中间内嵌浅灰舒适阅读卡片,底部搭配大锤橙实心主操作按钮
- 验证方式:后端 announcement 单测通过,前端 npm run build 编译无报错,浏览器实机截图验证
This commit is contained in:
yml2213
2026-10-12 18:33:44 +08:00
parent 41d7ffd073
commit 4a9e5f9d66
20 changed files with 758 additions and 14 deletions
+15 -13
View File
@@ -13,19 +13,21 @@ const (
type Announcement struct {
ID uint64 `gorm:"primaryKey" json:"id"`
// DistributionSiteID 公告归属站点:0=主站,>0=对应分站(分站公告中心按站点隔离)。
DistributionSiteID uint64 `gorm:"not null;default:0;index" json:"distribution_site_id"`
Title string `gorm:"size:255;not null" json:"title"`
Content string `gorm:"type:text;not null" json:"content"`
Category string `gorm:"size:32;not null;default:'notice'" json:"category"`
Priority int `gorm:"not null;default:0" json:"priority"`
IsPinned bool `gorm:"not null;default:false" json:"is_pinned"`
IsImportant bool `gorm:"not null;default:false" json:"is_important"`
ViewCount int `gorm:"not null;default:0" json:"view_count"`
Status string `gorm:"size:32;not null;default:'draft'" json:"status"`
PublishedAt *time.Time `json:"published_at"`
CreatedBy *uint64 `json:"created_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DistributionSiteID uint64 `gorm:"not null;default:0;index" json:"distribution_site_id"`
Title string `gorm:"size:255;not null" json:"title"`
Content string `gorm:"type:text;not null" json:"content"`
Category string `gorm:"size:32;not null;default:'notice'" json:"category"`
Priority int `gorm:"not null;default:0" json:"priority"`
IsPinned bool `gorm:"not null;default:false" json:"is_pinned"`
IsImportant bool `gorm:"not null;default:false" json:"is_important"`
// IsPopup 标记弹窗公告:前台首页弹出且需用户手动关闭,多条生效时只弹优先级最高的一条。
IsPopup bool `gorm:"not null;default:false" json:"is_popup"`
ViewCount int `gorm:"not null;default:0" json:"view_count"`
Status string `gorm:"size:32;not null;default:'draft'" json:"status"`
PublishedAt *time.Time `json:"published_at"`
CreatedBy *uint64 `json:"created_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (Announcement) TableName() string {