feat(cockpit): 为提示和警告组件添加背景图像和图标

- 更新 EmergencyForceTooltip 以使用三部分可拉伸的背景图像(顶部、中间、底部)和用于尺寸的 CSS 变量,取代纯色背景和边框
- 修改关闭按钮为透明点击区域,并添加 focus-visible 轮廓以提高可访问性
- 为 WeatherWarning 级别徽章添加警告图标,并调整徽章高度和对齐方式以实现更好的视觉整合
This commit is contained in:
Zzc 2025-11-14 18:19:04 +08:00
parent 045d362723
commit d6c242c540
2 changed files with 74 additions and 33 deletions

View File

@ -136,6 +136,13 @@ const handleClose = () => {
@use '@/styles/mixins.scss' as *;
.emergency-force-tooltip {
// CSS
// PNG
--tooltip-top-height: 68px;
--tooltip-bottom-height: 68px;
--tooltip-side-padding: 24px;
--tooltip-body-padding: 16px;
position: absolute;
z-index: 9999;
pointer-events: auto;
@ -145,14 +152,42 @@ const handleClose = () => {
min-width: 200px;
max-width: 300px;
padding: 1rem;
//
background: rgba(9, 22, 45, 0.95);
border: 1px solid rgba(71, 186, 255, 0.4);
border-radius: 0.5rem;
backdrop-filter: blur(12px);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
// padding +
// padding
padding: calc(var(--tooltip-top-height))
var(--tooltip-side-padding)
calc(var(--tooltip-bottom-height));
//
background-image:
url('@/views/cockpit/assets/emergencyForceTooltip/top.png'),
url('@/views/cockpit/assets/emergencyForceTooltip/bottom.png'),
url('@/views/cockpit/assets/emergencyForceTooltip/middle.png');
// // background-size
background-repeat: no-repeat, no-repeat, no-repeat;
//
// 1px +2px 1px
background-position:
center top,
center bottom,
center calc(var(--tooltip-top-height) - 1px);
// /
// 2px 1px
background-size:
100% var(--tooltip-top-height),
100% var(--tooltip-bottom-height),
100% calc(100% - var(--tooltip-top-height) - var(--tooltip-bottom-height) + 2px);
// border border-radius使
border: none;
//
// backdrop-filter: blur(12px);
// box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
color: #fff;
font-size: 14px;
@ -173,31 +208,28 @@ const handleClose = () => {
}
}
//
// -
.close-button {
position: absolute;
top: 0.5rem;
right: 0.5rem;
top: 18px;
right: 2px;
width: 24px;
height: 24px;
padding: 0;
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 50%;
color: #fff;
font-size: 18px;
//
border: none;
background: transparent;
color: transparent;
font-size: 0;
line-height: 1;
box-shadow: none;
cursor: pointer;
transition: all 0.2s ease;
&:hover {
background: rgba(255, 255, 255, 0.2);
border-color: rgba(71, 186, 255, 0.6);
transform: scale(1.1);
}
&:active {
transform: scale(0.95);
//
&:focus-visible {
outline: 2px solid rgba(255, 255, 255, 0.8);
outline-offset: 2px;
}
}
@ -241,8 +273,9 @@ const handleClose = () => {
align-items: center;
justify-content: center;
gap: 0.5rem;
background: rgba(9, 22, 45, 0.95);
border-radius: 0.5rem;
// 使
background: rgba(0, 0, 0, 1);
backdrop-filter: blur(12px);
span {

View File

@ -14,7 +14,7 @@
<!-- 六边形徽章容器 -->
<div class="badge-container">
<!-- 六边形徽章 -->
<div class="level-badge">
<div class="level-badge" :style="{ backgroundImage: `url(${level.warningIcon})` }">
<!-- <img
src="../assets/img/weather-badge-hexagon.png"
alt="badge"
@ -70,6 +70,10 @@ import { ref } from 'vue'
//
import glowTopIcon from '../assets/img/weather-badge-glow-top.png'
import glowBottomIcon from '../assets/img/weather-badge-glow-bottom.png'
import blueWarningIcon from '../assets/img/weather-badge-blue-warning.png'
import yellowWarningIcon from '../assets/img/weather-badge-yellow-warning.png'
import orangeWarningIcon from '../assets/img/weather-badge-orange-warning.png'
import redWarningIcon from '../assets/img/weather-badge-red-warning.png'
const warningLevels = ref([
{
@ -78,7 +82,8 @@ const warningLevels = ref([
count: 320,
color: 'rgba(132, 199, 255, 1)',
glowTopIcon: glowTopIcon,
glowBottomIcon: glowBottomIcon
glowBottomIcon: glowBottomIcon,
warningIcon: blueWarningIcon
},
{
id: 2,
@ -86,7 +91,8 @@ const warningLevels = ref([
count: 36,
color: 'rgba(215, 209, 38, 1)',
glowTopIcon: glowTopIcon,
glowBottomIcon: glowBottomIcon
glowBottomIcon: glowBottomIcon,
warningIcon: yellowWarningIcon
},
{
id: 3,
@ -94,7 +100,8 @@ const warningLevels = ref([
count: 2,
color: 'rgba(255, 114, 0, 1)',
glowTopIcon: glowTopIcon,
glowBottomIcon: glowBottomIcon
glowBottomIcon: glowBottomIcon,
warningIcon: orangeWarningIcon
},
{
id: 4,
@ -102,7 +109,8 @@ const warningLevels = ref([
count: 1,
color: 'rgba(255, 32, 0, 1)',
glowTopIcon: glowTopIcon,
glowBottomIcon: glowBottomIcon
glowBottomIcon: glowBottomIcon,
warningIcon: redWarningIcon
}
])
@ -171,9 +179,9 @@ const districts = ref([
.level-badge {
position: relative;
width: vw(80);
height: vh(90);
height: vh(70);
display: flex;
align-items: center;
align-items: flex-start;
justify-content: center;
z-index: 2;
background: url(../assets/img/weather-badge-bg.png) center center / 100% 100% no-repeat;