index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <div class="pt-3 d-flex parent">
  3. <v-card class="left">
  4. <v-list 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. ></v-list-item>
  38. </v-list-group>
  39. </template>
  40. </v-list>
  41. </v-card>
  42. <v-card class="ml-3 pa-3 page">
  43. <router-view></router-view>
  44. </v-card>
  45. </div>
  46. </template>
  47. <script setup>
  48. defineOptions({ name: 'person-center'})
  49. import { computed } from 'vue'
  50. import { getCurrentLocaleLang } from '@/utils/lang.js'
  51. import personCenterRoute from '@/router/modules/components/recruit/personCenter'
  52. import { useUserStore } from '@/store/user'
  53. const info = localStorage.getItem('baseInfo') ? JSON.parse(localStorage.getItem('baseInfo')) : {}
  54. const menuHide = { // 是否隐藏
  55. studentInformation: (info?.type && Number(info.type) !== 1) // 学生信息管理。 type:0是求职者,1是学生
  56. }
  57. // 左侧菜单列表
  58. const list = computed(() => {
  59. return getList(personCenterRoute[0].children[0].children)
  60. })
  61. console.log(import.meta.env.VITE_NODE_ENV, '当前环境变量===========')
  62. const getList = (arr, obj = []) => {
  63. arr.forEach(element => {
  64. if (element.show) return
  65. if (menuHide[element.permissionName]) return
  66. let data = {}
  67. data = {
  68. title: element?.meta?.title,
  69. enName: element?.meta?.enName,
  70. icon: element?.meta?.icon,
  71. name: element?.name,
  72. path: element?.path,
  73. children: []
  74. }
  75. if (element?.children) {
  76. getList(element.children, data.children)
  77. }
  78. obj.push(data)
  79. })
  80. // 生产环境暂时不展示收货地址
  81. if (import.meta.env.VITE_NODE_ENV === 'production') obj = obj.filter(e => e.path !== '/recruit/personal/personalCenter/shippingAddress')
  82. return obj
  83. }
  84. const userStore = useUserStore()
  85. // 更新账户信息
  86. const updateAccountInfo = async () => {
  87. await userStore.getUserAccountInfo()
  88. }
  89. updateAccountInfo()
  90. </script>
  91. <style scoped lang="scss">
  92. .parent {
  93. width: 1300px;
  94. max-width: 1300px;
  95. min-width: 1300px;
  96. margin: 0 auto;
  97. height: calc(100vh - 100px);
  98. overflow-y: auto;
  99. }
  100. .page {
  101. flex: 1;
  102. width: 100%;
  103. overflow-y: auto;
  104. overflow-x: hidden;
  105. }
  106. .left {
  107. position: sticky;
  108. width: 220px;
  109. height: calc(100vh - 113px);
  110. overflow-y: auto;
  111. }
  112. .title {
  113. color: var(--color-333);
  114. font-weight: 600;
  115. font-size: 20px;
  116. }
  117. ::-webkit-scrollbar {
  118. width: 6px;
  119. height: 10px;
  120. }
  121. ::-webkit-scrollbar-thumb, .temporaryAdd ::-webkit-scrollbar-thumb, .details_edit ::-webkit-scrollbar-thumb {
  122. // 滚动条-颜色
  123. background: #c3c3c379;
  124. }
  125. ::-webkit-scrollbar-track, .temporaryAdd ::-webkit-scrollbar-track, .details_edit ::-webkit-scrollbar-track {
  126. // 滚动条-底色
  127. background: #e5e5e58f;
  128. }
  129. </style>