cwg-pc-header.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <header class="cwg-pc-header">
  3. <div class="left">
  4. <image class="left-img" src="/static/images/logo.png" mode="widthFix" alt="logo" @click="openLeftDrawer" />
  5. </div>
  6. <div class="right">
  7. <div class="lang-select">
  8. <image class="img flag" src="/static/flag-en.png" alt="en" />
  9. <text>English</text>
  10. <text class="arrow">▼</text>
  11. </div>
  12. <text class="icon sun" @click="toggleTheme">🌞</text>
  13. <text class="icon bell">🔔<text class="dot"></text></text>
  14. <text class="icon avatar">
  15. <image class="img" src="/static/avatar.png" alt="avatar" />
  16. </text>
  17. <text class="icon logo" @click="openRightDrawer">
  18. <image class="img" src="/static/logo.png" alt="logo" />
  19. </text>
  20. </div>
  21. </header>
  22. </template>
  23. <script setup lang="ts">
  24. // import useGlobalStore from '@/stores/use-global-store'
  25. // const globalStore = useGlobalStore()
  26. import useRouter from "@/hooks/useRouter";
  27. const router = useRouter();
  28. const props = defineProps({
  29. sidebarVisible: {
  30. type: Boolean,
  31. default: false
  32. },
  33. })
  34. const emit = defineEmits<{
  35. (e: 'open-right-drawer'): void,
  36. (e: 'open-left-drawer'): void
  37. }>()
  38. function toggleTheme() {
  39. // globalStore.setGlobalTheme(globalStore.theme === 'light' ? 'dark' : 'light');
  40. }
  41. function openRightDrawer() {
  42. emit('open-right-drawer');
  43. }
  44. function openLeftDrawer() {
  45. emit('open-left-drawer');
  46. }
  47. </script>
  48. <style scoped lang="scss">
  49. .cwg-pc-header {
  50. display: flex;
  51. align-items: center;
  52. justify-content: space-between;
  53. width: 100vw;
  54. height: px2rpx(55);
  55. background-color: rgba(255, 255, 255, 0.9);
  56. border-bottom: 1px solid #f0f0f0;
  57. padding: 0 px2rpx(16);
  58. box-sizing: border-box;
  59. position: fixed;
  60. top: 0;
  61. left: 0;
  62. z-index: 10;
  63. }
  64. .left {
  65. display: flex;
  66. align-items: center;
  67. }
  68. .back-arrow {
  69. color: #e74c3c;
  70. font-size: 22px;
  71. cursor: pointer;
  72. margin-right: 16px;
  73. }
  74. .center {
  75. flex: 1;
  76. }
  77. .right {
  78. display: flex;
  79. align-items: center;
  80. gap: 18px;
  81. }
  82. .lang-select {
  83. display: flex;
  84. align-items: center;
  85. background: #f5f7fa;
  86. border-radius: 18px;
  87. padding: 4px 12px;
  88. font-size: 14px;
  89. cursor: pointer;
  90. }
  91. .flag {
  92. width: 22px;
  93. height: 16px;
  94. margin-right: 6px;
  95. }
  96. .arrow {
  97. margin-left: 4px;
  98. font-size: 12px;
  99. }
  100. .icon {
  101. font-size: 20px;
  102. position: relative;
  103. cursor: pointer;
  104. }
  105. .bell .dot {
  106. position: absolute;
  107. top: 0;
  108. right: -2px;
  109. width: 7px;
  110. height: 7px;
  111. background: #27ae60;
  112. border-radius: 50%;
  113. display: inline-block;
  114. }
  115. .left-img {
  116. width: px2rpx(120);
  117. }
  118. .avatar .img {
  119. width: 32px;
  120. height: 32px;
  121. border-radius: 50%;
  122. background: #eee;
  123. }
  124. .logo .img {
  125. width: 36px;
  126. height: 36px;
  127. border-radius: 50%;
  128. background: #fff;
  129. }
  130. </style>