cwg-pc-header.vue 2.3 KB

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