left-window.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <view class="cwg-sidebar">
  3. <view class="menu-list">
  4. <view class="menu" v-for="(item, index) in menus" :key="item.path + index">
  5. <view class="menu-item" @click="handleClick(index)">
  6. <cwg-icon :name="item.icon" :size="20" color="#6c8595" />
  7. <view class="menu-label" v-t="item.label" />
  8. <view class="chevron-icon" :class="{ 'expanded': item.isOpenMenu }">
  9. <cwg-icon v-if="item.children && item.children.length" name="crm-chevron-down" :size="20" color="#6c8595" />
  10. </view>
  11. </view>
  12. <view :ref="(el) => setSubmenuRef(index, el)" class="submenu-box" :a="index" :key1="item.path + index" :b="item"
  13. :style="{
  14. height: !(item.children && item.children.length) ? '0px' : item.isOpenMenu ? item.submenuHeight + 'px' : '0px',
  15. transition: 'height 281ms cubic-bezier(0.4, 0, 0.2, 1)'
  16. }" :class="{ 'active': item.isOpenMenu }">
  17. <cwg-submenu v-if="item.children && item.children.length" :submenu-items="item.children"
  18. @submenu-click="handleSubmenuClick" />
  19. </view>
  20. </view>
  21. </view>
  22. <view class="menu fixed">
  23. <view class="menu-item ib-box" @click="setMode('ib')" v-if="mode !== 'ib'">
  24. <cwg-icon name="crm-ib" :size="20" color="#6c8595" />
  25. <view class="menu-label" v-t="'Home.msg.Ib'" />
  26. </view>
  27. <view class="menu-item ib-box" @click="setMode('customer')" v-if="mode !== 'customer'">
  28. <cwg-icon name="crm-trade" :size="20" color="#6c8595" />
  29. <view class="menu-label" v-t="'Home.msg.Custom'" />
  30. </view>
  31. <view class="menu-item zy-box" @click="handleFixedMenuClick">
  32. <cwg-icon name="crm-zy" :size="20" color="#6c8595" />
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script lang="ts" setup>
  38. import { ref } from 'vue'
  39. import { useMenuSplit } from '@/composables/useMenuSplit'
  40. const { menus, setSubmenuRef, setMode, handleClick, handleSubmenuClick, mode } = useMenuSplit()
  41. // 固定菜单项点击事件
  42. function handleFixedMenuClick() {
  43. // 这里可以添加固定菜单的点击处理逻辑
  44. console.log('Fixed menu clicked')
  45. }
  46. </script>
  47. <style scoped lang="scss">
  48. @import "@/uni.scss";
  49. .cwg-sidebar {
  50. width: 100%;
  51. color: #6c8595;
  52. height: calc(100vh - 56px);
  53. overflow: hidden;
  54. display: flex;
  55. flex-direction: column;
  56. align-items: center;
  57. padding: px2rpx(8);
  58. padding-top: px2rpx(20);
  59. padding-bottom: px2rpx(8);
  60. box-sizing: border-box;
  61. gap: px2rpx(8);
  62. border-right: 1px solid rgba(108, 133, 149, 0.12);
  63. .logo {
  64. width: px2rpx(54);
  65. }
  66. .menu-list {
  67. flex: 1;
  68. width: 100%;
  69. overflow-y: auto;
  70. display: flex;
  71. flex-direction: column;
  72. gap: px2rpx(8);
  73. }
  74. .submenu-box {
  75. width: 100%;
  76. height: 0;
  77. overflow: hidden;
  78. }
  79. .menu {
  80. width: 100%;
  81. position: relative;
  82. display: flex;
  83. flex-direction: column;
  84. align-items: center;
  85. box-sizing: border-box;
  86. }
  87. .menu-item {
  88. width: 100%;
  89. height: px2rpx(40);
  90. cursor: pointer;
  91. display: flex;
  92. align-items: center;
  93. justify-content: space-between;
  94. gap: px2rpx(8);
  95. padding: px2rpx(10);
  96. box-sizing: border-box;
  97. font-size: 14px;
  98. .menu-label {
  99. flex: 1;
  100. }
  101. &:hover {
  102. background: rgba(108, 133, 149, 0.12) !important;
  103. border: 1px solid rgb(145, 163, 176) !important;
  104. border-radius: px2rpx(4);
  105. }
  106. .expanded .icon {
  107. transform: rotate(180deg);
  108. }
  109. }
  110. .ib-box {
  111. background: rgba(140, 69, 246, 0.08) !important;
  112. border: 1px solid rgba(140, 69, 246, 0.2) !important;
  113. font-size: px2rpx(18);
  114. font-weight: 600;
  115. color: #141d22;
  116. &:hover {
  117. background: rgba(140, 69, 246, 0.08) !important;
  118. border: 1px solid rgba(140, 69, 246, 0.2) !important;
  119. }
  120. }
  121. .zy-box {
  122. display: flex;
  123. align-items: center;
  124. justify-content: center;
  125. }
  126. .fixed {
  127. position: relative;
  128. width: 100%;
  129. display: flex;
  130. align-items: center;
  131. justify-content: center;
  132. gap: px2rpx(8);
  133. }
  134. }
  135. @media screen and (max-width: 1100px) {
  136. .cwg-sidebar:not(:hover) .menu-label,
  137. .cwg-sidebar:not(:hover) .submenu-box,
  138. .cwg-sidebar:not(:hover) .chevron-icon {
  139. display: none;
  140. }
  141. .cwg-sidebar:hover .menu-label,
  142. .cwg-sidebar:hover .submenu-box,
  143. .cwg-sidebar:hover .chevron-icon {
  144. display: block;
  145. }
  146. .cwg-sidebar .fixed {
  147. display: flex;
  148. }
  149. }
  150. </style>