cwg-pc-header.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. <cwg-notice />
  12. <view class="pc-header-btn" @click="openRightDrawer">
  13. <cwg-icon name="icon_my" color="#141d22" />
  14. </view>
  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 openNotice() {
  38. uni.$emit('open-notice-drawer')
  39. }
  40. function openLeftDrawer() {
  41. emit('open-left-drawer');
  42. }
  43. </script>
  44. <style scoped lang="scss">
  45. .cwg-pc-header {
  46. display: flex;
  47. align-items: center;
  48. justify-content: space-between;
  49. width: 100vw;
  50. height: px2rpx(55);
  51. background-color: rgba(255, 255, 255, 0.9);
  52. border-bottom: 1px solid #f0f0f0;
  53. padding: 0 px2rpx(16);
  54. box-sizing: border-box;
  55. position: fixed;
  56. top: 0;
  57. left: 0;
  58. z-index: 10;
  59. }
  60. .left {
  61. display: flex;
  62. align-items: center;
  63. }
  64. .back-arrow {
  65. color: #e74c3c;
  66. font-size: 22px;
  67. cursor: pointer;
  68. margin-right: 16px;
  69. }
  70. .center {
  71. flex: 1;
  72. }
  73. .right {
  74. display: flex;
  75. align-items: center;
  76. }
  77. .bell .dot {
  78. position: absolute;
  79. top: 0;
  80. right: -2px;
  81. width: 7px;
  82. height: 7px;
  83. background: #27ae60;
  84. border-radius: 50%;
  85. display: inline-block;
  86. }
  87. .left-img {
  88. width: px2rpx(120);
  89. }
  90. .avatar .img {
  91. width: 32px;
  92. height: 32px;
  93. border-radius: 50%;
  94. background: #eee;
  95. }
  96. .logo .img {
  97. width: 36px;
  98. height: 36px;
  99. border-radius: 50%;
  100. background: #fff;
  101. }
  102. </style>