cwg-pc-header.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <header class="cwg-pc-header">
  3. <div class="left">
  4. <text class="back-arrow" @click="$emit('toggle-sidebar')">&#8592;</text>
  5. </div>
  6. <div class="center"></div>
  7. <div class="right">
  8. <div class="lang-select">
  9. <image class="img flag" src="/static/flag-en.png" alt="en" />
  10. <text>English</text>
  11. <text class="arrow">▼</text>
  12. </div>
  13. <text class="icon sun" @click="toggleTheme">🌞</text>
  14. <text class="icon bell">🔔<text class="dot"></text></text>
  15. <text class="icon avatar">
  16. <image class="img" src="/static/avatar.png" alt="avatar" />
  17. </text>
  18. <text class="icon logo" @click="goUserInfo">
  19. <image class="img" src="/static/logo.png" alt="logo" />
  20. </text>
  21. </div>
  22. </header>
  23. </template>
  24. <script setup lang="ts">
  25. import useGlobalStore from '@/stores/use-global-store'
  26. const globalStore = useGlobalStore()
  27. import useRouter from "@/hooks/useRouter";
  28. const router = useRouter();
  29. function toggleTheme() {
  30. globalStore.setGlobalTheme(globalStore.theme === 'light' ? 'dark' : 'light');
  31. }
  32. function goUserInfo() {
  33. router.push('/pages/mine/info')
  34. }
  35. </script>
  36. <style scoped lang="scss">
  37. .cwg-pc-header {
  38. display: flex;
  39. align-items: center;
  40. justify-content: space-between;
  41. height: 56px;
  42. background: #fff;
  43. border-bottom: 1px solid #f0f0f0;
  44. padding: 0 32px;
  45. position: relative;
  46. z-index: 10;
  47. }
  48. .left {
  49. display: flex;
  50. align-items: center;
  51. }
  52. .back-arrow {
  53. color: #e74c3c;
  54. font-size: 22px;
  55. cursor: pointer;
  56. margin-right: 16px;
  57. }
  58. .center {
  59. flex: 1;
  60. }
  61. .right {
  62. display: flex;
  63. align-items: center;
  64. gap: 18px;
  65. }
  66. .lang-select {
  67. display: flex;
  68. align-items: center;
  69. background: #f5f7fa;
  70. border-radius: 18px;
  71. padding: 4px 12px;
  72. font-size: 14px;
  73. cursor: pointer;
  74. }
  75. .flag {
  76. width: 22px;
  77. height: 16px;
  78. margin-right: 6px;
  79. }
  80. .arrow {
  81. margin-left: 4px;
  82. font-size: 12px;
  83. }
  84. .icon {
  85. font-size: 20px;
  86. position: relative;
  87. cursor: pointer;
  88. }
  89. .bell .dot {
  90. position: absolute;
  91. top: 0;
  92. right: -2px;
  93. width: 7px;
  94. height: 7px;
  95. background: #27ae60;
  96. border-radius: 50%;
  97. display: inline-block;
  98. }
  99. .avatar .img {
  100. width: 32px;
  101. height: 32px;
  102. border-radius: 50%;
  103. background: #eee;
  104. }
  105. .logo .img {
  106. width: 36px;
  107. height: 36px;
  108. border-radius: 50%;
  109. background: #fff;
  110. }
  111. </style>