feat: enhance demo components with consistent styling and info boxes

- Add standardized header and info box components to all demo files
- Improve visual consistency with theme colors and spacing
- Add max-height and overflow-y for better content containment
- Update package.json build script with --force flag
- Add .gitignore entries for REFACTORING files
- Fix table formatting in audio-intro.md
This commit is contained in:
sanbuphy
2026-02-14 12:14:07 +08:00
parent cd2ce9e661
commit ebe2bf6109
70 changed files with 12307 additions and 10445 deletions
@@ -1,8 +1,9 @@
<template>
<div class="architecture-comparison-demo">
<div class="demo-header">
<h4>🏗 架构演进对比</h4>
<p>四个时代的核心架构特征对比</p>
<span class="icon">🏗</span>
<span class="title">架构演进对比</span>
<span class="subtitle">四个时代的核心架构特征</span>
</div>
<div class="comparison-grid">
@@ -50,6 +51,11 @@
</div>
</div>
</div>
<div class="info-box">
<span class="icon">💡</span>
<strong>核心思想:</strong>架构演进是为了解决上一个时代的痛点,但也带来了新的复杂度
</div>
</div>
</template>
@@ -108,24 +114,35 @@ const currentEra = computed(() => {
border: 1px solid var(--vp-c-divider);
border-radius: 8px;
background: var(--vp-c-bg-soft);
padding: 1.5rem;
padding: 1rem;
margin: 1rem 0;
max-height: 600px;
overflow-y: auto;
}
.demo-header {
margin-bottom: 1.5rem;
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 1rem;
padding-bottom: 0.75rem;
border-bottom: 1px solid var(--vp-c-divider);
}
.demo-header h4 {
margin: 0 0 0.5rem 0;
font-size: 1.1rem;
.demo-header .icon {
font-size: 1.25rem;
}
.demo-header .title {
font-weight: bold;
font-size: 1rem;
color: var(--vp-c-text-1);
}
.demo-header p {
margin: 0;
font-size: 0.9rem;
.demo-header .subtitle {
color: var(--vp-c-text-2);
font-size: 0.85rem;
margin-left: 0.5rem;
}
.comparison-grid {
@@ -152,8 +169,7 @@ const currentEra = computed(() => {
.era-card.active {
border-color: var(--vp-c-brand);
background: rgba(102, 126, 234, 0.1);
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
background: var(--vp-c-brand-soft);
}
.era-icon {
@@ -271,6 +287,25 @@ const currentEra = computed(() => {
color: var(--vp-c-text-2);
}
.info-box {
background: var(--vp-c-bg-alt);
padding: 0.75rem;
border-radius: 6px;
font-size: 0.85rem;
color: var(--vp-c-text-2);
margin-top: 0.75rem;
display: flex;
gap: 0.25rem;
}
.info-box .icon {
flex-shrink: 0;
}
.info-box strong {
color: var(--vp-c-text-1);
}
@media (max-width: 768px) {
.comparison-grid {
grid-template-columns: repeat(2, 1fr);
@@ -1,8 +1,9 @@
<template>
<div class="container-docker-demo">
<div class="demo-header">
<h4>🐳 Docker 容器化演示</h4>
<p>理解容器如何让应用"一次打包,到处运行"</p>
<span class="icon">🐳</span>
<span class="title">Docker 容器化演示</span>
<span class="subtitle">理解容器如何让应用"一次打包,到处运行"</span>
</div>
<div class="docker-visualization">
@@ -46,6 +47,11 @@
<div class="benefit-desc">{{ benefit.desc }}</div>
</div>
</div>
<div class="info-box">
<span class="icon">💡</span>
<strong>核心思想</strong>容器化让应用"一次构建,到处运行"解决了环境一致性和快速部署的问题
</div>
</div>
</template>
@@ -69,24 +75,35 @@ const benefits = [
border: 1px solid var(--vp-c-divider);
border-radius: 8px;
background: var(--vp-c-bg-soft);
padding: 1.5rem;
padding: 1rem;
margin: 1rem 0;
max-height: 600px;
overflow-y: auto;
}
.demo-header {
margin-bottom: 1.5rem;
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 1rem;
padding-bottom: 0.75rem;
border-bottom: 1px solid var(--vp-c-divider);
}
.demo-header h4 {
margin: 0 0 0.5rem 0;
font-size: 1.1rem;
.demo-header .icon {
font-size: 1.25rem;
}
.demo-header .title {
font-weight: bold;
font-size: 1rem;
color: var(--vp-c-text-1);
}
.demo-header p {
margin: 0;
font-size: 0.9rem;
.demo-header .subtitle {
color: var(--vp-c-text-2);
font-size: 0.85rem;
margin-left: 0.5rem;
}
.docker-visualization {
@@ -268,4 +285,23 @@ const benefits = [
grid-template-columns: 1fr;
}
}
.info-box {
background: var(--vp-c-bg-alt);
padding: 0.75rem;
border-radius: 6px;
font-size: 0.85rem;
color: var(--vp-c-text-2);
margin-top: 1rem;
display: flex;
gap: 0.25rem;
}
.info-box .icon {
flex-shrink: 0;
}
.info-box strong {
color: var(--vp-c-text-1);
}
</style>
@@ -1,8 +1,9 @@
<template>
<div class="evolution-intro-demo">
<div class="intro-header">
<h3>后端架构进化之旅</h3>
<p>用一个餐厅的成长历程理解后端架构的 30 年变迁</p>
<div class="demo-header">
<span class="icon">🏗</span>
<span class="title">后端架构进化之旅</span>
<span class="subtitle">用餐厅比喻理解 30 年架构演进</span>
</div>
<div class="timeline-cards">
@@ -20,7 +21,7 @@
</div>
</div>
<div class="stage-detail">
<div class="stage-detail" v-if="currentStage !== null">
<Transition name="fade" mode="out-in">
<div :key="currentStage" class="detail-panel">
<div class="detail-header">
@@ -46,6 +47,11 @@
</div>
</Transition>
</div>
<div class="info-box">
<span class="icon">💡</span>
<strong>核心思想</strong>架构演进是为了解决上一个时代的痛点但也带来了新的复杂度没有最好的架构只有最适合的架构
</div>
</div>
</template>
@@ -116,84 +122,95 @@ const stages = [
<style scoped>
.evolution-intro-demo {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 16px;
padding: 32px;
color: #fff;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
border: 1px solid var(--vp-c-divider);
border-radius: 8px;
background: var(--vp-c-bg-soft);
padding: 1rem;
margin: 1rem 0;
max-height: 600px;
overflow-y: auto;
}
.intro-header {
text-align: center;
margin-bottom: 32px;
.demo-header {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 1rem;
padding-bottom: 0.75rem;
border-bottom: 1px solid var(--vp-c-divider);
}
.intro-header h3 {
font-size: 24px;
font-weight: 700;
margin: 0 0 8px 0;
.demo-header .icon {
font-size: 1.25rem;
}
.intro-header p {
font-size: 14px;
opacity: 0.9;
margin: 0;
.demo-header .title {
font-weight: bold;
font-size: 1rem;
color: var(--vp-c-text-1);
}
.demo-header .subtitle {
color: var(--vp-c-text-2);
font-size: 0.85rem;
margin-left: 0.5rem;
}
.timeline-cards {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
margin-bottom: 24px;
gap: 0.75rem;
margin-bottom: 1rem;
}
.stage-card {
background: rgba(255, 255, 255, 0.1);
background: var(--vp-c-bg);
border: 2px solid transparent;
border-radius: 12px;
padding: 16px 12px;
border-radius: 8px;
padding: 0.75rem 0.5rem;
text-align: center;
cursor: pointer;
transition: all 0.3s ease;
transition: all 0.3s;
}
.stage-card:hover {
background: rgba(255, 255, 255, 0.15);
border-color: var(--vp-c-brand);
transform: translateY(-2px);
}
.stage-card.active {
background: rgba(255, 255, 255, 0.25);
border-color: rgba(255, 255, 255, 0.5);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
border-color: var(--vp-c-brand);
background: var(--vp-c-brand-soft);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.stage-era {
font-size: 11px;
opacity: 0.7;
margin-bottom: 4px;
font-size: 0.7rem;
color: var(--vp-c-text-3);
margin-bottom: 0.25rem;
}
.stage-icon {
font-size: 32px;
margin-bottom: 8px;
font-size: 1.5rem;
margin-bottom: 0.5rem;
}
.stage-name {
font-size: 14px;
font-size: 0.85rem;
font-weight: 600;
margin-bottom: 2px;
color: var(--vp-c-text-1);
margin-bottom: 0.25rem;
}
.stage-arch {
font-size: 11px;
opacity: 0.7;
font-size: 0.7rem;
color: var(--vp-c-text-3);
}
.stage-detail {
background: rgba(0, 0, 0, 0.2);
border-radius: 12px;
padding: 24px;
background: var(--vp-c-bg);
border-radius: 8px;
padding: 1rem;
}
.detail-panel {
@@ -208,56 +225,76 @@ const stages = [
.detail-header {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 20px;
padding-bottom: 16px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
gap: 0.75rem;
margin-bottom: 1rem;
padding-bottom: 0.75rem;
border-bottom: 1px solid var(--vp-c-divider);
}
.detail-icon {
font-size: 32px;
font-size: 1.5rem;
}
.detail-header h4 {
font-size: 20px;
font-size: 1rem;
font-weight: 600;
margin: 0;
color: var(--vp-c-text-1);
}
.detail-content {
display: grid;
gap: 16px;
gap: 0.75rem;
}
.detail-section h5 {
font-size: 14px;
font-size: 0.85rem;
font-weight: 600;
margin: 0 0 8px 0;
color: #ffd700;
margin: 0 0 0.5rem 0;
color: var(--vp-c-brand);
}
.detail-section p {
font-size: 13px;
font-size: 0.8rem;
line-height: 1.6;
margin: 0;
opacity: 0.9;
margin: 0 0 0.5rem 0;
color: var(--vp-c-text-2);
}
.detail-section ul {
margin: 0;
padding-left: 18px;
padding-left: 1rem;
}
.detail-section li {
font-size: 13px;
font-size: 0.8rem;
line-height: 1.6;
margin-bottom: 4px;
opacity: 0.9;
margin-bottom: 0.25rem;
color: var(--vp-c-text-2);
}
.info-box {
background: var(--vp-c-bg-alt);
padding: 0.75rem;
border-radius: 6px;
font-size: 0.85rem;
color: var(--vp-c-text-2);
margin-top: 1rem;
display: flex;
gap: 0.25rem;
}
.info-box .icon {
flex-shrink: 0;
}
.info-box strong {
color: var(--vp-c-text-1);
}
.fade-enter-active,
.fade-leave-active {
transition: all 0.4s ease;
transition: all 0.3s ease;
}
.fade-enter-from {
@@ -275,8 +312,8 @@ const stages = [
grid-template-columns: repeat(2, 1fr);
}
.stage-detail {
padding: 16px;
.detail-content {
grid-template-columns: 1fr;
}
}
</style>
@@ -1,8 +1,9 @@
<template>
<div class="monolith-demo">
<div class="demo-header">
<h4>🏢 单体架构演示</h4>
<p>观察单体应用如何处理请求以及模块间的依赖关系</p>
<span class="icon">🏢</span>
<span class="title">单体架构演示</span>
<span class="subtitle">观察单体应用如何处理请求</span>
</div>
<div class="monolith-diagram">
@@ -47,13 +48,9 @@
<button class="control-btn" @click="reset">重置</button>
</div>
<div class="demo-explanation">
<h5>💡 单体架构的特点</h5>
<ul>
<li><strong>共享进程空间</strong>所有模块在同一个进程中运行内存共享</li>
<li><strong>数据库耦合</strong>所有模块共享同一个数据库Schema变更影响全局</li>
<li><strong>级联故障</strong>一个模块崩溃可能导致整个进程挂掉雪崩效应</li>
</ul>
<div class="info-box">
<span class="icon">💡</span>
<strong>核心思想</strong>所有模块在同一个进程中运行内存共享但一个模块崩溃可能导致整个进程挂掉雪崩效应
</div>
</div>
</template>
@@ -136,24 +133,35 @@ const reset = () => {
border: 1px solid var(--vp-c-divider);
border-radius: 8px;
background: var(--vp-c-bg-soft);
padding: 1.5rem;
padding: 1rem;
margin: 1rem 0;
max-height: 600px;
overflow-y: auto;
}
.demo-header {
margin-bottom: 1.5rem;
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 1rem;
padding-bottom: 0.75rem;
border-bottom: 1px solid var(--vp-c-divider);
}
.demo-header h4 {
margin: 0 0 0.5rem 0;
font-size: 1.1rem;
.demo-header .icon {
font-size: 1.25rem;
}
.demo-header .title {
font-weight: bold;
font-size: 1rem;
color: var(--vp-c-text-1);
}
.demo-header p {
margin: 0;
font-size: 0.9rem;
.demo-header .subtitle {
color: var(--vp-c-text-2);
font-size: 0.85rem;
margin-left: 0.5rem;
}
.monolith-diagram {
@@ -378,4 +386,23 @@ const reset = () => {
flex-wrap: wrap;
}
}
.info-box {
background: var(--vp-c-bg-alt);
padding: 0.75rem;
border-radius: 6px;
font-size: 0.85rem;
color: var(--vp-c-text-2);
margin-top: 1rem;
display: flex;
gap: 0.25rem;
}
.info-box .icon {
flex-shrink: 0;
}
.info-box strong {
color: var(--vp-c-text-1);
}
</style>
@@ -1,8 +1,9 @@
<template>
<div class="physical-server-demo">
<div class="demo-header">
<h4>🖥 物理服务器时代演示</h4>
<p>点击"发送请求"观察早期 CGI 服务器的处理瓶颈</p>
<span class="icon">🖥</span>
<span class="title">物理服务器时代演示</span>
<span class="subtitle">观察早期 CGI 服务器的处理瓶颈</span>
</div>
<div class="demo-stage">
@@ -85,27 +86,9 @@
</div>
</div>
<div class="demo-explanation">
<h5>💡 早期的痛点在哪里</h5>
<ul>
<li>
<strong>进程启动开销</strong>每个请求都要启动新的 CGI
进程就像每来一个客人都要重新搭一个厨房
</li>
<li>
<strong>资源无法复用</strong>数据库连接每次都要重新建立CPU
频繁在进程间切换
</li>
<li>
<strong>扩展困难</strong>只能买更强的单机垂直扩展无法通过增加机器分担压力
</li>
</ul>
<p class="demo-conclusion">
这就是<strong>物理服务器 + CGI</strong>时代的核心问题<span
class="highlight"
>进程级隔离带来了稳定性但也带来了巨大的性能开销</span
>
</p>
<div class="info-box">
<span class="icon">💡</span>
<strong>核心思想</strong>进程级隔离带来了稳定性但也带来了巨大的性能开销
</div>
</div>
</template>
@@ -192,24 +175,35 @@ const sendRequest = async () => {
border: 1px solid var(--vp-c-divider);
border-radius: 8px;
background: var(--vp-c-bg-soft);
padding: 1.5rem;
padding: 1rem;
margin: 1rem 0;
max-height: 600px;
overflow-y: auto;
}
.demo-header {
margin-bottom: 1.5rem;
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 1rem;
padding-bottom: 0.75rem;
border-bottom: 1px solid var(--vp-c-divider);
}
.demo-header h4 {
margin: 0 0 0.5rem 0;
font-size: 1.1rem;
.demo-header .icon {
font-size: 1.25rem;
}
.demo-header .title {
font-weight: bold;
font-size: 1rem;
color: var(--vp-c-text-1);
}
.demo-header p {
margin: 0;
font-size: 0.9rem;
.demo-header .subtitle {
color: var(--vp-c-text-2);
font-size: 0.85rem;
margin-left: 0.5rem;
}
.demo-stage {
@@ -472,4 +466,23 @@ const sendRequest = async () => {
height: 3px;
}
}
.info-box {
background: var(--vp-c-bg-alt);
padding: 0.75rem;
border-radius: 6px;
font-size: 0.85rem;
color: var(--vp-c-text-2);
margin-top: 1rem;
display: flex;
gap: 0.25rem;
}
.info-box .icon {
flex-shrink: 0;
}
.info-box strong {
color: var(--vp-c-text-1);
}
</style>
@@ -1,8 +1,9 @@
<template>
<div class="tech-stack-timeline-demo">
<div class="demo-header">
<h4>📚 技术栈演进时间线</h4>
<p>每个时代的主流技术栈</p>
<span class="icon">📚</span>
<span class="title">技术栈演进时间线</span>
<span class="subtitle">每个时代的主流技术栈</span>
</div>
<div class="timeline">
@@ -106,6 +107,8 @@ const eras = [
background: var(--vp-c-bg-soft);
padding: 1rem;
margin: 1rem 0;
max-height: 600px;
overflow-y: auto;
}
.demo-header {
@@ -247,4 +250,23 @@ const eras = [
grid-template-columns: 1fr;
}
}
.info-box {
background: var(--vp-c-bg-alt);
padding: 0.75rem;
border-radius: 6px;
font-size: 0.85rem;
color: var(--vp-c-text-2);
margin-top: 1rem;
display: flex;
gap: 0.25rem;
}
.info-box .icon {
flex-shrink: 0;
}
.info-box strong {
color: var(--vp-c-text-1);
}
</style>