cwg-pc-header.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <uni-nav-bar
  3. :leftWidth="0"
  4. :rightWidth="0"
  5. :statusBar="true"
  6. :fixed="true"
  7. :height="55"
  8. :border="false"
  9. >
  10. <view class="cwg-pc-header bg-body">
  11. <!-- 左侧 -->
  12. <view class="left">
  13. <cwg-icon
  14. :name="!sidebarVisible ? 'crm-bars-staggered' : 'cwg-close'"
  15. color="#97A1C0"
  16. @click="openLeftDrawer"
  17. />
  18. </view>
  19. <!-- 中间 Logo -->
  20. <view class="center-logo">
  21. <image
  22. v-if="!isDark"
  23. class="logo-img"
  24. src="/static/images/vu/logo-full.svg"
  25. mode="widthFix"
  26. alt="logo"
  27. />
  28. <image
  29. v-else
  30. class="logo-img"
  31. src="/static/images/vu/logo-full-white.svg"
  32. mode="widthFix"
  33. alt="logo"
  34. />
  35. </view>
  36. <!-- 右侧 -->
  37. <view class="right">
  38. <cwg-download />
  39. <cwg-notice />
  40. <cwg-right-drawer />
  41. </view>
  42. </view>
  43. </uni-nav-bar>
  44. </template>
  45. <script setup lang="ts">
  46. import { computed } from 'vue'
  47. import useGlobalStore from '@/stores/use-global-store'
  48. const globalStore = useGlobalStore()
  49. const isDark = computed(() => globalStore.theme === 'dark')
  50. defineProps({
  51. sidebarVisible: {
  52. type: Boolean,
  53. default: false
  54. }
  55. })
  56. const emit = defineEmits<{
  57. (e: 'open-right-drawer'): void
  58. (e: 'open-left-drawer'): void
  59. }>()
  60. function openLeftDrawer() {
  61. emit('open-left-drawer')
  62. }
  63. </script>
  64. <style scoped lang="scss">
  65. @import "@/uni.scss";
  66. .cwg-pc-header {
  67. position: relative;
  68. display: flex;
  69. align-items: center;
  70. justify-content: space-between;
  71. width: 100vw;
  72. height: px2rpx(55);
  73. padding: 0 px2rpx(16);
  74. box-sizing: border-box;
  75. background-color: rgba(255, 255, 255, 0.9);
  76. border-bottom: 1px solid var(--bs-border-color);
  77. }
  78. /* 左右区域 */
  79. .left,
  80. .right {
  81. display: flex;
  82. align-items: center;
  83. z-index: 2;
  84. }
  85. /* 中间 Logo 真正居中 */
  86. .center-logo {
  87. position: absolute;
  88. left: 50%;
  89. top: 50%;
  90. transform: translate(-50%, -50%);
  91. display: flex;
  92. align-items: center;
  93. justify-content: center;
  94. pointer-events: none;
  95. }
  96. /* Logo */
  97. .logo-img {
  98. width: px2rpx(120);
  99. display: block;
  100. }
  101. /* 通知红点 */
  102. .bell .dot {
  103. position: absolute;
  104. top: 0;
  105. right: -2px;
  106. width: 7px;
  107. height: 7px;
  108. background: #27ae60;
  109. border-radius: 50%;
  110. display: inline-block;
  111. }
  112. /* 头像 */
  113. .avatar .img {
  114. width: 32px;
  115. height: 32px;
  116. border-radius: 50%;
  117. background: #eee;
  118. }
  119. /* Logo占位 */
  120. .logo .img {
  121. width: 36px;
  122. height: 36px;
  123. border-radius: 50%;
  124. background: #fff;
  125. }
  126. </style>