top-window.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <header class="cwg-pc-header bg-body" :class="{ 'dark': isDark }">
  3. <div class="left">
  4. <image class="left-img" v-if="!isDark" src="/static/images/vu/logo-full.svg" mode="widthFix" alt="logo"
  5. @click="openLeftDrawer" />
  6. <image class="left-img" v-else src="/static/images/vu/logo-full-white.svg" mode="widthFix" alt="logo"
  7. @click="openLeftDrawer" />
  8. </div>
  9. <div class="right" v-if="visible">
  10. <cwg-payment />
  11. <cwg-system />
  12. <cwg-language />
  13. <cwg-notice />
  14. <cwg-right-drawer />
  15. </div>
  16. </header>
  17. </template>
  18. <script setup lang="ts">
  19. import { ref, computed, watch } from 'vue'
  20. import { storeToRefs } from 'pinia'
  21. import useUserStore from '@/stores/use-user-store'
  22. const userStore = useUserStore()
  23. const { userInfo } = storeToRefs(userStore)
  24. import useGlobalStore from '@/stores/use-global-store'
  25. const globalStore = useGlobalStore()
  26. const isDark = computed(() => globalStore.theme === 'dark')
  27. const visible = ref(true)
  28. watch(() => userInfo.value, (val) => {
  29. visible.value = !!val
  30. })
  31. const props = defineProps({
  32. sidebarVisible: {
  33. type: Boolean,
  34. default: false,
  35. },
  36. })
  37. </script>
  38. <style scoped lang="scss">
  39. @import "@/uni.scss";
  40. .cwg-pc-header {
  41. display: flex;
  42. align-items: center;
  43. justify-content: space-between;
  44. height: px2rpx(55);
  45. border-bottom: 1px solid var(--bs-border-color);
  46. padding: 0 px2rpx(16);
  47. position: relative;
  48. z-index: 10;
  49. }
  50. .left {
  51. display: flex;
  52. align-items: center;
  53. }
  54. .center {
  55. flex: 1;
  56. }
  57. .right {
  58. display: flex;
  59. align-items: center;
  60. gap: 0;
  61. }
  62. .bell .dot {
  63. position: absolute;
  64. top: 0;
  65. right: -2px;
  66. width: 7px;
  67. height: 7px;
  68. background: #27ae60;
  69. border-radius: 50%;
  70. display: inline-block;
  71. }
  72. .left-img {
  73. width: px2rpx(120);
  74. }
  75. .avatar .img {
  76. width: 32px;
  77. height: 32px;
  78. border-radius: 50%;
  79. background: #eee;
  80. }
  81. .logo .img {
  82. width: 36px;
  83. height: 36px;
  84. border-radius: 50%;
  85. background: #fff;
  86. }
  87. </style>