left-window.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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 { useMenuSplit } from '@/composables/useMenuSplit'
  39. const { menus, setSubmenuRef, setMode, handleClick, handleSubmenuClick, mode } = useMenuSplit()
  40. // 固定菜单项点击事件
  41. function handleFixedMenuClick() {
  42. // 这里可以添加固定菜单的点击处理逻辑
  43. console.log('Fixed menu clicked')
  44. }
  45. </script>
  46. <style scoped lang="scss">
  47. @import "@/uni.scss";
  48. .cwg-sidebar {
  49. width: 100%;
  50. color: #6c8595;
  51. height: calc(100vh - 56px);
  52. overflow: hidden;
  53. display: flex;
  54. flex-direction: column;
  55. align-items: center;
  56. padding: px2rpx(8);
  57. padding-top: px2rpx(20);
  58. padding-bottom: px2rpx(8);
  59. box-sizing: border-box;
  60. gap: px2rpx(8);
  61. border-right: 1px solid rgba(108, 133, 149, 0.12);
  62. .logo {
  63. width: px2rpx(54);
  64. }
  65. .menu-list {
  66. flex: 1;
  67. width: 100%;
  68. overflow-y: auto;
  69. display: flex;
  70. flex-direction: column;
  71. gap: px2rpx(8);
  72. }
  73. .submenu-box {
  74. width: 100%;
  75. height: 0;
  76. overflow: hidden;
  77. }
  78. .menu {
  79. width: 100%;
  80. position: relative;
  81. display: flex;
  82. flex-direction: column;
  83. align-items: center;
  84. box-sizing: border-box;
  85. }
  86. .menu-item {
  87. width: 100%;
  88. height: px2rpx(40);
  89. cursor: pointer;
  90. display: flex;
  91. align-items: center;
  92. justify-content: space-between;
  93. gap: px2rpx(8);
  94. padding: px2rpx(10);
  95. box-sizing: border-box;
  96. font-size: 14px;
  97. .menu-label {
  98. flex: 1;
  99. }
  100. &:hover {
  101. background: rgba(108, 133, 149, 0.12) !important;
  102. border: 1px solid rgb(145, 163, 176) !important;
  103. border-radius: px2rpx(4);
  104. }
  105. .expanded .icon {
  106. transform: rotate(180deg);
  107. }
  108. }
  109. .ib-box {
  110. background: rgba(140, 69, 246, 0.08) !important;
  111. border: 1px solid rgba(140, 69, 246, 0.2) !important;
  112. font-size: px2rpx(18);
  113. font-weight: 600;
  114. color: #141d22;
  115. &:hover {
  116. background: rgba(140, 69, 246, 0.08) !important;
  117. border: 1px solid rgba(140, 69, 246, 0.2) !important;
  118. }
  119. }
  120. .zy-box {
  121. display: flex;
  122. align-items: center;
  123. justify-content: center;
  124. }
  125. .fixed {
  126. position: relative;
  127. width: 100%;
  128. display: flex;
  129. align-items: center;
  130. justify-content: center;
  131. gap: px2rpx(8);
  132. }
  133. }
  134. @media screen and (max-width: 1100px) {
  135. .cwg-sidebar:not(:hover) .menu-label,
  136. .cwg-sidebar:not(:hover) .submenu-box,
  137. .cwg-sidebar:not(:hover) .chevron-icon {
  138. display: none;
  139. }
  140. .cwg-sidebar:hover .menu-label,
  141. .cwg-sidebar:hover .submenu-box,
  142. .cwg-sidebar:hover .chevron-icon {
  143. display: block;
  144. }
  145. .cwg-sidebar .fixed {
  146. display: flex;
  147. }
  148. }
  149. </style>