cwg-pc-header.vue 2.5 KB

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