Beautiful

This commit is contained in:
2026-06-16 13:11:46 +08:00
parent 45a6a58cd9
commit ea1ba5c933
+505 -92
View File
@@ -1,68 +1,132 @@
<template>
<div class="home">
<!-- Hero 区域 -->
<header class="hero">
<h1 class="hero-title">📚 算法分析与设计</h1>
<p class="hero-subtitle">教学辅助平台 从基础到进阶的算法学习之旅</p>
<p class="hero-desc">
涵盖六大核心章节复杂度分析分治法动态规划贪心算法回溯法分支限界法
</p>
<div class="hero-actions">
<router-link to="/chapter/ch1" class="btn-primary">开始学习 </router-link>
<a href="#chapters" class="btn-secondary">浏览章节</a>
<div class="hero-bg-decoration">
<div class="hero-blob blob-1"></div>
<div class="hero-blob blob-2"></div>
<div class="hero-blob blob-3"></div>
</div>
<div class="hero-content">
<div class="hero-badge">🎓 教学辅助平台</div>
<h1 class="hero-title">
<span class="hero-title-line">算法分析与设计</span>
</h1>
<p class="hero-subtitle">从基础到进阶的算法学习之旅</p>
<p class="hero-desc">
涵盖六大核心章节复杂度分析 · 分治法 · 动态规划 · 贪心算法 · 回溯法 · 分支限界法
</p>
<div class="hero-stats">
<div class="hero-stat">
<span class="stat-number">6</span>
<span class="stat-label">核心章节</span>
</div>
<div class="hero-stat">
<span class="stat-number">50+</span>
<span class="stat-label">算法示例</span>
</div>
<div class="hero-stat">
<span class="stat-number">C</span>
<span class="stat-label">&amp; Python</span>
</div>
</div>
<div class="hero-actions">
<router-link to="/chapter/ch1" class="btn-primary">
<span>开始学习</span>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg>
</router-link>
<a href="#chapters" class="btn-secondary">浏览章节</a>
</div>
</div>
</header>
<section id="chapters" class="chapters-grid">
<router-link
v-for="ch in chapters"
:key="ch.id"
:to="`/chapter/${ch.id}`"
class="chapter-card"
>
<div class="card-icon">{{ ch.icon }}</div>
<h3 class="card-title">{{ ch.title.split('—')[0].trim() }}</h3>
<p class="card-subtitle">{{ ch.subtitle }}</p>
<p class="card-desc">{{ ch.description }}</p>
<div class="card-topics">
<span v-for="topic in ch.topics.slice(0, 3)" :key="topic" class="topic-tag">
{{ topic }}
</span>
<span v-if="ch.topics.length > 3" class="topic-tag more">+{{ ch.topics.length - 3 }}</span>
</div>
<div class="card-footer">
<span class="explore-link">查看详情 </span>
</div>
</router-link>
<!-- 章节卡片网格 -->
<section id="chapters" class="chapters-section">
<div class="section-header">
<h2 class="section-title">📚 课程章节</h2>
<p class="section-desc">选择章节开始学习对应的算法知识</p>
</div>
<div class="chapters-grid">
<router-link
v-for="(ch, index) in chapters"
:key="ch.id"
:to="`/chapter/${ch.id}`"
class="chapter-card"
:style="{ '--delay': index * 0.08 + 's' }"
>
<div class="card-accent"></div>
<div class="card-icon">{{ ch.icon }}</div>
<h3 class="card-title">{{ ch.title.split('—')[0].trim() }}</h3>
<p class="card-subtitle">{{ ch.subtitle }}</p>
<p class="card-desc">{{ ch.description }}</p>
<div class="card-topics">
<span v-for="topic in ch.topics.slice(0, 3)" :key="topic" class="topic-tag">
{{ topic }}
</span>
<span v-if="ch.topics.length > 3" class="topic-tag more">+{{ ch.topics.length - 3 }}</span>
</div>
<div class="card-footer">
<span class="explore-link">
查看详情
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg>
</span>
</div>
</router-link>
</div>
</section>
<!-- 功能特性 -->
<section class="features-section">
<h2 class="section-title">平台功能</h2>
<div class="section-header">
<h2 class="section-title"> 平台功能</h2>
<p class="section-desc">全方位辅助算法学习与教学</p>
</div>
<div class="features-grid">
<div class="feature-card">
<div class="feature-icon">📖</div>
<div class="feature-icon-wrapper" style="--feature-color: #3b82f6">
<span class="feature-icon">📖</span>
</div>
<h3>代码阅览</h3>
<p>所有算法代码源文件在线展示支持语法高亮与一键复制</p>
</div>
<div class="feature-card">
<div class="feature-icon">📂</div>
<div class="feature-icon-wrapper" style="--feature-color: #8b5cf6">
<span class="feature-icon">📂</span>
</div>
<h3>分类导航</h3>
<p>按章节和子主题分类组织快速定位所需算法示例</p>
</div>
<div class="feature-card">
<div class="feature-icon">🔍</div>
<h3>知识点梳理</h3>
<p>每个章节的关键知识点和算法思想概览</p>
<div class="feature-icon-wrapper" style="--feature-color: #06b6d4">
<span class="feature-icon">🎯</span>
</div>
<h3>动态演示</h3>
<p>排序算法动画演示直观理解每一步操作过程</p>
</div>
<div class="feature-card">
<div class="feature-icon">💻</div>
<h3>C语言实现</h3>
<p>全部使用标准C语言实现适合教学演示与实验</p>
<div class="feature-icon-wrapper" style="--feature-color: #10b981">
<span class="feature-icon">💻</span>
</div>
<h3>双语言实现</h3>
<p>同时提供 C Python 实现满足不同教学需求</p>
</div>
</div>
</section>
<!-- 页脚 -->
<footer class="footer">
<p>算法分析与设计 教学辅助平台</p>
<div class="footer-wave">
<svg viewBox="0 0 1440 60" preserveAspectRatio="none">
<path d="M0,30 C360,60 720,0 1440,30 L1440,60 L0,60 Z" fill="var(--border-color)" opacity="0.3"/>
</svg>
</div>
<div class="footer-content">
<div class="footer-brand">
<span class="footer-logo">📚</span>
<span>算法分析与设计</span>
</div>
<p class="footer-sub">教学辅助平台 培养计算思维掌握算法精髓</p>
</div>
</footer>
</div>
</template>
@@ -72,39 +136,188 @@ import { chapters } from '../data/chapters.js'
</script>
<style scoped>
/* ============================
首页布局
============================ */
.home {
max-width: 1400px;
margin: 0 auto;
padding: 0 24px;
}
.hero {
/* ============================
Section Header 通用
============================ */
.section-header {
text-align: center;
padding: 60px 20px 40px;
margin-bottom: 40px;
}
.section-title {
font-size: 28px;
font-weight: 800;
color: var(--text-primary);
margin-bottom: 8px;
letter-spacing: -0.3px;
}
.section-desc {
font-size: 15px;
color: var(--text-tertiary);
}
/* ============================
Hero 区域
============================ */
.hero {
position: relative;
text-align: center;
padding: 80px 20px 60px;
overflow: hidden;
border-radius: 24px;
margin-top: 8px;
background:
radial-gradient(ellipse 80% 60% at 50% -10%, rgba(59, 130, 246, 0.08), transparent),
radial-gradient(ellipse 60% 50% at 20% 80%, rgba(139, 92, 246, 0.06), transparent),
radial-gradient(ellipse 50% 40% at 80% 70%, rgba(6, 182, 212, 0.05), transparent);
}
/* 背景装饰 blob */
.hero-bg-decoration {
position: absolute;
inset: 0;
pointer-events: none;
overflow: hidden;
}
.hero-blob {
position: absolute;
border-radius: 50%;
filter: blur(60px);
opacity: 0.3;
animation: blobFloat 8s ease-in-out infinite;
}
.blob-1 {
width: 300px;
height: 300px;
background: var(--primary-color);
top: -80px;
right: -60px;
animation-delay: 0s;
}
.blob-2 {
width: 200px;
height: 200px;
background: #8b5cf6;
bottom: -40px;
left: -40px;
animation-delay: -3s;
}
.blob-3 {
width: 150px;
height: 150px;
background: #06b6d4;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
animation-delay: -6s;
}
@keyframes blobFloat {
0%, 100% { transform: translate(0, 0) scale(1); }
33% { transform: translate(20px, -20px) scale(1.1); }
66% { transform: translate(-15px, 15px) scale(0.95); }
}
.hero-content {
position: relative;
z-index: 1;
}
.hero-badge {
display: inline-flex;
align-items: center;
gap: 6px;
font-size: 13px;
font-weight: 600;
color: var(--primary-color);
background: color-mix(in srgb, var(--primary-color) 10%, transparent);
border: 1px solid color-mix(in srgb, var(--primary-color) 20%, transparent);
padding: 6px 16px;
border-radius: 20px;
margin-bottom: 20px;
letter-spacing: 0.3px;
}
.hero-title {
font-size: 36px;
font-weight: 800;
background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
font-size: 48px;
font-weight: 900;
line-height: 1.15;
margin-bottom: 16px;
letter-spacing: -1px;
}
.hero-title-line {
background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 50%, #06b6d4 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 12px;
background-size: 200% 200%;
animation: gradientShift 4s ease-in-out infinite;
}
@keyframes gradientShift {
0%, 100% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
}
.hero-subtitle {
font-size: 18px;
font-size: 20px;
color: var(--text-secondary);
font-weight: 500;
margin-bottom: 8px;
}
.hero-desc {
font-size: 14px;
font-size: 15px;
color: var(--text-tertiary);
margin-bottom: 24px;
max-width: 600px;
margin: 0 auto 28px;
line-height: 1.6;
}
/* Hero 数据统计 */
.hero-stats {
display: flex;
justify-content: center;
gap: 40px;
margin-bottom: 32px;
}
.hero-stat {
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
}
.stat-number {
font-size: 28px;
font-weight: 800;
color: var(--text-primary);
letter-spacing: -0.5px;
}
.stat-label {
font-size: 13px;
color: var(--text-tertiary);
font-weight: 500;
}
/* 按钮 */
.hero-actions {
display: flex;
gap: 12px;
@@ -112,62 +325,118 @@ import { chapters } from '../data/chapters.js'
}
.btn-primary, .btn-secondary {
padding: 12px 28px;
border-radius: 8px;
display: inline-flex;
align-items: center;
gap: 8px;
padding: 14px 32px;
border-radius: 12px;
font-size: 15px;
font-weight: 600;
text-decoration: none;
transition: all 0.2s;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
cursor: pointer;
}
.btn-primary {
background: var(--primary-color);
background: linear-gradient(135deg, var(--primary-color), #6366f1);
color: white;
box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
}
.btn-primary:hover {
opacity: 0.9;
transform: translateY(-1px);
transform: translateY(-2px);
box-shadow: 0 8px 28px rgba(59, 130, 246, 0.45);
text-decoration: none;
}
.btn-primary:active {
transform: translateY(0);
}
.btn-secondary {
background: var(--hover-bg);
background: var(--card-bg);
color: var(--text-primary);
border: 1px solid var(--border-color);
border: 1.5px solid var(--border-color);
}
.btn-secondary:hover {
background: var(--active-bg);
background: var(--hover-bg);
border-color: var(--primary-color);
transform: translateY(-2px);
text-decoration: none;
}
/* ============================
章节卡片区域
============================ */
.chapters-section {
margin: 60px 0 20px;
}
.chapters-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
gap: 20px;
margin: 40px 0;
}
.chapter-card {
position: relative;
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 16px;
padding: 24px;
border-radius: 18px;
padding: 28px 24px 20px;
text-decoration: none;
color: inherit;
transition: all 0.3s ease;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
flex-direction: column;
overflow: hidden;
animation: cardFadeIn 0.6s ease-out backwards;
animation-delay: var(--delay, 0s);
}
@keyframes cardFadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 卡片顶部彩色装饰条 */
.card-accent {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
background: linear-gradient(90deg, var(--primary-color), #8b5cf6, #06b6d4);
opacity: 0;
transition: opacity 0.3s ease;
}
.chapter-card:hover .card-accent {
opacity: 1;
}
.chapter-card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 30px rgba(0,0,0,0.12);
border-color: var(--primary-color);
transform: translateY(-6px);
box-shadow: 0 12px 40px rgba(0,0,0,0.1);
border-color: transparent;
background: linear-gradient(135deg, var(--card-bg), color-mix(in srgb, var(--primary-color) 3%, var(--card-bg)));
}
.card-icon {
font-size: 40px;
margin-bottom: 12px;
font-size: 42px;
margin-bottom: 14px;
transition: transform 0.3s ease;
}
.chapter-card:hover .card-icon {
transform: scale(1.1) rotate(-5deg);
}
.card-title {
@@ -175,6 +444,7 @@ import { chapters } from '../data/chapters.js'
font-weight: 700;
color: var(--text-primary);
margin-bottom: 4px;
letter-spacing: -0.2px;
}
.card-subtitle {
@@ -187,8 +457,8 @@ import { chapters } from '../data/chapters.js'
.card-desc {
font-size: 13px;
color: var(--text-secondary);
line-height: 1.5;
margin-bottom: 14px;
line-height: 1.6;
margin-bottom: 16px;
flex: 1;
}
@@ -203,76 +473,219 @@ import { chapters } from '../data/chapters.js'
font-size: 11px;
background: var(--tag-bg);
color: var(--text-secondary);
padding: 3px 10px;
border-radius: 12px;
padding: 4px 10px;
border-radius: 20px;
font-weight: 500;
transition: all 0.2s;
}
.chapter-card:hover .topic-tag {
background: color-mix(in srgb, var(--primary-color) 8%, var(--tag-bg));
}
.topic-tag.more {
background: var(--active-bg);
color: var(--primary-color);
font-weight: 600;
}
.card-footer {
border-top: 1px solid var(--border-color);
padding-top: 12px;
padding-top: 14px;
margin-top: auto;
}
.explore-link {
display: inline-flex;
align-items: center;
gap: 6px;
font-size: 13px;
color: var(--primary-color);
font-weight: 600;
transition: gap 0.2s ease;
}
.section-title {
text-align: center;
font-size: 24px;
font-weight: 700;
margin-bottom: 24px;
color: var(--text-primary);
.chapter-card:hover .explore-link {
gap: 10px;
}
/* ============================
功能特性区域
============================ */
.features-section {
margin: 60px 0;
margin: 80px 0;
}
.features-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 16px;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
}
.feature-card {
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 12px;
padding: 24px;
border-radius: 16px;
padding: 32px 24px;
text-align: center;
transition: all 0.3s ease;
}
.feature-card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 30px rgba(0,0,0,0.08);
border-color: var(--feature-color, var(--border-color));
}
.feature-icon-wrapper {
display: inline-flex;
align-items: center;
justify-content: center;
width: 56px;
height: 56px;
border-radius: 16px;
background: color-mix(in srgb, var(--feature-color, var(--primary-color)) 10%, transparent);
margin-bottom: 16px;
transition: all 0.3s ease;
}
.feature-card:hover .feature-icon-wrapper {
background: color-mix(in srgb, var(--feature-color, var(--primary-color)) 18%, transparent);
transform: scale(1.05);
}
.feature-icon {
font-size: 32px;
margin-bottom: 12px;
font-size: 26px;
}
.feature-card h3 {
font-size: 16px;
font-weight: 600;
margin-bottom: 8px;
font-weight: 700;
margin-bottom: 10px;
color: var(--text-primary);
}
.feature-card p {
font-size: 13px;
color: var(--text-secondary);
line-height: 1.5;
line-height: 1.6;
}
/* ============================
页脚
============================ */
.footer {
position: relative;
margin-top: 60px;
padding-top: 40px;
text-align: center;
padding: 40px 0;
color: var(--text-tertiary);
font-size: 13px;
}
.footer-wave {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 60px;
overflow: hidden;
}
.footer-wave svg {
width: 100%;
height: 100%;
}
.footer-content {
padding: 32px 0 48px;
border-top: 1px solid var(--border-color);
margin-top: 40px;
}
.footer-brand {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
font-size: 16px;
font-weight: 700;
color: var(--text-primary);
margin-bottom: 8px;
}
.footer-logo {
font-size: 22px;
}
.footer-sub {
font-size: 13px;
color: var(--text-tertiary);
}
/* ============================
深色模式适配
============================ */
@media (prefers-color-scheme: dark) {
.hero {
background:
radial-gradient(ellipse 80% 60% at 50% -10%, rgba(59, 130, 246, 0.06), transparent),
radial-gradient(ellipse 60% 50% at 20% 80%, rgba(139, 92, 246, 0.04), transparent),
radial-gradient(ellipse 50% 40% at 80% 70%, rgba(6, 182, 212, 0.04), transparent);
}
.chapter-card:hover {
box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.btn-primary {
box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
}
.btn-primary:hover {
box-shadow: 0 8px 28px rgba(59, 130, 246, 0.35);
}
}
/* ============================
响应式
============================ */
@media (max-width: 768px) {
.hero {
padding: 48px 16px 40px;
border-radius: 16px;
}
.hero-title {
font-size: 32px;
}
.hero-subtitle {
font-size: 16px;
}
.hero-stats {
gap: 24px;
}
.stat-number {
font-size: 22px;
}
.hero-actions {
flex-direction: column;
align-items: center;
}
.chapters-grid {
grid-template-columns: 1fr;
}
.features-grid {
grid-template-columns: 1fr 1fr;
}
}
@media (max-width: 480px) {
.features-grid {
grid-template-columns: 1fr;
}
}
</style>