StatusBar.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <div class="status-bar">
  3. <div class="status-info">
  4. <span>
  5. 系统状态:
  6. <span :class="hasAlerts ? 'status-warning' : 'status-online'">{{
  7. systemStatus || '未知状态'
  8. }}</span>
  9. </span>
  10. <span>最后数据同步: {{ lastTime || '-' }}</span>
  11. </div>
  12. <div class="alert-indicator" :class="{ active: hasAlerts }">
  13. {{ hasAlerts ? '有警告设备需要关注' : '所有设备运行正常' }}
  14. </div>
  15. </div>
  16. </template>
  17. <script lang="ts" setup>
  18. interface Props {
  19. systemStatus: string
  20. lastTime: string
  21. hasAlerts: boolean
  22. }
  23. defineProps<Props>()
  24. </script>
  25. <style lang="scss" scoped>
  26. $success-color: #26de81;
  27. $warning-color: #fd9644;
  28. @keyframes pulse {
  29. 0% {
  30. opacity: 1;
  31. }
  32. 50% {
  33. opacity: 0.7;
  34. }
  35. 100% {
  36. opacity: 1;
  37. }
  38. }
  39. .status-bar {
  40. display: flex;
  41. padding: 12px 25px;
  42. font-size: 14px;
  43. background: rgb(26 31 46 / 90%);
  44. border: 1px solid rgb(255 255 255 / 15%);
  45. border-radius: 12px;
  46. justify-content: space-between;
  47. align-items: center;
  48. }
  49. .status-info {
  50. display: flex;
  51. gap: 20px;
  52. .status-online {
  53. font-weight: 600;
  54. color: $success-color;
  55. }
  56. .status-warning {
  57. font-weight: 600;
  58. color: $warning-color;
  59. }
  60. }
  61. .alert-indicator {
  62. padding: 5px 15px;
  63. background: rgb(166 177 194 / 20%);
  64. border-radius: 20px;
  65. &.active {
  66. color: $warning-color;
  67. background: rgb(253 150 68 / 30%);
  68. animation: pulse 2s infinite;
  69. }
  70. }
  71. </style>