- Model/Repo/Service/Controller 全栈实现 - CRUD + ListActive(生效时间范围过滤) - 管理后台独立页面 /admin/announcements(列表+弹窗CRUD) - 前台首页 Hero 下方公告栏(info/success/warning/error 四色) - Moderator+ 权限可管理公告
494 lines
9.0 KiB
CSS
494 lines
9.0 KiB
CSS
/* ============================================================
|
|
MetaLab Home Styles — 首页专属样式
|
|
现代化双栏布局,移动端优先,体验至上
|
|
============================================================ */
|
|
|
|
/* ---------- Hero Banner ---------- */
|
|
.hero-banner {
|
|
position: relative;
|
|
text-align: center;
|
|
padding: 3.5rem 1.5rem 3rem;
|
|
overflow: hidden;
|
|
background: linear-gradient(135deg, #3498db 0%, #2980b9 30%, #2c3e50 100%);
|
|
}
|
|
|
|
.hero-bg {
|
|
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;
|
|
color: #fff;
|
|
margin-bottom: .5rem;
|
|
letter-spacing: -.02em;
|
|
line-height: 1.15;
|
|
}
|
|
|
|
.hero-accent {
|
|
color: rgba(255,255,255,.65);
|
|
font-weight: 700;
|
|
}
|
|
|
|
.hero-tagline {
|
|
font-size: 1.15rem;
|
|
color: rgba(255,255,255,.75);
|
|
font-weight: 400;
|
|
margin-bottom: .75rem;
|
|
}
|
|
|
|
.hero-welcome {
|
|
font-size: .95rem;
|
|
color: rgba(255,255,255,.55);
|
|
font-weight: 400;
|
|
}
|
|
|
|
/* ---------- Main Layout ---------- */
|
|
.home-main {
|
|
padding: 2rem 20px 3rem;
|
|
}
|
|
|
|
.home-grid {
|
|
display: grid;
|
|
grid-template-columns: 1fr 340px;
|
|
gap: 2rem;
|
|
align-items: start;
|
|
}
|
|
|
|
/* ---------- Feed (Left) ---------- */
|
|
.home-feed {
|
|
min-width: 0;
|
|
}
|
|
|
|
.feed-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: baseline;
|
|
margin-bottom: 1.25rem;
|
|
}
|
|
|
|
.feed-title {
|
|
font-size: 1.35rem;
|
|
font-weight: 700;
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
.feed-more {
|
|
font-size: .88rem;
|
|
color: var(--color-accent);
|
|
font-weight: 500;
|
|
text-decoration: none;
|
|
transition: opacity .2s ease;
|
|
}
|
|
|
|
.feed-more:hover {
|
|
opacity: .75;
|
|
}
|
|
|
|
/* ---------- Article Cards ---------- */
|
|
.article-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.article-card {
|
|
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;
|
|
}
|
|
|
|
.article-card:hover {
|
|
box-shadow: 0 4px 20px rgba(0,0,0,.08);
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.article-body {
|
|
overflow: hidden;
|
|
}
|
|
|
|
.article-title {
|
|
font-size: 1.15rem;
|
|
font-weight: 650;
|
|
margin-bottom: .45rem;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.article-title a {
|
|
color: var(--color-primary);
|
|
text-decoration: none;
|
|
transition: color .15s ease;
|
|
}
|
|
|
|
.article-title a:hover {
|
|
color: var(--color-accent);
|
|
}
|
|
|
|
.article-excerpt {
|
|
font-size: .9rem;
|
|
color: var(--color-text-light);
|
|
line-height: 1.6;
|
|
margin-bottom: .75rem;
|
|
display: -webkit-box;
|
|
-webkit-line-clamp: 2;
|
|
-webkit-box-orient: vertical;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.article-meta {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: .35rem;
|
|
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;
|
|
flex-direction: column;
|
|
gap: 1.25rem;
|
|
position: sticky;
|
|
top: 5rem;
|
|
}
|
|
|
|
.sidebar-card {
|
|
background: var(--color-surface);
|
|
border-radius: 10px;
|
|
border: 1px solid var(--color-border);
|
|
padding: 1.35rem 1.5rem;
|
|
}
|
|
|
|
/* --- User Card --- */
|
|
.user-card {
|
|
text-align: center;
|
|
}
|
|
|
|
.user-avatar-img {
|
|
width: 64px;
|
|
height: 64px;
|
|
border-radius: 50%;
|
|
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: rgba(255,255,255,.75);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin: 0 auto .75rem;
|
|
}
|
|
.user-avatar-fallback svg {
|
|
width: 55%;
|
|
height: 55%;
|
|
}
|
|
|
|
.guest-avatar {
|
|
background: var(--color-border);
|
|
}
|
|
|
|
.guest-avatar svg {
|
|
color: var(--color-text-light);
|
|
}
|
|
|
|
.user-card-name {
|
|
font-size: 1.1rem;
|
|
font-weight: 650;
|
|
color: var(--color-primary);
|
|
margin-bottom: .25rem;
|
|
word-break: break-all;
|
|
}
|
|
|
|
.user-card-desc {
|
|
font-size: .82rem;
|
|
color: var(--color-text-light);
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.user-card-link {
|
|
display: block;
|
|
font-size: .85rem;
|
|
color: var(--color-accent);
|
|
font-weight: 500;
|
|
text-decoration: none;
|
|
padding: .45rem 0;
|
|
border-radius: 6px;
|
|
background: rgba(52,152,219,.06);
|
|
transition: background .15s ease;
|
|
}
|
|
|
|
.user-card-link:hover {
|
|
background: rgba(52,152,219,.12);
|
|
}
|
|
|
|
.btn-login {
|
|
display: block;
|
|
padding: .55rem 0;
|
|
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-login:hover {
|
|
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;
|
|
}
|
|
|
|
/* --- Announcement Bar --- */
|
|
.announcement-bar {
|
|
max-width: 900px;
|
|
margin: 0 auto;
|
|
padding: 0 16px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 6px;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.announcement-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
padding: 10px 16px;
|
|
border-radius: 8px;
|
|
font-size: 14px;
|
|
border-left: 4px solid;
|
|
}
|
|
|
|
.announcement-title {
|
|
font-weight: 650;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.announcement-content {
|
|
color: #374151;
|
|
flex: 1;
|
|
}
|
|
|
|
.announcement-info {
|
|
background: #dbeafe;
|
|
border-color: #3b82f6;
|
|
}
|
|
.announcement-info .announcement-title { color: #1d4ed8; }
|
|
|
|
.announcement-success {
|
|
background: #dcfce7;
|
|
border-color: #22c55e;
|
|
}
|
|
.announcement-success .announcement-title { color: #15803d; }
|
|
|
|
.announcement-warning {
|
|
background: #fef3c7;
|
|
border-color: #f59e0b;
|
|
}
|
|
.announcement-warning .announcement-title { color: #b45309; }
|
|
|
|
.announcement-error {
|
|
background: #fee2e2;
|
|
border-color: #ef4444;
|
|
}
|
|
.announcement-error .announcement-title { color: #dc2626; }
|
|
|
|
/* ---------- Responsive ---------- */
|
|
@media (max-width: 960px) {
|
|
.home-grid {
|
|
grid-template-columns: 1fr 280px;
|
|
gap: 1.5rem;
|
|
}
|
|
|
|
.hero-title {
|
|
font-size: 2.6rem;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.hero-banner {
|
|
padding: 2.5rem 1.25rem 2.25rem;
|
|
}
|
|
|
|
.hero-title {
|
|
font-size: 2.2rem;
|
|
}
|
|
|
|
.hero-tagline {
|
|
font-size: 1rem;
|
|
}
|
|
|
|
.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;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
.hero-banner {
|
|
padding: 2rem 1rem 1.75rem;
|
|
}
|
|
|
|
.hero-title {
|
|
font-size: 1.8rem;
|
|
}
|
|
|
|
.hero-welcome {
|
|
font-size: .85rem;
|
|
}
|
|
|
|
.feed-title {
|
|
font-size: 1.15rem;
|
|
}
|
|
|
|
.home-main {
|
|
padding: 1rem 12px 1.5rem;
|
|
}
|
|
}
|