feat(docs): enhance interactive demos and improve documentation
- Add new interactive components for frontend routing, browser rendering pipeline, and database transactions - Improve existing demos with better visuals, explanations, and examples - Update documentation structure and content for better clarity - Add new utility scripts and update package.json with new commands - Fix formatting and alignment in documentation tables
This commit is contained in:
@@ -2,59 +2,55 @@
|
||||
<div class="mfa-security-demo">
|
||||
<div class="demo-header">
|
||||
<h4>MFA 多因素认证模拟</h4>
|
||||
<p class="demo-desc">体验 MFA 双因素认证流程</p>
|
||||
<p class="intro-text">体验 MFA 双因素认证流程</p>
|
||||
</div>
|
||||
|
||||
<div class="mfa-flow">
|
||||
<div class="auth-step" :class="{ active: step >= 1, completed: step > 1 }">
|
||||
<div class="step-icon">🔐</div>
|
||||
<div class="step-label">密码验证</div>
|
||||
</div>
|
||||
<div class="step-arrow">→</div>
|
||||
<div class="auth-step" :class="{ active: step >= 2, completed: step > 2 }">
|
||||
<div class="step-icon">📱</div>
|
||||
<div class="step-label">MFA 验证</div>
|
||||
</div>
|
||||
<div class="step-arrow">→</div>
|
||||
<div class="auth-step" :class="{ active: step >= 3 }">
|
||||
<div class="step-icon">✅</div>
|
||||
<div class="step-label">登录成功</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="auth-panel" v-if="step === 1">
|
||||
<h5>请输入密码</h5>
|
||||
<input type="password" v-model="password" placeholder="输入密码" @keyup.enter="verifyPassword" />
|
||||
<button @click="verifyPassword" :disabled="!password">验证密码</button>
|
||||
</div>
|
||||
|
||||
<div class="auth-panel" v-if="step === 2">
|
||||
<h5>MFA 验证</h5>
|
||||
<div class="totp-display">
|
||||
<span class="totp-code">{{ totpCode }}</span>
|
||||
<div class="totp-timer">
|
||||
<div class="timer-bar" :style="{ width: timerWidth + '%' }"></div>
|
||||
<div class="demo-content">
|
||||
<div class="mfa-flow">
|
||||
<div class="auth-step" :class="{ active: step >= 1, completed: step > 1 }">
|
||||
<div class="step-icon">🔐</div>
|
||||
<div class="step-label">密码验证</div>
|
||||
</div>
|
||||
<div class="step-arrow">→</div>
|
||||
<div class="auth-step" :class="{ active: step >= 2, completed: step > 2 }">
|
||||
<div class="step-icon">📱</div>
|
||||
<div class="step-label">MFA 验证</div>
|
||||
</div>
|
||||
<div class="step-arrow">→</div>
|
||||
<div class="auth-step" :class="{ active: step >= 3 }">
|
||||
<div class="step-icon">✅</div>
|
||||
<div class="step-label">登录成功</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" v-model="userCode" placeholder="输入6位验证码" maxlength="6" @keyup.enter="verifyMFA" />
|
||||
<button @click="verifyMFA" :disabled="userCode.length !== 6">验证</button>
|
||||
|
||||
<div class="auth-panel" v-if="step === 1">
|
||||
<h5>请输入密码</h5>
|
||||
<input type="password" v-model="password" placeholder="输入密码" @keyup.enter="verifyPassword" />
|
||||
<button @click="verifyPassword" :disabled="!password">验证密码</button>
|
||||
</div>
|
||||
|
||||
<div class="auth-panel" v-if="step === 2">
|
||||
<h5>MFA 验证</h5>
|
||||
<div class="totp-display">
|
||||
<span class="totp-code">{{ totpCode }}</span>
|
||||
<div class="totp-timer">
|
||||
<div class="timer-bar" :style="{ width: timerWidth + '%' }"></div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" v-model="userCode" placeholder="输入6位验证码" maxlength="6" @keyup.enter="verifyMFA" />
|
||||
<button @click="verifyMFA" :disabled="userCode.length !== 6">验证</button>
|
||||
</div>
|
||||
|
||||
<div class="success-message" v-if="step === 3">
|
||||
<div class="success-icon">🎉</div>
|
||||
<h5>登录成功!</h5>
|
||||
<p>已通过 MFA 双因素认证</p>
|
||||
<button @click="reset">重新演示</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="success-message" v-if="step === 3">
|
||||
<div class="success-icon">🎉</div>
|
||||
<h5>登录成功!</h5>
|
||||
<p>已通过 MFA 双因素认证</p>
|
||||
<button @click="reset">重新演示</button>
|
||||
</div>
|
||||
|
||||
<div class="security-tips">
|
||||
<h5>💡 MFA 安全提示</h5>
|
||||
<ul>
|
||||
<li>启用 MFA 可降低 99.9% 的账号被盗风险</li>
|
||||
<li>推荐使用 TOTP 应用(Google Authenticator、Microsoft Authenticator)</li>
|
||||
<li>硬件安全密钥(如 YubiKey)提供最高级别的安全性</li>
|
||||
<li>务必备份 MFA 恢复码,防止设备丢失无法登录</li>
|
||||
</ul>
|
||||
<div class="info-box">
|
||||
<strong>💡 MFA 安全价值:</strong>启用 MFA 可降低 99.9% 的账号被盗风险。即使密码泄露,攻击者没有你的 MFA 设备也无法登录。
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -118,35 +114,41 @@ onUnmounted(() => {
|
||||
|
||||
<style scoped>
|
||||
.mfa-security-demo {
|
||||
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
|
||||
border-radius: 16px;
|
||||
padding: 24px;
|
||||
color: white;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
background: var(--vp-c-bg-soft);
|
||||
border-radius: 8px;
|
||||
padding: 1.5rem;
|
||||
margin: 1rem 0;
|
||||
max-height: 600px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.demo-header {
|
||||
text-align: center;
|
||||
margin-bottom: 24px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.demo-header h4 {
|
||||
margin: 0 0 8px 0;
|
||||
font-size: 1.4rem;
|
||||
margin: 0 0 0.5rem 0;
|
||||
font-weight: 800;
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.demo-desc {
|
||||
.intro-text {
|
||||
margin: 0;
|
||||
opacity: 0.9;
|
||||
color: var(--vp-c-text-2);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.demo-content {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.mfa-flow {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 24px;
|
||||
gap: 1rem;
|
||||
margin-bottom: 1.5rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
@@ -154,24 +156,25 @@ onUnmounted(() => {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 16px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
backdrop-filter: blur(10px);
|
||||
border-radius: 12px;
|
||||
gap: 0.5rem;
|
||||
padding: 1rem;
|
||||
background: var(--vp-c-bg);
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-radius: 6px;
|
||||
opacity: 0.5;
|
||||
transition: all 0.3s ease;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.auth-step.active {
|
||||
opacity: 1;
|
||||
background: rgba(76, 175, 80, 0.2);
|
||||
border: 1px solid rgba(76, 175, 80, 0.5);
|
||||
background: var(--vp-c-brand-soft);
|
||||
border-color: var(--vp-c-brand);
|
||||
}
|
||||
|
||||
.auth-step.completed {
|
||||
opacity: 1;
|
||||
background: rgba(76, 175, 80, 0.3);
|
||||
background: rgba(var(--vp-c-brand-rgb), 0.1);
|
||||
border-color: var(--vp-c-brand);
|
||||
}
|
||||
|
||||
.step-icon {
|
||||
@@ -181,53 +184,56 @@ onUnmounted(() => {
|
||||
.step-label {
|
||||
font-size: 0.8rem;
|
||||
font-weight: 500;
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.step-arrow {
|
||||
font-size: 1.5rem;
|
||||
opacity: 0.6;
|
||||
color: var(--vp-c-text-3);
|
||||
}
|
||||
|
||||
.auth-panel {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
backdrop-filter: blur(10px);
|
||||
border-radius: 12px;
|
||||
padding: 24px;
|
||||
margin-bottom: 20px;
|
||||
background: var(--vp-c-bg);
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-radius: 8px;
|
||||
padding: 1.5rem;
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
|
||||
.auth-panel h5 {
|
||||
margin: 0 0 16px 0;
|
||||
margin: 0 0 1rem 0;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 700;
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.auth-panel input {
|
||||
width: 100%;
|
||||
padding: 12px 16px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
border-radius: 8px;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
color: white;
|
||||
padding: 0.75rem 1rem;
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-radius: 6px;
|
||||
background: var(--vp-c-bg-alt);
|
||||
color: var(--vp-c-text-1);
|
||||
font-size: 1rem;
|
||||
margin-bottom: 12px;
|
||||
margin-bottom: 0.75rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.auth-panel input::placeholder {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
color: var(--vp-c-text-3);
|
||||
}
|
||||
|
||||
.auth-panel button {
|
||||
width: 100%;
|
||||
padding: 12px 24px;
|
||||
padding: 0.75rem 1.5rem;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
|
||||
color: white;
|
||||
border-radius: 6px;
|
||||
background: var(--vp-c-brand);
|
||||
color: var(--vp-c-bg);
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.auth-panel button:disabled {
|
||||
@@ -237,101 +243,97 @@ onUnmounted(() => {
|
||||
|
||||
.auth-panel button:hover:not(:disabled) {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 20px rgba(76, 175, 80, 0.3);
|
||||
box-shadow: 0 4px 12px rgba(var(--vp-c-brand-rgb), 0.3);
|
||||
}
|
||||
|
||||
.totp-display {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
background: var(--vp-c-bg-alt);
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-radius: 6px;
|
||||
padding: 1rem;
|
||||
text-align: center;
|
||||
margin-bottom: 16px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.totp-code {
|
||||
display: block;
|
||||
font-size: 2.5rem;
|
||||
font-weight: 700;
|
||||
font-family: monospace;
|
||||
font-family: var(--vp-font-family-mono);
|
||||
letter-spacing: 0.2em;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 0.5rem;
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.totp-timer {
|
||||
height: 4px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
background: var(--vp-c-bg-soft);
|
||||
border-radius: 2px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.timer-bar {
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, #4caf50 0%, #8bc34a 100%);
|
||||
background: var(--vp-c-brand);
|
||||
transition: width 0.1s linear;
|
||||
}
|
||||
|
||||
.success-message {
|
||||
background: rgba(76, 175, 80, 0.2);
|
||||
border: 1px solid rgba(76, 175, 80, 0.5);
|
||||
border-radius: 12px;
|
||||
padding: 32px;
|
||||
background: var(--vp-c-brand-soft);
|
||||
border: 1px solid var(--vp-c-brand);
|
||||
border-radius: 8px;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
|
||||
.success-icon {
|
||||
font-size: 4rem;
|
||||
margin-bottom: 16px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.success-message h5 {
|
||||
margin: 0 0 8px 0;
|
||||
margin: 0 0 0.5rem 0;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.success-message p {
|
||||
margin: 0 0 20px 0;
|
||||
opacity: 0.8;
|
||||
margin: 0 0 1.25rem 0;
|
||||
color: var(--vp-c-text-2);
|
||||
}
|
||||
|
||||
.success-message button {
|
||||
padding: 12px 32px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
color: white;
|
||||
padding: 0.75rem 2rem;
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-radius: 6px;
|
||||
background: var(--vp-c-bg);
|
||||
color: var(--vp-c-text-1);
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
transition: all 0.2s ease;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.success-message button:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
background: var(--vp-c-bg-alt);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.security-tips {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
backdrop-filter: blur(10px);
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
.info-box {
|
||||
padding: 0.75rem;
|
||||
background: var(--vp-c-bg-alt);
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-left: 4px solid var(--vp-c-brand);
|
||||
border-radius: 6px;
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.6;
|
||||
color: var(--vp-c-text-2);
|
||||
}
|
||||
|
||||
.security-tips h5 {
|
||||
margin: 0 0 12px 0;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.security-tips ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.security-tips li {
|
||||
padding: 6px 0;
|
||||
font-size: 0.85rem;
|
||||
opacity: 0.9;
|
||||
.info-box strong {
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
@@ -342,9 +344,5 @@ onUnmounted(() => {
|
||||
.step-arrow {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.lifecycle-container {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user