MapLegend.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <div class="map-legend">
  3. <div class="legend-header">图例</div>
  4. <div class="legend-list">
  5. <div
  6. class="legend-item"
  7. v-for="(item, index) in legendData"
  8. :key="index"
  9. >
  10. <div class="legend-icon" :style="{ backgroundColor: item.color }">
  11. <span v-if="item.type === 'text'">{{ item.char }}</span>
  12. <div v-else-if="item.type === 'signal'" class="css-signal-icon">
  13. <i></i><i></i><i></i>
  14. </div>
  15. </div>
  16. <span class="legend-label">{{ item.label }}</span>
  17. </div>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. export default {
  23. name: 'MapLegend',
  24. data() {
  25. return {
  26. // 完全按照图片内容配置的数据字典
  27. legendData: [
  28. { type: 'text', char: '中', label: '中心计划', color: '#3b5cff' },
  29. { type: 'text', char: '干', label: '干线协调', color: '#2ecc71' },
  30. { type: 'text', char: '勤', label: '勤务路线', color: '#e74c3c' },
  31. { type: 'text', char: '定', label: '定周期控制', color: '#3498db' },
  32. { type: 'text', char: '感', label: '感应控制', color: '#e67e22' },
  33. { type: 'text', char: '自', label: '自适应控制', color: '#9b59b6' },
  34. { type: 'text', char: '手', label: '手动控制', color: '#f39c12' },
  35. { type: 'text', char: '特', label: '特殊控制', color: '#a0522d' }, // 棕色
  36. { type: 'signal', label: '离线', color: '#5b5c60' }, // 灰色
  37. { type: 'signal', label: '降级', color: '#f1c40f' }, // 黄色
  38. { type: 'signal', label: '故障', color: '#e74c3c' } // 红色
  39. ]
  40. };
  41. }
  42. };
  43. </script>
  44. <style scoped>
  45. /* ================== 容器主面板 ================== */
  46. .map-legend {
  47. width: 160px;
  48. background: rgba(16, 28, 56, 0.85); /* 深蓝色半透明背景 */
  49. backdrop-filter: blur(10px); /* 毛玻璃模糊效果 */
  50. -webkit-backdrop-filter: blur(10px);
  51. border: 1px solid rgba(100, 150, 255, 0.2); /* 淡淡的科技感边框 */
  52. border-radius: 10px;
  53. box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5); /* 底部阴影让它浮起来 */
  54. overflow: hidden;
  55. user-select: none;
  56. }
  57. /* ================== 头部标题 ================== */
  58. .legend-header {
  59. color: #ffffff;
  60. font-size: 15px;
  61. font-weight: bold;
  62. padding: 12px 16px;
  63. background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1), transparent);
  64. border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  65. letter-spacing: 1px;
  66. }
  67. /* ================== 列表区域 ================== */
  68. .legend-list {
  69. padding: 12px 16px;
  70. display: flex;
  71. flex-direction: column;
  72. gap: 14px; /* 控制每一行之间的间距 */
  73. }
  74. .legend-item {
  75. display: flex;
  76. align-items: center;
  77. }
  78. /* ================== 左侧图标统一底座 ================== */
  79. .legend-icon {
  80. width: 22px;
  81. height: 22px;
  82. border-radius: 50%; /* 正圆形 */
  83. display: flex;
  84. justify-content: center;
  85. align-items: center;
  86. margin-right: 12px; /* 和右侧文字的间距 */
  87. box-shadow: 0 0 6px rgba(0, 0, 0, 0.3) inset; /* 内阴影增加立体感 */
  88. }
  89. /* 单字图标样式 */
  90. .legend-icon span {
  91. color: #ffffff;
  92. font-size: 12px;
  93. font-weight: bold;
  94. transform: scale(0.9); /* 汉字稍微缩放一点更好看 */
  95. }
  96. /* ================== 纯 CSS 手绘信号灯 ================== */
  97. .css-signal-icon {
  98. width: 8px;
  99. height: 14px;
  100. border: 1px solid rgba(255, 255, 255, 0.9);
  101. border-radius: 3px;
  102. display: flex;
  103. flex-direction: column;
  104. justify-content: space-evenly;
  105. align-items: center;
  106. box-sizing: border-box;
  107. }
  108. /* 信号灯里面的三个小圆点 */
  109. .css-signal-icon i {
  110. display: block;
  111. width: 2px;
  112. height: 2px;
  113. background-color: #ffffff;
  114. border-radius: 50%;
  115. }
  116. /* ================== 右侧文字标签 ================== */
  117. .legend-label {
  118. /* 提取图片中极其特殊的淡薄荷绿文字颜色 */
  119. color: #8ce6cc;
  120. font-size: 14px;
  121. letter-spacing: 1px;
  122. }
  123. </style>