left.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <script lang='ts' setup>
  2. import defaultAvatar from '~/assets/icons/user.svg'
  3. import { useUserStore } from '~/stores/modules/user'
  4. const userStore = useUserStore()
  5. const { avatar, nickname } = storeToRefs(userStore)
  6. const route = useRoute()
  7. const activeMenu = ref('')
  8. const menus = [
  9. { icon: 'dashboard', title: 'Dashboard', path: '/account/panel' },
  10. { icon: 'rfqs', title: 'RFQs', path: '/account/rfqs' },
  11. { icon: 'favourite', title: 'Favourites', path: '/account/favourites', query: 'tab=products' },
  12. { icon: 'order', title: 'Orders', path: '/account/orders', query: 'tab=submitted' },
  13. // { icon: 'message', title: 'Messages', path: '/account/messages' },
  14. { icon: 'notice', title: 'Notice', path: '/account/notice' },
  15. { icon: 'setting', title: 'Settings', path: '/account/settings', query: 'tab=profile' },
  16. ]
  17. watch(() => route.path, (path) => {
  18. activeMenu.value = path
  19. }, {
  20. immediate: true,
  21. deep: true,
  22. })
  23. </script>
  24. <template>
  25. <div class="py-30px px-20px">
  26. <div class="mb-40px">
  27. <div class="flex justify-center">
  28. <img v-if="avatar" :src="avatar" class="w-60px h-60px b-rd-50% mb-10px" alt="" srcset="">
  29. <svgo-user v-else class="!w-60px !h-60px b-rd-50%" />
  30. </div>
  31. <div class="mt-16px mb-10px text-#111 overflow-hidden text-ellipsis line-clamp-1'">
  32. {{ nickname }}
  33. </div>
  34. <!-- <div class="text-#D98808 flex items-center justify-center">
  35. <img src="~/assets/images/my_vip.png" class="w-20px h-16px mr-4px" alt="" srcset="">
  36. V1
  37. </div> -->
  38. </div>
  39. <el-menu :default-active="activeMenu" class="el-menu-vertical-my">
  40. <el-menu-item v-for="item in menus" :key="item.path" :index="item.path">
  41. <el-icon>
  42. <business-account-icon-group :icon="item.icon" />
  43. </el-icon>
  44. <template #title>
  45. <nuxt-link :to="`${item.path}${item.query ? `?${item.query}` : ''}`" class="ml-4px">
  46. {{ item.title }}
  47. </nuxt-link>
  48. </template>
  49. </el-menu-item>
  50. </el-menu>
  51. </div>
  52. </template>
  53. <style lang='less' scoped>
  54. .el-menu-vertical-my {
  55. .el-menu-item {
  56. padding-left: unset !important;
  57. padding-right: unset !important;
  58. color: #999!important;
  59. background-color: #FAFAFA;
  60. &:hover{
  61. color:#C58C64!important;
  62. background-color: #FAFAFA!important;
  63. }
  64. a {
  65. color: #999999;
  66. font-size: 18px;
  67. &:hover{
  68. color: #C58C64!important;
  69. }
  70. }
  71. &.is-active {
  72. color: #C58C64!important;
  73. a {
  74. color: #C58C64;
  75. &.router-link-active {
  76. color:#C58C64;
  77. }
  78. }
  79. }
  80. }
  81. }
  82. </style>