enterprise.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <div class="parent d-flex flex-column">
  3. <Headers class="headers"></Headers>
  4. <div class="content d-flex">
  5. <side class="content-sticky" v-if="!router.currentRoute.value?.meta?.hideSide"></side>
  6. <div class="content-box d-flex flex-column" :style="`width: ${ !isInWhiteList(route.path, whiteList) ? 'calc(100vw - 230px)' : '100%'}`">
  7. <div v-if="!isInWhiteList(route.path, whiteList)" class="breadcrumbs_sticky">
  8. <div class=" d-flex align-center justify-space-between">
  9. <v-breadcrumbs :items="breadcrumbs" elevation="3">
  10. <template v-slot:item="{ item }">
  11. <span class="text" :class="{active: !item.disabled}" @click="toPath(item)">{{ item.text }}</span>
  12. </template>
  13. </v-breadcrumbs>
  14. </div>
  15. <v-divider></v-divider>
  16. </div>
  17. <div class="box pa-3">
  18. <div v-if="!isInWhiteList(route.path, whiteList)" class="box-content">
  19. <router-view :key="key"></router-view>
  20. </div>
  21. <div v-else class="full">
  22. <router-view :key="key"></router-view>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. <!-- <Slider class="slider"></Slider> -->
  28. </div>
  29. </template>
  30. <script setup>
  31. defineOptions({ name: 'enterprise-layout-index' })
  32. import Headers from './company/navBar.vue'
  33. // import Slider from './company/slider.vue'
  34. import side from './company/side.vue'
  35. import { useRouter, useRoute } from 'vue-router'
  36. import { watch, ref, computed } from 'vue'
  37. const router = useRouter()
  38. const route = useRoute()
  39. const key = computed(() => {
  40. return route.path + Math.random()
  41. })
  42. const whiteList = [
  43. '/recruit/enterprise/resumeManagement/talentPool/details/details',
  44. '/recruit/enterprise/talentPool/details',
  45. '/recruit/enterprise/purchasePackage',
  46. '/recruit/enterprise/systemManagement/groupAccount/invite/0',
  47. '/recruit/enterprise/systemManagement/groupAccount/invite/1'
  48. ]
  49. // 查询是否在白名单内,在则不展示面包屑
  50. const isInWhiteList = (url, whiteList)=> {
  51. const path = url.split('?')[0]
  52. for (const item of whiteList) {
  53. if (path.startsWith(item)) {
  54. return true
  55. }
  56. }
  57. return false
  58. }
  59. const breadcrumbs = ref([])
  60. const getTitle = (list) => {
  61. const arr = list.map((item, index) => {
  62. if (item.path === list[index - 1]?.path) return false
  63. const text = item.meta.title
  64. const obj = { text, to: item.path }
  65. return obj
  66. }).filter(e => e) || []
  67. if (arr?.length) {
  68. arr[arr.length - 1].disabled = true
  69. arr[arr.length - 1].link = true
  70. }
  71. breadcrumbs.value = arr
  72. }
  73. watch(
  74. () => route.matched,
  75. (val) => {
  76. getTitle(val)
  77. },
  78. { immediate: true },
  79. { deep: true }
  80. )
  81. const toPath = ({ disabled, to }) => {
  82. if (disabled) {
  83. event.preventDefault()
  84. return
  85. }
  86. router.push(to)
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. $top: 50px;
  91. .parent {
  92. background-color: var(--default-bgc);
  93. }
  94. .headers {
  95. position: sticky;
  96. top: 0;
  97. z-index: 999;
  98. }
  99. .box {
  100. height: 0;
  101. flex: 1;
  102. height: calc(100vh - 50px);
  103. &-content {
  104. width: 100%;
  105. min-height: 100%;
  106. position: relative;
  107. overflow-y: auto;
  108. overflow-x: hidden;
  109. }
  110. }
  111. .full {
  112. height: calc(100vh - $top);
  113. width: 100%;
  114. flex: 1;
  115. position: relative;
  116. overflow-y: auto;
  117. overflow-x: hidden;
  118. }
  119. .slider {
  120. position: fixed;
  121. bottom: 50%;
  122. right: 24px;
  123. translate: 0 50%;
  124. z-index: 999;
  125. }
  126. .content {
  127. height: 0;
  128. flex: 1;
  129. &-sticky {
  130. position: sticky;
  131. top: $top;
  132. height: calc(100vh - $top);
  133. }
  134. }
  135. .breadcrumbs_sticky {
  136. position: sticky;
  137. top: $top;
  138. background: #FFF;
  139. z-index: var(--zIndex-breadcrumbs);
  140. border-left: 1px solid #eaecef;
  141. }
  142. .text {
  143. color: var(--color-999);
  144. font-size: 14px;
  145. &.active {
  146. color: var(--v-primary-base);
  147. cursor: pointer;
  148. }
  149. }
  150. /* 滚动条样式 */
  151. ::-webkit-scrollbar {
  152. -webkit-appearance: none;
  153. width: 0px;
  154. height: 0px;
  155. }
  156. /* 滚动条内的轨道 */
  157. ::-webkit-scrollbar-track {
  158. background: rgba(0, 0, 0, 0.1);
  159. border-radius: 0;
  160. }
  161. /* 滚动条内的滑块 */
  162. ::-webkit-scrollbar-thumb {
  163. cursor: pointer;
  164. border-radius: 5px;
  165. background: rgba(0, 0, 0, 0.15);
  166. transition: color 0.2s ease;
  167. }
  168. </style>