top-window.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. }>()
  37. function toggleTheme() {
  38. // globalStore.setGlobalTheme(globalStore.theme === 'light' ? 'dark' : 'light');
  39. }
  40. function openRightDrawer() {
  41. emit('open-right-drawer');
  42. }
  43. function openLeftDrawer() {
  44. emit('open-left-drawer');
  45. }
  46. </script>
  47. <style scoped lang="scss">
  48. .cwg-pc-header {
  49. display: flex;
  50. align-items: center;
  51. justify-content: space-between;
  52. height: px2rpx(55);
  53. background-color: rgba(255, 255, 255, 0.9);
  54. border-bottom: 1px solid #f0f0f0;
  55. padding: 0 px2rpx(16);
  56. position: relative;
  57. z-index: 10;
  58. }
  59. .left {
  60. display: flex;
  61. align-items: center;
  62. }
  63. .back-arrow {
  64. color: #e74c3c;
  65. font-size: 22px;
  66. cursor: pointer;
  67. margin-right: 16px;
  68. }
  69. .center {
  70. flex: 1;
  71. }
  72. .right {
  73. display: flex;
  74. align-items: center;
  75. gap: 18px;
  76. }
  77. .lang-select {
  78. display: flex;
  79. align-items: center;
  80. background: #f5f7fa;
  81. border-radius: 18px;
  82. padding: 4px 12px;
  83. font-size: 14px;
  84. cursor: pointer;
  85. }
  86. .flag {
  87. width: 22px;
  88. height: 16px;
  89. margin-right: 6px;
  90. }
  91. .arrow {
  92. margin-left: 4px;
  93. font-size: 12px;
  94. }
  95. .icon {
  96. font-size: 20px;
  97. position: relative;
  98. cursor: pointer;
  99. }
  100. .bell .dot {
  101. position: absolute;
  102. top: 0;
  103. right: -2px;
  104. width: 7px;
  105. height: 7px;
  106. background: #27ae60;
  107. border-radius: 50%;
  108. display: inline-block;
  109. }
  110. .left-img {
  111. width: px2rpx(120);
  112. }
  113. .avatar .img {
  114. width: 32px;
  115. height: 32px;
  116. border-radius: 50%;
  117. background: #eee;
  118. }
  119. .logo .img {
  120. width: 36px;
  121. height: 36px;
  122. border-radius: 50%;
  123. background: #fff;
  124. }
  125. </style>