enterprise.vue 4.7 KB

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