feat: 重构首页模板,双栏现代化布局 + 移动端适配
- 全新 Hero Banner:渐变背景,用户欢迎语 - 左侧最新文章卡片列表,含标题/摘要/作者/日期 - 右侧侧边栏:用户卡片(修复头像显示)、社区统计、快捷入口 - 完全重写 home.css,现代化样式,sticky 侧边栏 - 移动端适配:768px 单列布局,比例缩放 - 后端路由注入 PostService,获取最新 6 篇 approved 文章
This commit is contained in:
@ -23,6 +23,7 @@ type dependencies struct {
|
|||||||
settingsCtrl *controller.SettingsController
|
settingsCtrl *controller.SettingsController
|
||||||
messageCtrl *controller.MessageController
|
messageCtrl *controller.MessageController
|
||||||
postCtrl *controller.PostController
|
postCtrl *controller.PostController
|
||||||
|
postService *service.PostService
|
||||||
spaceCtrl *controller.SpaceController
|
spaceCtrl *controller.SpaceController
|
||||||
studioCtrl *controller.StudioController
|
studioCtrl *controller.StudioController
|
||||||
adminPostCtrl *adminCtrl.AdminPostController
|
adminPostCtrl *adminCtrl.AdminPostController
|
||||||
|
|||||||
@ -49,7 +49,7 @@ func buildDeps(db *gorm.DB, cfg *config.Config, siteSettings *config.SiteSetting
|
|||||||
return &dependencies{
|
return &dependencies{
|
||||||
authCtrl: authCtrl, authMdw: authMdw, maintenanceMdw: maintenanceMdw,
|
authCtrl: authCtrl, authMdw: authMdw, maintenanceMdw: maintenanceMdw,
|
||||||
settingsCtrl: settingsCtrl,
|
settingsCtrl: settingsCtrl,
|
||||||
messageCtrl: messageController, postCtrl: postCtrl, spaceCtrl: spaceCtrl,
|
messageCtrl: messageController, postCtrl: postCtrl, postService: postService, spaceCtrl: spaceCtrl,
|
||||||
studioCtrl: studioCtrl,
|
studioCtrl: studioCtrl,
|
||||||
adminPostCtrl: adminPostCtrl,
|
adminPostCtrl: adminPostCtrl,
|
||||||
adminCtrl: adminController, auditCtrl: auditController,
|
adminCtrl: adminController, auditCtrl: auditController,
|
||||||
|
|||||||
@ -22,9 +22,16 @@ func setupFrontendRoutes(r *gin.Engine, cfg *config.Config, d *dependencies) {
|
|||||||
})
|
})
|
||||||
{
|
{
|
||||||
pages.GET("/", func(c *gin.Context) {
|
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{
|
c.HTML(http.StatusOK, "home/index.html", common.BuildPageData(c, gin.H{
|
||||||
"Title": "首页",
|
"Title": "首页",
|
||||||
"ExtraCSS": "/static/css/home.css",
|
"ExtraCSS": "/static/css/home.css",
|
||||||
|
"Posts": posts,
|
||||||
|
"PostCount": total,
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -3,36 +3,116 @@
|
|||||||
|
|
||||||
{{template "layout/nav.html" .}}
|
{{template "layout/nav.html" .}}
|
||||||
|
|
||||||
<div class="home-layout">
|
<!-- Hero Banner -->
|
||||||
<main class="hero">
|
<section class="hero-banner">
|
||||||
<div class="container">
|
<div class="hero-bg"></div>
|
||||||
<h1>Meta<span>Lab</span></h1>
|
<div class="hero-content">
|
||||||
<p class="hero-tagline">下一代开发者社区</p>
|
<h1 class="hero-title">Meta<span class="hero-accent">Lab</span></h1>
|
||||||
{{if .IsLoggedIn}}
|
<p class="hero-tagline">下一代开发者社区</p>
|
||||||
<p class="hero-desc">欢迎回来,{{.Username}}</p>
|
{{if .IsLoggedIn}}
|
||||||
{{else}}
|
<p class="hero-welcome">欢迎回来,{{.Username}} 👋</p>
|
||||||
<p class="hero-desc">一个为构建者准备的纯粹空间</p>
|
{{else}}
|
||||||
{{end}}
|
<p class="hero-welcome">一个为构建者准备的纯粹空间</p>
|
||||||
</div>
|
{{end}}
|
||||||
</main>
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<aside class="sidebar">
|
<!-- Main Content -->
|
||||||
<div class="sidebar-card user-card">
|
<div class="container home-main">
|
||||||
{{if .IsLoggedIn}}
|
<div class="home-grid">
|
||||||
<div class="user-card-avatar">{{slice .Username 0 1}}</div>
|
<!-- Left: Article Feed -->
|
||||||
<h3 class="user-card-name">{{.Username}}</h3>
|
<main class="home-feed">
|
||||||
<p class="user-card-desc">欢迎加入 MetaLab</p>
|
<div class="feed-header">
|
||||||
<a href="/settings/profile" class="user-card-link">个人设置</a>
|
<h2 class="feed-title">最新文章</h2>
|
||||||
{{else}}
|
<a href="/posts" class="feed-more">查看全部 →</a>
|
||||||
<div class="user-card-avatar">
|
</div>
|
||||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" width="28" height="28"><circle cx="12" cy="8" r="4"/><path d="M4 20c0-4 4-7 8-7s8 3 8 7"/></svg>
|
|
||||||
|
{{if .Posts}}
|
||||||
|
<div class="article-list">
|
||||||
|
{{range .Posts}}
|
||||||
|
<article class="article-card">
|
||||||
|
<div class="article-body">
|
||||||
|
<h3 class="article-title">
|
||||||
|
<a href="/posts/{{.ID}}">{{.Title}}</a>
|
||||||
|
</h3>
|
||||||
|
<p class="article-excerpt">{{.Excerpt}}</p>
|
||||||
|
<div class="article-meta">
|
||||||
|
<span class="article-author">{{.AuthorName}}</span>
|
||||||
|
<span class="meta-dot">·</span>
|
||||||
|
<span class="article-time">{{.CreatedAt.Format "2006-01-02"}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<div class="empty-feed">
|
||||||
|
<div class="empty-icon">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" width="48" height="48"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg>
|
||||||
|
</div>
|
||||||
|
<p class="empty-text">暂无文章,成为第一个分享的人吧</p>
|
||||||
|
{{if .IsLoggedIn}}
|
||||||
|
<a href="/studio/write" class="btn-primary">开始创作</a>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
<h3 class="user-card-name">未登录</h3>
|
|
||||||
<p class="user-card-desc">登录后解锁社区功能</p>
|
|
||||||
<a href="/auth/login" class="user-card-btn">登录</a>
|
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</main>
|
||||||
</aside>
|
|
||||||
|
<!-- Right: Sidebar -->
|
||||||
|
<aside class="home-sidebar">
|
||||||
|
<!-- User Card -->
|
||||||
|
<div class="sidebar-card user-card">
|
||||||
|
{{if .IsLoggedIn}}
|
||||||
|
{{if .Avatar}}
|
||||||
|
<img src="{{.Avatar}}" alt="{{.Username}}" class="user-avatar-img" onerror="this.style.display='none';this.nextElementSibling.style.display='flex'">
|
||||||
|
<div class="user-avatar-fallback" style="display:none">{{substr .Username 0 1}}</div>
|
||||||
|
{{else}}
|
||||||
|
<div class="user-avatar-fallback">{{substr .Username 0 1}}</div>
|
||||||
|
{{end}}
|
||||||
|
<h3 class="user-card-name">{{.Username}}</h3>
|
||||||
|
<p class="user-card-desc">欢迎加入 MetaLab</p>
|
||||||
|
<a href="/space" class="user-card-link">我的空间</a>
|
||||||
|
{{else}}
|
||||||
|
<div class="user-avatar-fallback guest-avatar">
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" width="28" height="28"><circle cx="12" cy="8" r="4"/><path d="M4 20c0-4 4-7 8-7s8 3 8 7"/></svg>
|
||||||
|
</div>
|
||||||
|
<h3 class="user-card-name">未登录</h3>
|
||||||
|
<p class="user-card-desc">登录后解锁社区功能</p>
|
||||||
|
<a href="/auth/login" class="btn-login">登录</a>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Community Stats -->
|
||||||
|
<div class="sidebar-card stats-card">
|
||||||
|
<h3 class="stats-title">社区动态</h3>
|
||||||
|
<div class="stats-grid">
|
||||||
|
<div class="stat-item">
|
||||||
|
<span class="stat-value">{{.PostCount}}</span>
|
||||||
|
<span class="stat-label">篇文章</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Quick Links -->
|
||||||
|
<div class="sidebar-card links-card">
|
||||||
|
<h3 class="links-title">快捷入口</h3>
|
||||||
|
<a href="/posts" class="links-item">
|
||||||
|
<svg class="links-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>
|
||||||
|
浏览文章
|
||||||
|
</a>
|
||||||
|
{{if .IsLoggedIn}}
|
||||||
|
<a href="/studio/write" class="links-item">
|
||||||
|
<svg class="links-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>
|
||||||
|
发布文章
|
||||||
|
</a>
|
||||||
|
<a href="/space" class="links-item">
|
||||||
|
<svg class="links-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
|
||||||
|
个人空间
|
||||||
|
</a>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{template "layout/footer.html" .}}
|
{{template "layout/footer.html" .}}
|
||||||
|
|||||||
@ -1,341 +1,222 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
MetaLab Home Styles — 首页专属样式(Hero / Plans / Features / Timeline)
|
MetaLab Home Styles — 首页专属样式
|
||||||
仅在首页加载,通过 ExtraCSS 注入
|
现代化双栏布局,移动端优先,体验至上
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
/* ---------- Two-column layout ---------- */
|
/* ---------- Hero Banner ---------- */
|
||||||
.home-layout {
|
.hero-banner {
|
||||||
display: flex;
|
position: relative;
|
||||||
min-height: 100vh;
|
|
||||||
align-items: stretch;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------- Hero ---------- */
|
|
||||||
.hero {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 4rem 0;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background: linear-gradient(180deg, #fff 0%, #f0f4f8 100%);
|
padding: 3.5rem 1.5rem 3rem;
|
||||||
min-width: 0;
|
overflow: hidden;
|
||||||
|
background: linear-gradient(135deg, #3498db 0%, #2980b9 30%, #2c3e50 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero h1 {
|
.hero-bg {
|
||||||
font-size: 4rem;
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: radial-gradient(circle at 20% 50%, rgba(255,255,255,.08) 0%, transparent 60%),
|
||||||
|
radial-gradient(circle at 80% 30%, rgba(255,255,255,.05) 0%, transparent 50%);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-content {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-title {
|
||||||
|
font-size: 3.2rem;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
color: var(--color-primary);
|
color: #fff;
|
||||||
margin-bottom: .6rem;
|
margin-bottom: .5rem;
|
||||||
line-height: 1.1;
|
letter-spacing: -.02em;
|
||||||
letter-spacing: -1px;
|
line-height: 1.15;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero h1 span {
|
.hero-accent {
|
||||||
color: var(--color-accent);
|
color: rgba(255,255,255,.65);
|
||||||
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-tagline {
|
.hero-tagline {
|
||||||
font-size: 1.5rem;
|
font-size: 1.15rem;
|
||||||
color: var(--color-secondary);
|
color: rgba(255,255,255,.75);
|
||||||
margin-bottom: 1.5rem;
|
font-weight: 400;
|
||||||
|
margin-bottom: .75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-welcome {
|
||||||
|
font-size: .95rem;
|
||||||
|
color: rgba(255,255,255,.55);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-desc {
|
/* ---------- Main Layout ---------- */
|
||||||
font-size: 1.15rem;
|
.home-main {
|
||||||
color: var(--color-text-light);
|
padding: 2rem 20px 3rem;
|
||||||
max-width: 500px;
|
|
||||||
margin: 0 auto 2.2rem;
|
|
||||||
line-height: 1.8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.hero-actions {
|
.home-grid {
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 1rem;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cta-button,
|
|
||||||
.secondary-button {
|
|
||||||
display: inline-block;
|
|
||||||
padding: .9rem 2.2rem;
|
|
||||||
border-radius: var(--radius);
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
transition: var(--transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
.cta-button {
|
|
||||||
background: var(--color-accent);
|
|
||||||
color: #fff;
|
|
||||||
border: 2px solid var(--color-accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.cta-button:hover {
|
|
||||||
background: transparent;
|
|
||||||
color: var(--color-accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.secondary-button {
|
|
||||||
background: transparent;
|
|
||||||
color: var(--color-accent);
|
|
||||||
border: 2px solid var(--color-accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.secondary-button:hover {
|
|
||||||
background: var(--color-accent);
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------- Shared section headings ---------- */
|
|
||||||
.section-title {
|
|
||||||
text-align: center;
|
|
||||||
font-size: 2.2rem;
|
|
||||||
color: var(--color-primary);
|
|
||||||
margin-bottom: .8rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section-subtitle {
|
|
||||||
text-align: center;
|
|
||||||
color: var(--color-secondary);
|
|
||||||
font-size: 1.1rem;
|
|
||||||
max-width: 600px;
|
|
||||||
margin: 0 auto 3.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------- Plans ---------- */
|
|
||||||
.plans {
|
|
||||||
min-height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 1.5rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.plans .section-title {
|
|
||||||
font-size: 2rem;
|
|
||||||
margin-bottom: .4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.plans .section-subtitle {
|
|
||||||
margin-bottom: 1.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.plans-grid {
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
grid-template-columns: 1fr 340px;
|
||||||
gap: 1.25rem;
|
gap: 2rem;
|
||||||
|
align-items: start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.plan-card {
|
/* ---------- Feed (Left) ---------- */
|
||||||
background: var(--color-surface);
|
.home-feed {
|
||||||
border-radius: var(--radius);
|
min-width: 0;
|
||||||
padding: 1.5rem;
|
}
|
||||||
box-shadow: var(--shadow);
|
|
||||||
transition: var(--transition);
|
.feed-header {
|
||||||
border: 1px solid var(--color-border);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
justify-content: space-between;
|
||||||
position: relative;
|
align-items: baseline;
|
||||||
|
margin-bottom: 1.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.plan-card:hover {
|
.feed-title {
|
||||||
transform: translateY(-5px);
|
font-size: 1.35rem;
|
||||||
box-shadow: 0 10px 20px rgba(0,0,0,.12);
|
font-weight: 700;
|
||||||
}
|
|
||||||
|
|
||||||
.plan-icon {
|
|
||||||
width: 50px;
|
|
||||||
height: 50px;
|
|
||||||
background: rgba(52,152,219,.1);
|
|
||||||
border-radius: 50%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
color: var(--color-accent);
|
|
||||||
font-size: 1.6rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.plan-card h3 {
|
|
||||||
font-size: 1.25rem;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--color-primary);
|
color: var(--color-primary);
|
||||||
margin-bottom: .5rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.plan-card p {
|
.feed-more {
|
||||||
color: var(--color-text-light);
|
font-size: .88rem;
|
||||||
margin-bottom: 1rem;
|
|
||||||
flex-grow: 1;
|
|
||||||
font-size: .95rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.plan-status {
|
|
||||||
display: inline-block;
|
|
||||||
background: #e8f4fc;
|
|
||||||
color: var(--color-accent);
|
color: var(--color-accent);
|
||||||
padding: .3rem .9rem;
|
|
||||||
border-radius: 20px;
|
|
||||||
font-size: .85rem;
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: opacity .2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------- Features ---------- */
|
.feed-more:hover {
|
||||||
.features {
|
opacity: .75;
|
||||||
min-height: 100vh;
|
}
|
||||||
|
|
||||||
|
/* ---------- Article Cards ---------- */
|
||||||
|
.article-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
gap: 1rem;
|
||||||
padding: 4rem 0;
|
}
|
||||||
|
|
||||||
|
.article-card {
|
||||||
background: var(--color-surface);
|
background: var(--color-surface);
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
padding: 1.35rem 1.5rem;
|
||||||
|
transition: box-shadow .2s ease, transform .2s ease;
|
||||||
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
.features-grid {
|
.article-card:hover {
|
||||||
display: grid;
|
box-shadow: 0 4px 20px rgba(0,0,0,.08);
|
||||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
transform: translateY(-1px);
|
||||||
gap: 2.5rem;
|
|
||||||
margin-top: 3rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.feature {
|
.article-body {
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.feature .icon {
|
|
||||||
font-size: 2.5rem;
|
|
||||||
color: var(--color-accent);
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.feature h3 {
|
|
||||||
font-size: 1.3rem;
|
|
||||||
margin-bottom: .8rem;
|
|
||||||
color: var(--color-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.feature p {
|
|
||||||
color: var(--color-text-light);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------- Timeline ---------- */
|
|
||||||
.section-group {
|
|
||||||
height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.timeline-vision {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 1.5rem 0 1rem;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timeline-vision .section-title {
|
.article-title {
|
||||||
margin-bottom: .3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.timeline-vision .section-subtitle {
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.timeline {
|
|
||||||
max-width: 1100px;
|
|
||||||
margin: 0 auto;
|
|
||||||
position: relative;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 2rem;
|
|
||||||
padding: 2rem 0 1rem;
|
|
||||||
overflow-x: auto;
|
|
||||||
overflow-y: visible;
|
|
||||||
-webkit-overflow-scrolling: touch;
|
|
||||||
overscroll-behavior-y: contain;
|
|
||||||
}
|
|
||||||
|
|
||||||
.timeline::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
left: 4%;
|
|
||||||
top: 1.9rem;
|
|
||||||
width: 92%;
|
|
||||||
height: 3px;
|
|
||||||
background: var(--color-accent);
|
|
||||||
border-radius: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.timeline-item {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
position: relative;
|
|
||||||
flex-shrink: 0;
|
|
||||||
min-width: 200px;
|
|
||||||
max-width: 240px;
|
|
||||||
padding: 0 .5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.timeline-marker {
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
background: var(--color-accent);
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 4px solid var(--color-surface);
|
|
||||||
box-shadow: var(--shadow);
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
z-index: 1;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.timeline-content {
|
|
||||||
background: var(--color-surface);
|
|
||||||
border-radius: var(--radius);
|
|
||||||
padding: 1.5rem 1.2rem;
|
|
||||||
box-shadow: var(--shadow);
|
|
||||||
border: 1px solid var(--color-border);
|
|
||||||
text-align: center;
|
|
||||||
width: 100%;
|
|
||||||
transition: var(--transition);
|
|
||||||
}
|
|
||||||
|
|
||||||
.timeline-item:hover .timeline-content {
|
|
||||||
transform: translateY(-4px);
|
|
||||||
box-shadow: 0 10px 20px rgba(0,0,0,.12);
|
|
||||||
}
|
|
||||||
|
|
||||||
.timeline-title {
|
|
||||||
font-size: 1.15rem;
|
font-size: 1.15rem;
|
||||||
font-weight: 600;
|
font-weight: 650;
|
||||||
|
margin-bottom: .45rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-title a {
|
||||||
color: var(--color-primary);
|
color: var(--color-primary);
|
||||||
margin-bottom: .5rem;
|
text-decoration: none;
|
||||||
|
transition: color .15s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timeline-desc {
|
.article-title a:hover {
|
||||||
|
color: var(--color-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-excerpt {
|
||||||
|
font-size: .9rem;
|
||||||
color: var(--color-text-light);
|
color: var(--color-text-light);
|
||||||
font-size: .95rem;
|
line-height: 1.6;
|
||||||
|
margin-bottom: .75rem;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------- Sidebar ---------- */
|
.article-meta {
|
||||||
.sidebar {
|
display: flex;
|
||||||
width: 300px;
|
align-items: center;
|
||||||
flex-shrink: 0;
|
gap: .35rem;
|
||||||
padding: 4rem 20px 4rem 0;
|
font-size: .82rem;
|
||||||
|
color: var(--color-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-author {
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--color-text-light);
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-dot {
|
||||||
|
color: var(--color-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Empty Feed ---------- */
|
||||||
|
.empty-feed {
|
||||||
|
text-align: center;
|
||||||
|
padding: 3.5rem 1.5rem;
|
||||||
|
background: var(--color-surface);
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-icon {
|
||||||
|
color: var(--color-border);
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-text {
|
||||||
|
font-size: .95rem;
|
||||||
|
color: var(--color-text-light);
|
||||||
|
margin-bottom: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
display: inline-block;
|
||||||
|
padding: .6rem 1.8rem;
|
||||||
|
background: var(--color-accent);
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: .9rem;
|
||||||
|
font-weight: 600;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: background .2s ease, transform .15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background: #2980b9;
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Sidebar (Right) ---------- */
|
||||||
|
.home-sidebar {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1rem;
|
gap: 1.25rem;
|
||||||
|
position: sticky;
|
||||||
|
top: 5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-card {
|
.sidebar-card {
|
||||||
background: var(--color-surface);
|
background: var(--color-surface);
|
||||||
border-radius: var(--radius);
|
border-radius: 10px;
|
||||||
box-shadow: var(--shadow);
|
|
||||||
border: 1px solid var(--color-border);
|
border: 1px solid var(--color-border);
|
||||||
padding: 1.5rem;
|
padding: 1.35rem 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- User Card --- */
|
/* --- User Card --- */
|
||||||
@ -343,93 +224,214 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-card-avatar {
|
.user-avatar-img {
|
||||||
width: 56px;
|
width: 64px;
|
||||||
height: 56px;
|
height: 64px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: var(--color-accent);
|
object-fit: cover;
|
||||||
|
border: 3px solid var(--color-accent);
|
||||||
|
display: block;
|
||||||
|
margin: 0 auto .75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-avatar-fallback {
|
||||||
|
width: 64px;
|
||||||
|
height: 64px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: linear-gradient(135deg, var(--color-accent), #2980b9);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin: 0 auto .8rem;
|
margin: 0 auto .75rem;
|
||||||
font-size: 1.5rem;
|
font-size: 1.6rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.guest-avatar {
|
||||||
|
background: var(--color-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.guest-avatar svg {
|
||||||
|
color: var(--color-text-light);
|
||||||
|
}
|
||||||
|
|
||||||
.user-card-name {
|
.user-card-name {
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
font-weight: 600;
|
font-weight: 650;
|
||||||
color: var(--color-primary);
|
color: var(--color-primary);
|
||||||
margin-bottom: .3rem;
|
margin-bottom: .25rem;
|
||||||
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-card-desc {
|
.user-card-desc {
|
||||||
font-size: .85rem;
|
font-size: .82rem;
|
||||||
color: var(--color-text-light);
|
color: var(--color-text-light);
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-card-link {
|
.user-card-link {
|
||||||
display: inline-block;
|
display: block;
|
||||||
font-size: .85rem;
|
font-size: .85rem;
|
||||||
color: var(--color-accent);
|
color: var(--color-accent);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
transition: var(--transition);
|
text-decoration: none;
|
||||||
|
padding: .45rem 0;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: rgba(52,152,219,.06);
|
||||||
|
transition: background .15s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-card-link:hover {
|
.user-card-link:hover {
|
||||||
opacity: .8;
|
background: rgba(52,152,219,.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-card-btn {
|
.btn-login {
|
||||||
display: inline-block;
|
display: block;
|
||||||
padding: .5rem 1.8rem;
|
padding: .55rem 0;
|
||||||
background: var(--color-accent);
|
background: var(--color-accent);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: var(--radius);
|
border-radius: 8px;
|
||||||
font-size: .9rem;
|
font-size: .9rem;
|
||||||
font-weight: 500;
|
font-weight: 600;
|
||||||
transition: var(--transition);
|
text-decoration: none;
|
||||||
|
transition: background .2s ease, transform .15s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-card-btn:hover {
|
.btn-login:hover {
|
||||||
opacity: .85;
|
background: #2980b9;
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- Stats Card --- */
|
||||||
|
.stats-title {
|
||||||
|
font-size: .92rem;
|
||||||
|
font-weight: 650;
|
||||||
|
color: var(--color-primary);
|
||||||
|
margin-bottom: .85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-grid {
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-item {
|
||||||
|
text-align: center;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-value {
|
||||||
|
display: block;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--color-accent);
|
||||||
|
line-height: 1;
|
||||||
|
margin-bottom: .25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-label {
|
||||||
|
font-size: .78rem;
|
||||||
|
color: var(--color-text-light);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- Links Card --- */
|
||||||
|
.links-title {
|
||||||
|
font-size: .92rem;
|
||||||
|
font-weight: 650;
|
||||||
|
color: var(--color-primary);
|
||||||
|
margin-bottom: .75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.links-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: .6rem;
|
||||||
|
padding: .55rem .5rem;
|
||||||
|
font-size: .88rem;
|
||||||
|
color: var(--color-text-light);
|
||||||
|
border-radius: 6px;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: background .15s ease, color .15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.links-item:hover {
|
||||||
|
background: var(--color-bg);
|
||||||
|
color: var(--color-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.links-icon {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Responsive ---------- */
|
||||||
|
@media (max-width: 960px) {
|
||||||
|
.home-grid {
|
||||||
|
grid-template-columns: 1fr 280px;
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-title {
|
||||||
|
font-size: 2.6rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------- Responsive (首页专属) ---------- */
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.hero h1 {
|
.hero-banner {
|
||||||
font-size: 3rem;
|
padding: 2.5rem 1.25rem 2.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hero-title {
|
||||||
|
font-size: 2.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
.hero-tagline {
|
.hero-tagline {
|
||||||
font-size: 1.25rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
.hero-desc {
|
|
||||||
|
.home-main {
|
||||||
|
padding: 1.5rem 16px 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-sidebar {
|
||||||
|
position: static;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-card {
|
||||||
|
padding: 1.1rem 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-title {
|
||||||
font-size: 1.05rem;
|
font-size: 1.05rem;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.timeline {
|
@media (max-width: 480px) {
|
||||||
justify-content: flex-start;
|
.hero-banner {
|
||||||
gap: 1.5rem;
|
padding: 2rem 1rem 1.75rem;
|
||||||
padding: 2rem 20px 1.5rem;
|
|
||||||
}
|
}
|
||||||
.timeline-item {
|
|
||||||
min-width: 240px;
|
.hero-title {
|
||||||
max-width: 280px;
|
font-size: 1.8rem;
|
||||||
}
|
}
|
||||||
.timeline::before {
|
|
||||||
left: 20px;
|
.hero-welcome {
|
||||||
width: calc(240px * 4 + 1.5rem * 3 + 20px);
|
font-size: .85rem;
|
||||||
}
|
}
|
||||||
.cta-button,
|
|
||||||
.secondary-button {
|
.feed-title {
|
||||||
display: block;
|
font-size: 1.15rem;
|
||||||
width: 100%;
|
|
||||||
margin: .5rem 0;
|
|
||||||
}
|
}
|
||||||
.secondary-button {
|
|
||||||
margin-left: 0;
|
.home-main {
|
||||||
|
padding: 1rem 12px 1.5rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user