2026-01-15 20:10:19 +08:00
|
|
|
<template>
|
2026-02-24 08:34:53 +08:00
|
|
|
<div class="dns-lookup-demo custom-demo-base">
|
|
|
|
|
<div class="demo-label">DNS 解析 ── 查地址簿找坐标</div>
|
|
|
|
|
<div class="demo-panel">
|
|
|
|
|
|
|
|
|
|
<div class="lookup-flow">
|
|
|
|
|
<!-- 浏览器 -->
|
|
|
|
|
<div class="flow-node browser-node" :class="{ active: true }">
|
|
|
|
|
<div class="node-icon">📱</div>
|
|
|
|
|
<div class="node-title">浏览器</div>
|
|
|
|
|
<div class="node-desc" v-if="step === 0">要去 www.google.com</div>
|
|
|
|
|
<div class="node-desc" v-if="step === 1">问 114查号台...</div>
|
|
|
|
|
<div class="node-desc success" v-if="step === 2">收到: 142... 发车!</div>
|
2026-02-18 17:38:10 +08:00
|
|
|
</div>
|
2026-01-15 20:10:19 +08:00
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
<div class="flow-path-wrapper">
|
|
|
|
|
<div class="flow-path" :class="{ active: step >= 0 }">
|
|
|
|
|
<span class="path-label">询问坐标</span>
|
|
|
|
|
<div class="moving-dot" v-if="step === 1"></div>
|
2026-02-18 17:38:10 +08:00
|
|
|
</div>
|
2026-02-24 08:34:53 +08:00
|
|
|
<div class="flow-path reverse" :class="{ active: step === 2 }">
|
|
|
|
|
<span class="path-label">返回 IP</span>
|
|
|
|
|
<div class="moving-dot reverse" v-if="step === 2"></div>
|
2026-02-18 17:38:10 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-02-24 08:34:53 +08:00
|
|
|
|
|
|
|
|
<!-- 查号台 -->
|
|
|
|
|
<div class="flow-node dns-node" :class="{ active: step >= 1, flash: step === 1 }">
|
|
|
|
|
<div class="node-icon">📞</div>
|
|
|
|
|
<div class="node-title">114查号台 (DNS)</div>
|
|
|
|
|
<div class="node-desc" v-if="step === 0">待命</div>
|
|
|
|
|
<div class="node-desc" v-if="step === 1">正在翻地址簿...</div>
|
|
|
|
|
<div class="node-desc success" v-if="step === 2">找到啦: 142.250.80.46</div>
|
2026-01-15 20:10:19 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
<div class="action-bar">
|
|
|
|
|
<button class="action-btn" @click="runDemo" :disabled="isRunning">
|
|
|
|
|
{{ isRunning ? '查询中...' : (step === 2 ? '重新查询' : '开始 DNS 查询') }}
|
|
|
|
|
</button>
|
2026-01-15 20:10:19 +08:00
|
|
|
</div>
|
2026-02-24 08:34:53 +08:00
|
|
|
|
2026-01-15 20:10:19 +08:00
|
|
|
</div>
|
2026-02-24 08:34:53 +08:00
|
|
|
<div class="demo-status">{{ statusText }}</div>
|
2026-01-15 20:10:19 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-02-24 08:34:53 +08:00
|
|
|
import { ref, computed } from 'vue'
|
|
|
|
|
|
|
|
|
|
const step = ref(0)
|
|
|
|
|
const isRunning = ref(false)
|
|
|
|
|
const statusList = [
|
|
|
|
|
'点击按钮,告诉浏览器你不知道 Google 服务器在哪',
|
|
|
|
|
'浏览器向营运商查号台 (DNS) 请求数字坐标...',
|
|
|
|
|
'拿到具体的 IP 地址,准备开始发车通信!'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
const statusText = computed(() => statusList[step.value])
|
|
|
|
|
|
|
|
|
|
const runDemo = () => {
|
|
|
|
|
if (isRunning.value) return
|
|
|
|
|
step.value = 0
|
|
|
|
|
isRunning.value = true
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
step.value = 1
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
step.value = 2
|
|
|
|
|
isRunning.value = false
|
|
|
|
|
}, 1500)
|
|
|
|
|
}, 300)
|
|
|
|
|
}
|
2026-01-15 20:10:19 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2026-02-24 08:34:53 +08:00
|
|
|
.custom-demo-base {
|
2026-01-15 20:10:19 +08:00
|
|
|
border: 1px solid var(--vp-c-divider);
|
2026-02-24 08:34:53 +08:00
|
|
|
border-radius: 8px;
|
2026-01-18 10:24:35 +08:00
|
|
|
background: var(--vp-c-bg-soft);
|
2026-02-24 08:34:53 +08:00
|
|
|
padding: 1rem 1.2rem;
|
|
|
|
|
margin: 1rem 0;
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.demo-label {
|
|
|
|
|
font-size: 0.78rem;
|
2026-01-18 10:24:35 +08:00
|
|
|
font-weight: bold;
|
2026-02-24 08:34:53 +08:00
|
|
|
color: var(--vp-c-text-2);
|
|
|
|
|
margin-bottom: 0.75rem;
|
|
|
|
|
letter-spacing: 0.2px;
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.demo-panel {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 2rem;
|
|
|
|
|
padding: 2rem;
|
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
background: var(--vp-c-bg);
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.demo-status {
|
|
|
|
|
margin-top: 0.75rem;
|
|
|
|
|
font-size: 0.85rem;
|
|
|
|
|
color: var(--vp-c-text-3);
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.lookup-flow {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
width: 100%;
|
|
|
|
|
max-width: 500px;
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.flow-node {
|
2026-01-15 20:10:19 +08:00
|
|
|
display: flex;
|
2026-01-18 10:24:35 +08:00
|
|
|
flex-direction: column;
|
2026-01-16 19:10:21 +08:00
|
|
|
align-items: center;
|
2026-02-24 08:34:53 +08:00
|
|
|
justify-content: center;
|
|
|
|
|
width: 140px;
|
|
|
|
|
height: 140px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
border: 4px solid var(--vp-c-divider);
|
|
|
|
|
background: var(--vp-c-bg-alt);
|
|
|
|
|
transition: all 0.3s;
|
|
|
|
|
z-index: 2;
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.flow-node.active {
|
|
|
|
|
border-color: var(--vp-c-brand-1, #3b82f6);
|
|
|
|
|
background: var(--vp-c-brand-soft, #eff6ff);
|
2026-01-18 10:24:35 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.flow-node.flash {
|
|
|
|
|
box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dns-node.active {
|
|
|
|
|
border-color: var(--vp-c-success-1, #10b981);
|
|
|
|
|
background: var(--vp-c-success-soft, #ecfdf5);
|
|
|
|
|
}
|
|
|
|
|
.dns-node.flash {
|
|
|
|
|
box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.node-icon {
|
|
|
|
|
font-size: 2.5rem;
|
2026-01-18 10:24:35 +08:00
|
|
|
margin-bottom: 0.5rem;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.node-title {
|
|
|
|
|
font-size: 0.9rem;
|
2026-01-18 10:24:35 +08:00
|
|
|
font-weight: bold;
|
2026-02-24 08:34:53 +08:00
|
|
|
color: var(--vp-c-text-1);
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.node-desc {
|
|
|
|
|
font-size: 0.75rem;
|
|
|
|
|
color: var(--vp-c-text-2);
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin-top: 0.2rem;
|
|
|
|
|
padding: 0 0.5rem;
|
|
|
|
|
min-height: 2.2em;
|
2026-01-18 10:24:35 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.node-desc.success {
|
|
|
|
|
color: var(--vp-c-success-1, #10b981);
|
|
|
|
|
font-weight: bold;
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.flow-path-wrapper {
|
|
|
|
|
flex: 1;
|
2026-01-16 19:10:21 +08:00
|
|
|
display: flex;
|
2026-01-18 10:24:35 +08:00
|
|
|
flex-direction: column;
|
2026-02-24 08:34:53 +08:00
|
|
|
justify-content: center;
|
|
|
|
|
position: relative;
|
|
|
|
|
height: 60px;
|
|
|
|
|
margin: 0 -20px;
|
|
|
|
|
z-index: 1;
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.flow-path {
|
|
|
|
|
height: 2px;
|
|
|
|
|
background: var(--vp-c-divider);
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
top: 50%;
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.flow-path.active {
|
|
|
|
|
background: var(--vp-c-brand-1, #3b82f6);
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.flow-path.reverse.active {
|
|
|
|
|
background: var(--vp-c-success-1, #10b981);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.path-label {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: -24px;
|
|
|
|
|
left: 50%;
|
|
|
|
|
transform: translateX(-50%);
|
|
|
|
|
font-size: 0.75rem;
|
|
|
|
|
color: var(--vp-c-text-2);
|
|
|
|
|
background: var(--vp-c-bg);
|
|
|
|
|
padding: 0 0.4rem;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.flow-path.reverse .path-label {
|
|
|
|
|
top: auto;
|
|
|
|
|
bottom: -24px;
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
2026-01-18 10:24:35 +08:00
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.moving-dot {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: -4px;
|
|
|
|
|
left: 0;
|
|
|
|
|
width: 10px;
|
|
|
|
|
height: 10px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
background: var(--vp-c-brand-1, #3b82f6);
|
|
|
|
|
animation: moveRight 1.5s linear infinite;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.moving-dot.reverse {
|
|
|
|
|
background: var(--vp-c-success-1, #10b981);
|
|
|
|
|
left: auto;
|
|
|
|
|
right: 0;
|
|
|
|
|
animation: moveLeft 1.5s linear infinite;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@keyframes moveRight {
|
|
|
|
|
0% { left: 0%; opacity: 0; }
|
|
|
|
|
10% { opacity: 1; }
|
|
|
|
|
90% { opacity: 1; }
|
|
|
|
|
100% { left: 100%; opacity: 0; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@keyframes moveLeft {
|
|
|
|
|
0% { right: 0%; opacity: 0; }
|
|
|
|
|
10% { opacity: 1; }
|
|
|
|
|
90% { opacity: 1; }
|
|
|
|
|
100% { right: 100%; opacity: 0; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.action-bar {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.action-btn {
|
|
|
|
|
background: var(--vp-c-brand-1, #3b82f6);
|
|
|
|
|
color: white;
|
|
|
|
|
border: none;
|
|
|
|
|
padding: 0.6rem 1.5rem;
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
cursor: pointer;
|
2026-01-15 20:10:19 +08:00
|
|
|
font-weight: bold;
|
2026-02-24 08:34:53 +08:00
|
|
|
transition: all 0.2s;
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.action-btn:hover:not(:disabled) {
|
|
|
|
|
background: var(--vp-c-brand-2, #2563eb);
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
.action-btn:disabled {
|
|
|
|
|
opacity: 0.6;
|
|
|
|
|
cursor: not-allowed;
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
@media (max-width: 640px) {
|
|
|
|
|
.lookup-flow {
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 2rem;
|
|
|
|
|
}
|
|
|
|
|
.flow-path-wrapper {
|
|
|
|
|
height: 40px;
|
|
|
|
|
width: 2px;
|
|
|
|
|
margin: -10px 0;
|
|
|
|
|
}
|
|
|
|
|
.flow-path {
|
|
|
|
|
width: 2px;
|
|
|
|
|
height: 100%;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 50%;
|
|
|
|
|
}
|
|
|
|
|
.path-label {
|
|
|
|
|
top: 50%;
|
|
|
|
|
left: 10px;
|
|
|
|
|
transform: translateY(-50%);
|
|
|
|
|
}
|
|
|
|
|
.flow-path.reverse .path-label {
|
|
|
|
|
left: auto;
|
|
|
|
|
right: 10px;
|
2026-01-18 12:21:49 +08:00
|
|
|
}
|
2026-02-24 08:34:53 +08:00
|
|
|
.moving-dot, .moving-dot.reverse {
|
|
|
|
|
display: none;
|
2026-01-18 12:21:49 +08:00
|
|
|
}
|
2026-01-15 20:10:19 +08:00
|
|
|
}
|
|
|
|
|
</style>
|