enterprise.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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="system.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. import { useSystem } from '@/store/system'
  38. const router = useRouter()
  39. const route = useRoute()
  40. const system = useSystem()
  41. const key = computed(() => {
  42. return route.path + Math.random()
  43. })
  44. const whiteList = [
  45. '/recruit/enterprise/resumeManagement/talentPool/details/details',
  46. '/recruit/enterprise/talentPool/details',
  47. '/recruit/enterprise/purchasePackage',
  48. '/recruit/enterprise/position/details',
  49. '/recruit/enterprise/systemManagement/groupAccount/invite/0',
  50. '/recruit/enterprise/systemManagement/groupAccount/invite/1'
  51. ]
  52. // 查询是否在白名单内,在则不展示面包屑
  53. const isInWhiteList = (url, whiteList)=> {
  54. const path = url.split('?')[0]
  55. for (const item of whiteList) {
  56. if (path.startsWith(item)) {
  57. return true
  58. }
  59. }
  60. return false
  61. }
  62. // const breadcrumbs = ref([])
  63. // const getTitle = (list, fullPath) => {
  64. // const _fullPath = fullPath.split('/')
  65. // const arr = list.map((item, index) => {
  66. // // 重组路径
  67. // if (item.path === list[index - 1]?.path) return false
  68. // const text = item.meta.title
  69. // const _path = item.path.split('/')
  70. // const obj = {
  71. // text,
  72. // to: _path.map((e, i) => _fullPath[i]).join('/')
  73. // }
  74. // return obj
  75. // }).filter(e => e) || []
  76. // if (arr?.length) {
  77. // arr[arr.length - 1].disabled = true
  78. // arr[arr.length - 1].link = true
  79. // }
  80. // breadcrumbs.value = arr
  81. // }
  82. watch(
  83. () => route.matched,
  84. (val) => {
  85. // getTitle(val, route.fullPath)
  86. system.setBreadcrumbs(val, route.fullPath)
  87. },
  88. { immediate: true },
  89. { deep: true }
  90. )
  91. const toPath = (item) => {
  92. const { disabled, to } = item
  93. if (disabled) {
  94. event.preventDefault()
  95. return
  96. }
  97. router.push(to)
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. $top: 50px;
  102. .parent {
  103. background-color: var(--default-bgc);
  104. }
  105. .headers {
  106. position: sticky;
  107. top: 0;
  108. z-index: 999;
  109. }
  110. .box {
  111. height: 0;
  112. flex: 1;
  113. height: calc(100vh - 50px);
  114. &-content {
  115. width: 100%;
  116. min-height: 100%;
  117. position: relative;
  118. overflow-y: auto;
  119. overflow-x: hidden;
  120. }
  121. }
  122. .full {
  123. height: calc(100vh - $top);
  124. width: 100%;
  125. flex: 1;
  126. position: relative;
  127. overflow-y: auto;
  128. overflow-x: hidden;
  129. }
  130. .slider {
  131. position: fixed;
  132. bottom: 50%;
  133. right: 24px;
  134. translate: 0 50%;
  135. z-index: 999;
  136. }
  137. .content {
  138. height: 0;
  139. flex: 1;
  140. &-sticky {
  141. position: sticky;
  142. top: $top;
  143. height: calc(100vh - $top);
  144. }
  145. }
  146. .breadcrumbs_sticky {
  147. position: sticky;
  148. top: $top;
  149. background: #FFF;
  150. z-index: var(--zIndex-breadcrumbs);
  151. border-left: 1px solid #eaecef;
  152. }
  153. .text {
  154. color: var(--color-999);
  155. font-size: 14px;
  156. &.active {
  157. color: var(--v-primary-base);
  158. cursor: pointer;
  159. }
  160. }
  161. /* 滚动条样式 */
  162. ::-webkit-scrollbar {
  163. -webkit-appearance: none;
  164. width: 0px;
  165. height: 0px;
  166. }
  167. /* 滚动条内的轨道 */
  168. ::-webkit-scrollbar-track {
  169. background: rgba(0, 0, 0, 0.1);
  170. border-radius: 0;
  171. }
  172. /* 滚动条内的滑块 */
  173. ::-webkit-scrollbar-thumb {
  174. cursor: pointer;
  175. border-radius: 5px;
  176. background: rgba(0, 0, 0, 0.15);
  177. transition: color 0.2s ease;
  178. }
  179. </style>