2026-02-05 01:33:28 +08:00
|
|
|
|
<!--
|
2026-02-06 03:34:50 +08:00
|
|
|
|
SliceRequestDemo.vue - 搬家快递大作战
|
|
|
|
|
|
用"搬家打包"的比喻来解释 HTTP 请求优化(切图 vs 雪碧图)
|
2026-02-05 01:33:28 +08:00
|
|
|
|
-->
|
|
|
|
|
|
<template>
|
2026-02-06 03:34:50 +08:00
|
|
|
|
<div class="moving-game">
|
|
|
|
|
|
<!-- 故事引入 -->
|
|
|
|
|
|
<div class="story-box">
|
|
|
|
|
|
<div class="story-emoji">📦🚚🏠</div>
|
|
|
|
|
|
<h4 class="story-title">小明搬家记</h4>
|
|
|
|
|
|
<p class="story-text">
|
|
|
|
|
|
小明要搬 6 箱书到新房子。有两种搬家方式:<br>
|
|
|
|
|
|
<strong>A 方案:一箱一箱搬</strong>(切图模式) vs <strong>B 方案:一次性打包运走</strong>(雪碧图模式)<br>
|
|
|
|
|
|
看看哪种更省时间?
|
|
|
|
|
|
</p>
|
2026-02-05 01:33:28 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
<!-- 模式选择 -->
|
|
|
|
|
|
<div class="mode-selector">
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="mode-card"
|
|
|
|
|
|
:class="{ active: mode === 'separate' }"
|
|
|
|
|
|
@click="mode = 'separate'"
|
2026-02-05 01:33:28 +08:00
|
|
|
|
>
|
2026-02-06 03:34:50 +08:00
|
|
|
|
<div class="mode-icon">🛵</div>
|
|
|
|
|
|
<div class="mode-name">A 方案:一箱一趟</div>
|
|
|
|
|
|
<div class="mode-desc">小面包车,一次拉一箱</div>
|
|
|
|
|
|
<div class="mode-detail">需要 6 趟运输</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="vs-divider">VS</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="mode-card"
|
|
|
|
|
|
:class="{ active: mode === 'packed' }"
|
|
|
|
|
|
@click="mode = 'packed'"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="mode-icon">🚚</div>
|
|
|
|
|
|
<div class="mode-name">B 方案:打包一车拉</div>
|
|
|
|
|
|
<div class="mode-desc">大卡车,6箱一次运走</div>
|
|
|
|
|
|
<div class="mode-detail">只需 1 趟运输</div>
|
|
|
|
|
|
</div>
|
2026-02-05 01:33:28 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
<!-- 动画演示区 -->
|
|
|
|
|
|
<div class="animation-area">
|
|
|
|
|
|
<!-- 起点 -->
|
|
|
|
|
|
<div class="location start">
|
|
|
|
|
|
<div class="location-icon">🏠</div>
|
|
|
|
|
|
<div class="location-label">旧家</div>
|
|
|
|
|
|
<div class="boxes-remaining">
|
|
|
|
|
|
剩余箱子: <span class="count">{{ remainingBoxes }}</span>
|
2026-02-05 01:33:28 +08:00
|
|
|
|
</div>
|
2026-02-06 03:34:50 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 道路 -->
|
|
|
|
|
|
<div class="road">
|
|
|
|
|
|
<div class="road-line"></div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 运输车辆 -->
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-for="vehicle in vehicles"
|
|
|
|
|
|
:key="vehicle.id"
|
|
|
|
|
|
class="vehicle"
|
|
|
|
|
|
:class="{ 'moving': vehicle.isMoving }"
|
|
|
|
|
|
:style="{ left: vehicle.position + '%' }"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="vehicle-body">
|
|
|
|
|
|
{{ mode === 'separate' ? '🛵' : '🚚' }}
|
2026-02-05 01:33:28 +08:00
|
|
|
|
</div>
|
2026-02-06 03:34:50 +08:00
|
|
|
|
<div class="vehicle-cargo" v-if="vehicle.cargo > 0">
|
|
|
|
|
|
{{ mode === 'separate' ? '📦' : '📦×' + vehicle.cargo }}
|
2026-02-05 01:33:28 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
<!-- 终点 -->
|
|
|
|
|
|
<div class="location end">
|
|
|
|
|
|
<div class="location-icon">🏡</div>
|
|
|
|
|
|
<div class="location-label">新家</div>
|
|
|
|
|
|
<div class="boxes-delivered">
|
|
|
|
|
|
已送达: <span class="count">{{ deliveredBoxes }}</span>/6
|
2026-02-05 01:33:28 +08:00
|
|
|
|
</div>
|
2026-02-06 03:34:50 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-02-05 01:33:28 +08:00
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
<!-- 统计面板 -->
|
|
|
|
|
|
<div class="stats-panel">
|
|
|
|
|
|
<div class="stat-item">
|
|
|
|
|
|
<div class="stat-label">运输趟数</div>
|
|
|
|
|
|
<div class="stat-value" :class="{ 'good': trips <= 2, 'bad': trips > 2 }">
|
|
|
|
|
|
{{ trips }} 趟
|
2026-02-05 01:33:28 +08:00
|
|
|
|
</div>
|
2026-02-06 03:34:50 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="stat-item">
|
|
|
|
|
|
<div class="stat-label">总耗时</div>
|
|
|
|
|
|
<div class="stat-value">{{ totalTime.toFixed(1) }} 秒</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="stat-item">
|
|
|
|
|
|
<div class="stat-label">效率评分</div>
|
|
|
|
|
|
<div class="stat-value" :class="efficiencyClass">
|
|
|
|
|
|
{{ efficiency }}
|
2026-02-05 01:33:28 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
<!-- 控制按钮 -->
|
|
|
|
|
|
<div class="controls">
|
|
|
|
|
|
<button
|
|
|
|
|
|
class="btn btn-primary"
|
|
|
|
|
|
@click="startSimulation"
|
|
|
|
|
|
:disabled="isRunning"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ isRunning ? '运输中...' : '开始搬家' }}
|
2026-02-05 01:33:28 +08:00
|
|
|
|
</button>
|
2026-02-06 03:34:50 +08:00
|
|
|
|
<button
|
|
|
|
|
|
class="btn btn-secondary"
|
|
|
|
|
|
@click="resetSimulation"
|
|
|
|
|
|
>
|
|
|
|
|
|
重置
|
2026-02-05 01:33:28 +08:00
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
<!-- 知识点总结 -->
|
|
|
|
|
|
<div class="knowledge-box">
|
|
|
|
|
|
<div class="knowledge-title">💡 核心原理</div>
|
|
|
|
|
|
<div class="knowledge-content">
|
|
|
|
|
|
<p v-if="mode === 'separate'">
|
|
|
|
|
|
<strong>切图模式(分开请求):</strong>就像一箱一箱搬,每次只拉一件货。
|
|
|
|
|
|
浏览器要发起 6 次 HTTP 请求,每次都要建立连接、传输数据,
|
|
|
|
|
|
<span class="highlight-bad">效率低、耗时长</span>。
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<p v-else>
|
|
|
|
|
|
<strong>雪碧图模式(合并请求):</strong>就像用大卡车一次性拉走所有箱子。
|
|
|
|
|
|
浏览器只需 1 次 HTTP 请求就能获取所有图片,
|
|
|
|
|
|
<span class="highlight-good">大幅减少连接开销,速度更快</span>!
|
|
|
|
|
|
</p>
|
2026-02-05 01:33:28 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
import { ref, computed } from 'vue'
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
// 模式选择
|
|
|
|
|
|
const mode = ref('separate')
|
2026-02-05 01:33:28 +08:00
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
// 运行状态
|
|
|
|
|
|
const isRunning = ref(false)
|
|
|
|
|
|
const trips = ref(0)
|
|
|
|
|
|
const totalTime = ref(0)
|
|
|
|
|
|
const remainingBoxes = ref(6)
|
|
|
|
|
|
const deliveredBoxes = ref(0)
|
2026-02-05 01:33:28 +08:00
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
// 车辆动画
|
|
|
|
|
|
const vehicles = ref([])
|
2026-02-05 01:33:28 +08:00
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
// 计算效率评分
|
|
|
|
|
|
const efficiency = computed(() => {
|
|
|
|
|
|
if (mode.value === 'packed') {
|
|
|
|
|
|
return trips.value <= 1 ? '优秀' : '良好'
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return trips.value <= 3 ? '一般' : '低效'
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2026-02-05 01:33:28 +08:00
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
const efficiencyClass = computed(() => {
|
|
|
|
|
|
const score = efficiency.value
|
|
|
|
|
|
if (score === '优秀') return 'excellent'
|
|
|
|
|
|
if (score === '良好') return 'good'
|
|
|
|
|
|
if (score === '一般') return 'average'
|
|
|
|
|
|
return 'poor'
|
|
|
|
|
|
})
|
2026-02-05 01:33:28 +08:00
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
// 开始模拟
|
|
|
|
|
|
const startSimulation = async () => {
|
|
|
|
|
|
if (isRunning.value) return
|
2026-02-05 01:33:28 +08:00
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
isRunning.value = true
|
|
|
|
|
|
resetStats()
|
2026-02-05 01:33:28 +08:00
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
if (mode.value === 'separate') {
|
|
|
|
|
|
// 分开运输:一箱一趟
|
|
|
|
|
|
for (let i = 0; i < 6; i++) {
|
|
|
|
|
|
await runTrip(1)
|
|
|
|
|
|
trips.value++
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
2026-02-06 03:34:50 +08:00
|
|
|
|
// 打包运输:6箱一趟
|
|
|
|
|
|
await runTrip(6)
|
|
|
|
|
|
trips.value = 1
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
isRunning.value = false
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
// 单次运输动画
|
|
|
|
|
|
const runTrip = (cargoCount) => {
|
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
|
// 创建车辆
|
|
|
|
|
|
const vehicle = {
|
|
|
|
|
|
id: Date.now(),
|
|
|
|
|
|
position: 0,
|
|
|
|
|
|
cargo: cargoCount,
|
|
|
|
|
|
isMoving: true
|
|
|
|
|
|
}
|
|
|
|
|
|
vehicles.value = [vehicle]
|
2026-02-05 01:33:28 +08:00
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
// 更新剩余箱子
|
|
|
|
|
|
remainingBoxes.value = Math.max(0, remainingBoxes.value - cargoCount)
|
2026-02-05 01:33:28 +08:00
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
// 动画:去程
|
|
|
|
|
|
const goTrip = setInterval(() => {
|
|
|
|
|
|
vehicle.position += 2
|
|
|
|
|
|
if (vehicle.position >= 100) {
|
|
|
|
|
|
clearInterval(goTrip)
|
2026-02-05 01:33:28 +08:00
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
// 送达
|
|
|
|
|
|
deliveredBoxes.value += cargoCount
|
2026-02-05 01:33:28 +08:00
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
// 动画:返程
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
const returnTrip = setInterval(() => {
|
|
|
|
|
|
vehicle.position -= 2
|
|
|
|
|
|
if (vehicle.position <= 0) {
|
|
|
|
|
|
clearInterval(returnTrip)
|
|
|
|
|
|
vehicles.value = []
|
|
|
|
|
|
resolve()
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 20)
|
|
|
|
|
|
}, 300)
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
2026-02-06 03:34:50 +08:00
|
|
|
|
}, 20)
|
2026-02-05 01:33:28 +08:00
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
// 累计时间
|
|
|
|
|
|
totalTime.value += 2.5
|
2026-02-05 01:33:28 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2026-02-06 03:34:50 +08:00
|
|
|
|
|
|
|
|
|
|
// 重置模拟
|
|
|
|
|
|
const resetSimulation = () => {
|
|
|
|
|
|
isRunning.value = false
|
|
|
|
|
|
vehicles.value = []
|
|
|
|
|
|
resetStats()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const resetStats = () => {
|
|
|
|
|
|
trips.value = 0
|
|
|
|
|
|
totalTime.value = 0
|
|
|
|
|
|
remainingBoxes.value = 6
|
|
|
|
|
|
deliveredBoxes.value = 0
|
|
|
|
|
|
}
|
2026-02-05 01:33:28 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.moving-game {
|
|
|
|
|
|
border: 2px solid #e8e8e8;
|
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
|
background: linear-gradient(135deg, #fafbfc 0%, #f0f4f8 100%);
|
|
|
|
|
|
padding: 24px;
|
|
|
|
|
|
margin: 20px 0;
|
|
|
|
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
/* 故事框 */
|
|
|
|
|
|
.story-box {
|
2026-02-05 01:33:28 +08:00
|
|
|
|
text-align: center;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
margin-bottom: 24px;
|
|
|
|
|
|
padding: 20px;
|
|
|
|
|
|
background: linear-gradient(135deg, #fff8e1, #ffecb3);
|
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
|
border: 2px dashed #ffc107;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.story-emoji {
|
|
|
|
|
|
font-size: 48px;
|
|
|
|
|
|
margin-bottom: 8px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.story-title {
|
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: #8b4513;
|
|
|
|
|
|
margin: 0 0 8px 0;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.story-text {
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
color: #666;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
margin: 0;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
line-height: 1.6;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
/* 模式选择 */
|
|
|
|
|
|
.mode-selector {
|
2026-02-05 01:33:28 +08:00
|
|
|
|
display: flex;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
gap: 16px;
|
|
|
|
|
|
margin-bottom: 24px;
|
|
|
|
|
|
flex-wrap: wrap;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.mode-card {
|
|
|
|
|
|
background: white;
|
|
|
|
|
|
border: 3px solid #e0e0e0;
|
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
|
padding: 20px;
|
|
|
|
|
|
text-align: center;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
transition: all 0.3s ease;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
min-width: 200px;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
max-width: 280px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.mode-card:hover {
|
|
|
|
|
|
transform: translateY(-4px);
|
|
|
|
|
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.mode-card.active {
|
|
|
|
|
|
border-color: #4caf50;
|
|
|
|
|
|
background: #e8f5e9;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.mode-icon {
|
|
|
|
|
|
font-size: 48px;
|
|
|
|
|
|
margin-bottom: 12px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.mode-name {
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
margin-bottom: 8px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.mode-desc {
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
margin-bottom: 8px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.mode-detail {
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: #e65100;
|
|
|
|
|
|
padding: 4px 12px;
|
|
|
|
|
|
background: #fff3e0;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
border-radius: 12px;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
display: inline-block;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.vs-divider {
|
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: #999;
|
|
|
|
|
|
padding: 0 8px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
/* 动画演示区 */
|
|
|
|
|
|
.animation-area {
|
2026-02-05 01:33:28 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
gap: 16px;
|
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
|
padding: 20px;
|
|
|
|
|
|
background: white;
|
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
|
border: 2px solid #e0e0e0;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.location {
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
min-width: 100px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.location-icon {
|
|
|
|
|
|
font-size: 40px;
|
|
|
|
|
|
margin-bottom: 8px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.location-label {
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
margin-bottom: 8px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.boxes-remaining,
|
|
|
|
|
|
.boxes-delivered {
|
|
|
|
|
|
font-size: 12px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
color: #666;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
padding: 4px 8px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
background: #f5f5f5;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
border-radius: 8px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.count {
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: #e65100;
|
|
|
|
|
|
font-size: 16px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.road {
|
2026-02-05 01:33:28 +08:00
|
|
|
|
flex: 1;
|
|
|
|
|
|
position: relative;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
height: 80px;
|
|
|
|
|
|
background: linear-gradient(to bottom, #e8eaf6 0%, #c5cae9 100%);
|
2026-02-05 01:33:28 +08:00
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.road-line {
|
2026-02-05 01:33:28 +08:00
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 50%;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
left: 10%;
|
|
|
|
|
|
right: 10%;
|
|
|
|
|
|
height: 4px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
background: repeating-linear-gradient(
|
|
|
|
|
|
90deg,
|
2026-02-06 03:34:50 +08:00
|
|
|
|
#7986cb 0px,
|
|
|
|
|
|
#7986cb 20px,
|
2026-02-05 01:33:28 +08:00
|
|
|
|
transparent 20px,
|
|
|
|
|
|
transparent 40px
|
|
|
|
|
|
);
|
2026-02-06 03:34:50 +08:00
|
|
|
|
transform: translateY(-50%);
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.vehicle {
|
2026-02-05 01:33:28 +08:00
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 50%;
|
|
|
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
transition: none;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.vehicle-body {
|
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
|
filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.vehicle-cargo {
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
background: white;
|
|
|
|
|
|
padding: 2px 6px;
|
|
|
|
|
|
border-radius: 8px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
margin-top: 2px;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: #e65100;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
/* 统计面板 */
|
|
|
|
|
|
.stats-panel {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
grid-template-columns: repeat(3, 1fr);
|
|
|
|
|
|
gap: 16px;
|
|
|
|
|
|
margin-bottom: 20px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.stat-item {
|
|
|
|
|
|
background: white;
|
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
padding: 16px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
border: 2px solid #e0e0e0;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.stat-label {
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
margin-bottom: 8px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.stat-value {
|
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
|
font-weight: bold;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.stat-value.good {
|
|
|
|
|
|
color: #4caf50;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.stat-value.bad {
|
|
|
|
|
|
color: #f44336;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.stat-value.excellent {
|
|
|
|
|
|
color: #2196f3;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.stat-value.good {
|
|
|
|
|
|
color: #4caf50;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.stat-value.poor {
|
|
|
|
|
|
color: #ff9800;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
/* 控制按钮 */
|
|
|
|
|
|
.controls {
|
2026-02-05 01:33:28 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
gap: 12px;
|
|
|
|
|
|
margin-bottom: 20px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.btn {
|
|
|
|
|
|
padding: 12px 24px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
border: none;
|
|
|
|
|
|
border-radius: 8px;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
font-weight: bold;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
cursor: pointer;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
transition: all 0.3s ease;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.btn:hover:not(:disabled) {
|
2026-02-05 01:33:28 +08:00
|
|
|
|
transform: translateY(-2px);
|
2026-02-06 03:34:50 +08:00
|
|
|
|
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.btn:disabled {
|
|
|
|
|
|
opacity: 0.6;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.btn-primary {
|
|
|
|
|
|
background: linear-gradient(135deg, #667eea, #764ba2);
|
|
|
|
|
|
color: white;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.btn-secondary {
|
|
|
|
|
|
background: #f5f5f5;
|
|
|
|
|
|
color: #666;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
/* 知识点总结 */
|
|
|
|
|
|
.knowledge-box {
|
2026-02-05 01:33:28 +08:00
|
|
|
|
background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
|
2026-02-06 03:34:50 +08:00
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
padding: 20px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
border-left: 4px solid #2196f3;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.knowledge-title {
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: #1565c0;
|
|
|
|
|
|
margin-bottom: 12px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.knowledge-content {
|
|
|
|
|
|
font-size: 14px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
line-height: 1.6;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
color: #333;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.knowledge-content p {
|
|
|
|
|
|
margin: 0;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.highlight-good {
|
|
|
|
|
|
color: #4caf50;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.highlight-bad {
|
|
|
|
|
|
color: #f44336;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 响应式 */
|
2026-02-05 01:33:28 +08:00
|
|
|
|
@media (max-width: 768px) {
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.mode-selector {
|
|
|
|
|
|
flex-direction: column;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.vs-divider {
|
|
|
|
|
|
transform: rotate(90deg);
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.animation-area {
|
2026-02-05 01:33:28 +08:00
|
|
|
|
flex-direction: column;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
gap: 12px;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 03:34:50 +08:00
|
|
|
|
.road {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 60px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.stats-panel {
|
|
|
|
|
|
grid-template-columns: 1fr;
|
2026-02-05 01:33:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|