feat(home-banner): 轮播支持 PC/移动两端分图与热区跳转,热区图悬浮放大;修复上传压缩压白透明 PNG

This commit is contained in:
yml2213
2026-10-16 16:02:29 +08:00
parent b5867e3c5e
commit 9f8c0f9cb2
21 changed files with 2217 additions and 272 deletions
+40 -5
View File
@@ -73,13 +73,48 @@ type AgreementContentDTO struct {
Content string `json:"content"`
}
// HomeBannerItem 首页轮播项:文案 + PC/移动两端视觉配置(图片、整图点击、热区)。
type HomeBannerItem struct {
Eyebrow string `json:"eyebrow"`
Title string `json:"title"`
Badge string `json:"badge"`
Pill string `json:"pill"`
Tone string `json:"tone"`
Eyebrow string `json:"eyebrow"`
Title string `json:"title"`
Badge string `json:"badge"`
Pill string `json:"pill"`
Tone string `json:"tone"`
Enabled *bool `json:"enabled,omitempty"`
// ImageURL 早期扁平结构的图片字段,仅用于兼容读取:归一化时并入 PC/移动两端。
ImageURL string `json:"image_url,omitempty"`
PC HomeBannerVisual `json:"pc"`
Mobile HomeBannerVisual `json:"mobile"`
}
// HomeBannerVisual 单端展示配置:图片 + 整图点击行为 + 热区。
type HomeBannerVisual struct {
ImageURL string `json:"image_url,omitempty"`
Alt string `json:"alt,omitempty"`
Action HomeBannerAction `json:"action"`
Hotspots []HomeBannerHotspot `json:"hotspots,omitempty"`
}
// HomeBannerAction 点击行为:none(不跳转)/ route(站内路径)/ link(外部链接)/ preview(查看大图)。
type HomeBannerAction struct {
Type string `json:"type"`
Target string `json:"target"`
OpenNewTab bool `json:"open_new_tab"`
}
// HomeBannerHotspot 热区:相对图片的百分比坐标(0-100),与出图分辨率解耦。
type HomeBannerHotspot struct {
ID string `json:"id"`
Label string `json:"label"`
X float64 `json:"x"`
Y float64 `json:"y"`
Width float64 `json:"width"`
Height float64 `json:"height"`
// ImageURL 热区按钮图(透明 PNG),留空则前台用半透明高亮框提示可点击。
ImageURL string `json:"image_url,omitempty"`
// HoverScale 悬浮放大倍数:1 表示不放大,建议 1.04-1.08。
HoverScale float64 `json:"hover_scale,omitempty"`
Action HomeBannerAction `json:"action"`
}
type PublishOptionsDTO struct {