index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <div class="pt-3 d-flex parent">
  3. <v-card class="left">
  4. <v-list class="side-box" color="primary">
  5. <v-list-subheader class="title mb-3">个人中心</v-list-subheader>
  6. <v-divider></v-divider>
  7. <template v-for="(item, index) in list">
  8. <template v-if="!item.children.length">
  9. <v-list-item
  10. :key="`${item.name}_${index}`"
  11. active-class="active"
  12. color="primary"
  13. :href="item.path"
  14. :to="item.path"
  15. :prepend-icon="item.icon"
  16. :title="getCurrentLocaleLang() === 'zh_CN' ? item.title : item.enName"
  17. >
  18. </v-list-item>
  19. </template>
  20. <v-list-group
  21. v-else
  22. color="primary"
  23. :key="`${item.path}_${item.title}`"
  24. :prepend-icon="item.icon"
  25. >
  26. <template v-slot:activator="{ props }">
  27. <v-list-item v-bind="props" :title="getCurrentLocaleLang() === 'zh_CN' ? item.title : item.enName"></v-list-item>
  28. </template>
  29. <v-list-item
  30. v-for="(val, i) in item.children"
  31. :key="i"
  32. color="primary"
  33. :href="val.path"
  34. style="padding-left: 40px;"
  35. :to="val.path"
  36. :title="getCurrentLocaleLang() === 'zh_CN' ? val.title : val.enName"
  37. :value="val.path"
  38. ></v-list-item>
  39. </v-list-group>
  40. </template>
  41. </v-list>
  42. </v-card>
  43. <v-card class="ml-3 pa-3 page">
  44. <router-view></router-view>
  45. </v-card>
  46. </div>
  47. </template>
  48. <script setup>
  49. defineOptions({ name: 'person-center'})
  50. import { computed } from 'vue'
  51. import { getCurrentLocaleLang } from '@/utils/lang.js'
  52. import { useUserStore } from '@/store/user'
  53. import personCenterRoute from '@/router/modules/components/recruit/personCenter'
  54. // 左侧菜单列表
  55. const list = computed(() => {
  56. return getList(personCenterRoute[0].children[0].children)
  57. })
  58. const getList = (arr, obj = []) => {
  59. arr.forEach(element => {
  60. if (element.show) return
  61. let data = {}
  62. data = {
  63. title: element?.meta?.title,
  64. enName: element?.meta?.enName,
  65. icon: element?.meta?.icon,
  66. name: element?.name,
  67. path: element?.path,
  68. children: []
  69. }
  70. if (element?.children) {
  71. getList(element.children, data.children)
  72. }
  73. obj.push(data)
  74. })
  75. return obj
  76. }
  77. // 更新账户信息
  78. const store = useUserStore()
  79. const updateAccountInfo = async () => {
  80. await store.getUserAccountInfo()
  81. }
  82. updateAccountInfo()
  83. </script>
  84. <style scoped lang="scss">
  85. .parent {
  86. width: 1300px;
  87. max-width: 1300px;
  88. min-width: 1300px;
  89. margin: 0 auto;
  90. height: calc(100vh - 100px);
  91. overflow-y: auto;
  92. }
  93. .page {
  94. flex: 1;
  95. width: 100%;
  96. overflow-y: auto;
  97. overflow-x: hidden;
  98. }
  99. .left {
  100. position: sticky;
  101. width: 220px;
  102. height: calc(100vh - 113px);
  103. }
  104. .title {
  105. color: var(--color-333);
  106. font-weight: 600;
  107. font-size: 20px;
  108. }
  109. ::-webkit-scrollbar {
  110. width: 6px;
  111. height: 10px;
  112. }
  113. ::-webkit-scrollbar-thumb, .temporaryAdd ::-webkit-scrollbar-thumb, .details_edit ::-webkit-scrollbar-thumb {
  114. // 滚动条-颜色
  115. background: #c3c3c379;
  116. }
  117. ::-webkit-scrollbar-track, .temporaryAdd ::-webkit-scrollbar-track, .details_edit ::-webkit-scrollbar-track {
  118. // 滚动条-底色
  119. background: #e5e5e58f;
  120. }
  121. </style>