feat: 重构首页模板,双栏现代化布局 + 移动端适配
- 全新 Hero Banner:渐变背景,用户欢迎语 - 左侧最新文章卡片列表,含标题/摘要/作者/日期 - 右侧侧边栏:用户卡片(修复头像显示)、社区统计、快捷入口 - 完全重写 home.css,现代化样式,sticky 侧边栏 - 移动端适配:768px 单列布局,比例缩放 - 后端路由注入 PostService,获取最新 6 篇 approved 文章
This commit is contained in:
@ -22,9 +22,16 @@ func setupFrontendRoutes(r *gin.Engine, cfg *config.Config, d *dependencies) {
|
||||
})
|
||||
{
|
||||
pages.GET("/", func(c *gin.Context) {
|
||||
posts, total, err := d.postService.List("", 1, 6)
|
||||
if err != nil {
|
||||
posts = nil
|
||||
total = 0
|
||||
}
|
||||
c.HTML(http.StatusOK, "home/index.html", common.BuildPageData(c, gin.H{
|
||||
"Title": "首页",
|
||||
"ExtraCSS": "/static/css/home.css",
|
||||
"Title": "首页",
|
||||
"ExtraCSS": "/static/css/home.css",
|
||||
"Posts": posts,
|
||||
"PostCount": total,
|
||||
}))
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user