cwg-pc-header.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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" v-if="!isMobile">
  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-scan /> -->
  41. <cwg-right-drawer />
  42. </view>
  43. </view>
  44. </uni-nav-bar>
  45. </template>
  46. <script setup lang="ts">
  47. import { computed } from 'vue'
  48. import useGlobalStore from '@/stores/use-global-store'
  49. import { useWindowWidth } from '@/composables/useWindowWidth'
  50. const windowWidth = useWindowWidth(300)
  51. const isMobile = computed(() => windowWidth.value <= 768)
  52. const globalStore = useGlobalStore()
  53. const isDark = computed(() => globalStore.theme === 'dark')
  54. defineProps({
  55. sidebarVisible: {
  56. type: Boolean,
  57. default: false
  58. }
  59. })
  60. const emit = defineEmits<{
  61. (e: 'open-right-drawer'): void
  62. (e: 'open-left-drawer'): void
  63. }>()
  64. function openLeftDrawer() {
  65. emit('open-left-drawer')
  66. }
  67. </script>
  68. <style scoped lang="scss">
  69. @import "@/uni.scss";
  70. .cwg-pc-header {
  71. position: relative;
  72. display: flex;
  73. align-items: center;
  74. justify-content: space-between;
  75. width: 100vw;
  76. height: px2rpx(55);
  77. padding: 0 px2rpx(16);
  78. box-sizing: border-box;
  79. background-color: rgba(255, 255, 255, 0.9);
  80. border-bottom: 1px solid var(--bs-border-color);
  81. }
  82. /* 左右区域 */
  83. .left,
  84. .right {
  85. display: flex;
  86. align-items: center;
  87. z-index: 2;
  88. }
  89. /* 中间 Logo 真正居中 */
  90. .center-logo {
  91. position: absolute;
  92. left: 50%;
  93. top: 50%;
  94. transform: translate(-50%, -50%);
  95. display: flex;
  96. align-items: center;
  97. justify-content: center;
  98. pointer-events: none;
  99. }
  100. /* Logo */
  101. .logo-img {
  102. width: px2rpx(120);
  103. display: block;
  104. }
  105. /* 通知红点 */
  106. .bell .dot {
  107. position: absolute;
  108. top: 0;
  109. right: -2px;
  110. width: 7px;
  111. height: 7px;
  112. background: #27ae60;
  113. border-radius: 50%;
  114. display: inline-block;
  115. }
  116. /* 头像 */
  117. .avatar .img {
  118. width: 32px;
  119. height: 32px;
  120. border-radius: 50%;
  121. background: #eee;
  122. }
  123. /* Logo占位 */
  124. .logo .img {
  125. width: 36px;
  126. height: 36px;
  127. border-radius: 50%;
  128. background: #fff;
  129. }
  130. </style>