cwg-pc-header.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. <view class="pc-header-btn">
  12. <cwg-icon name="xxtz" color="#141d22" />
  13. </view>
  14. <view class="pc-header-btn" @click="openRightDrawer">
  15. <cwg-icon name="icon_my" color="#141d22" />
  16. </view>
  17. </div>
  18. </header>
  19. </template>
  20. <script setup lang="ts">
  21. import useRouter from "@/hooks/useRouter";
  22. const router = useRouter();
  23. const props = defineProps({
  24. sidebarVisible: {
  25. type: Boolean,
  26. default: false
  27. },
  28. })
  29. const emit = defineEmits<{
  30. (e: 'open-right-drawer'): void,
  31. (e: 'open-left-drawer'): void
  32. }>()
  33. function toggleTheme() {
  34. // globalStore.setGlobalTheme(globalStore.theme === 'light' ? 'dark' : 'light');
  35. }
  36. function openRightDrawer() {
  37. emit('open-right-drawer');
  38. }
  39. function openLeftDrawer() {
  40. emit('open-left-drawer');
  41. }
  42. </script>
  43. <style scoped lang="scss">
  44. .cwg-pc-header {
  45. display: flex;
  46. align-items: center;
  47. justify-content: space-between;
  48. width: 100vw;
  49. height: px2rpx(55);
  50. background-color: rgba(255, 255, 255, 0.9);
  51. border-bottom: 1px solid #f0f0f0;
  52. padding: 0 px2rpx(16);
  53. box-sizing: border-box;
  54. position: fixed;
  55. top: 0;
  56. left: 0;
  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. }
  76. .bell .dot {
  77. position: absolute;
  78. top: 0;
  79. right: -2px;
  80. width: 7px;
  81. height: 7px;
  82. background: #27ae60;
  83. border-radius: 50%;
  84. display: inline-block;
  85. }
  86. .left-img {
  87. width: px2rpx(120);
  88. }
  89. .avatar .img {
  90. width: 32px;
  91. height: 32px;
  92. border-radius: 50%;
  93. background: #eee;
  94. }
  95. .logo .img {
  96. width: 36px;
  97. height: 36px;
  98. border-radius: 50%;
  99. background: #fff;
  100. }
  101. </style>