Prechádzať zdrojové kódy

招聘端-面包屑

Xiao_123 1 rok pred
rodič
commit
3fef1cf862

+ 105 - 9
src/layout/enterprise.vue

@@ -3,8 +3,25 @@
     <Headers class="headers"></Headers>
     <div class="content d-flex">
       <side class="content-sticky" v-if="!router.currentRoute.value?.meta?.hideSide"></side>
-      <div class="pa-3 content-box">
-        <router-view></router-view>
+      <div class="content-box d-flex flex-column" :style="`width: ${ !isInWhiteList(route.path, whiteList) ? 'calc(100vw - 250px)' : '100%'}`">
+        <div v-if="!isInWhiteList(route.path, whiteList)" class="breadcrumbs_sticky">
+          <div class=" d-flex align-center justify-space-between">
+            <v-breadcrumbs :items="breadcrumbs" elevation="3">
+              <template v-slot:item="{ item }">
+                <span class="text" :class="{active: !item.disabled}" @click="toPath(item)">{{ item.text }}</span>
+              </template>
+            </v-breadcrumbs>
+          </div>
+          <v-divider></v-divider>
+        </div>
+        <div class="box pa-3">
+          <div v-if="!isInWhiteList(route.path, whiteList)" class="box-content">
+            <router-view></router-view>
+          </div>
+          <div v-else class="full">
+            <router-view></router-view>
+          </div>
+        </div>
       </div>
     </div>
     <Slider class="slider"></Slider>
@@ -12,18 +29,66 @@
 </template>
 
 <script setup>
+defineOptions({ name: 'enterprise-layout-index' })
 import Headers from './company/navBar.vue'
 import Slider from './company/slider.vue'
 import side from './company/side.vue'
-import { useRouter } from 'vue-router'
-defineOptions({ name: 'enterprise-layout-index' })
+import { useRouter, useRoute } from 'vue-router'
+import { watch, ref } from 'vue'
+
 const router = useRouter()
+const route = useRoute()
+
+const whiteList = [
+  '/enterprise/talentPool/details',
+  '/enterprise/position/details',
+  '/enterprise/purchasePackage'
+]
+// 查询是否在白名单内,在则不展示面包屑
+const isInWhiteList = (url, whiteList)=> {
+  const path = url.split('?')[0]
+  for (const item of whiteList) {
+    if (path.startsWith(item)) {
+      return true
+    }
+  }
+  return false
+}
+
+const breadcrumbs = ref([])
+const getTitle = (list) => {
+  const arr = list.map((item, index) => {
+    if (item.path === list[index - 1]?.path) return false
+    const text = item.meta.title
+    const obj = { text,  to: item.path }
+    return obj
+  }).filter(e => e)
+  arr[arr.length - 1].disabled = true
+  arr[arr.length - 1].link = true
+  breadcrumbs.value = arr
+}
+
+watch(
+  () => route.matched,
+  (val) => {
+    getTitle(val)
+  },
+  { immediate: true },
+  { deep: true }
+)
+
+const toPath = ({ disabled, to }) => {
+  if (disabled) {
+    event.preventDefault()
+    return
+  }
+  router.push(to)
+}
 </script>
 
 <style lang="scss" scoped>
 $top: 50px;
 .parent {
-  // height: 100vh;
   background-color: var(--default-bgc);
 }
 .headers {
@@ -31,6 +96,26 @@ $top: 50px;
   top: 0;
   z-index: 999;
 }
+.box {
+  height: 0;
+  flex: 1;
+  height: calc(100vh - 50px);
+  &-content {
+    width: 100%;
+    min-height: 100%;
+    position: relative;
+    overflow-y: auto;
+    overflow-x: hidden;
+  }
+}
+.full {
+  height: calc(100vh - $top);
+  width: 100%;
+  flex: 1;
+  position: relative;
+  overflow-y: auto;
+  overflow-x: hidden;
+}
 .slider {
   position: fixed;
   bottom: 50%;
@@ -41,9 +126,6 @@ $top: 50px;
 .content {
   height: 0;
   flex: 1;
-  &-box {
-    width: 100%;
-  }
 
   &-sticky {
     position: sticky;
@@ -51,5 +133,19 @@ $top: 50px;
     height: calc(100vh - $top);
   }
 }
-
+.breadcrumbs_sticky {
+  position: sticky;
+  top: $top;
+  background: #FFF;
+  z-index: var(--zIndex-breadcrumbs);
+  border-left: 1px solid #eaecef;
+}
+.text {
+  color: #999;
+  font-size: 14px;
+  &.active {
+    color: #00897B;
+    cursor: pointer;
+  }
+}
 </style>

+ 6 - 3
src/router/modules/enterprise.js

@@ -38,6 +38,7 @@ const enterprise = [
     path: '/enterprise/statistics',
     component: Layout,
     name: 'enterpriseStatistics',
+    redirect: '/enterprise/statistics/overallAnalysis',
     meta: {
       title: '统计分析',
       enName: 'Statistics',
@@ -92,7 +93,8 @@ const enterprise = [
         path: '/enterprise/position/details/:id',
         show: true,
         meta: {
-          title: '职位详情'
+          title: '职位详情',
+          hideSide: true
         },
         component: () => import('@/views/enterprise/positionManagement/components/details.vue')
       }
@@ -182,7 +184,7 @@ const enterprise = [
   {
     path: '/enterprise/systemManagement',
     component: Layout,
-    redirect: '/enterprise/systemManagement/userManagement/index.vue',
+    redirect: '/enterprise/systemManagement/userManagement',
     name: 'systemManagement',
     meta: {
       title: '系统管理',
@@ -204,7 +206,7 @@ const enterprise = [
   {
     path: '/enterprise/memberCenter',
     component: Layout,
-    redirect: '/enterprise/memberCenter/myAccount/index.vue',
+    redirect: '/enterprise/memberCenter/myAccount',
     name: 'enterpriseMemberCenter',
     meta: {
       title: '会员中心',
@@ -236,6 +238,7 @@ const enterprise = [
     component: Layout,
     name: 'enterpriseCenter',
     show: true,
+    redirect: '/enterprise/enterpriseCenter',
     meta: {
       title: '企业中心'
     },

+ 1 - 0
src/styles/index.css

@@ -8,6 +8,7 @@
   --v-primary-lighten3: #80CBC4;
   --v-primary-lighten4: #B2DFDB;
   --default-text: #666;
+  --zIndex-breadcrumbs: 999;
 }
 
 .buttons {

+ 1 - 1
src/styles/index.min.css

@@ -1 +1 @@
-:root{--zIndex-dialog:9999;--default-bgc:#f2f4f7;--v-primary-base:#00897B;--v-error-base:#fe574a;--v-primary-lighten1:#26A69A;--v-primary-lighten2:#4DB6AC;--v-primary-lighten3:#80CBC4;--v-primary-lighten4:#B2DFDB;--default-text:#666}.buttons{height:36px;width:224px}.half-button{height:36px;width:88px}.default-width{width:1184px;min-width:1184px;max-width:1184px;margin:0 auto}.defaultLink{color:#008978;cursor:pointer}.default-active{color:var(--v-primary-base) !important}.border-bottom-dashed{border-bottom:1px dashed #ccc}.white-bgc{background-color:#fff}.ellipsis{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.vline{display:inline-block;width:1px;height:10px;vertical-align:middle;background-color:#e0e0e0;margin:0 10px}.resume-box{border-radius:5px;padding:20px 30px;background-color:#fff}.resume-header{display:flex;justify-content:space-between;align-items:center;height:36px}.resume-title{font-weight:700;font-size:18px;border-left:5px solid #00897B;padding-left:12px;line-height:17px}.resumeNoDataText{color:#666;font-size:14px}.card-box{width:100%;height:100%}
+:root{--zIndex-dialog:9999;--default-bgc:#f2f4f7;--v-primary-base:#00897B;--v-error-base:#fe574a;--v-primary-lighten1:#26A69A;--v-primary-lighten2:#4DB6AC;--v-primary-lighten3:#80CBC4;--v-primary-lighten4:#B2DFDB;--default-text:#666;--zIndex-breadcrumbs:999}.buttons{height:36px;width:224px}.half-button{height:36px;width:88px}.default-width{width:1184px;min-width:1184px;max-width:1184px;margin:0 auto}.defaultLink{color:#008978;cursor:pointer}.default-active{color:var(--v-primary-base) !important}.border-bottom-dashed{border-bottom:1px dashed #ccc}.white-bgc{background-color:#fff}.ellipsis{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.vline{display:inline-block;width:1px;height:10px;vertical-align:middle;background-color:#e0e0e0;margin:0 10px}.resume-box{border-radius:5px;padding:20px 30px;background-color:#fff}.resume-header{display:flex;justify-content:space-between;align-items:center;height:36px}.resume-title{font-weight:700;font-size:18px;border-left:5px solid #00897B;padding-left:12px;line-height:17px}.resumeNoDataText{color:#666;font-size:14px}.card-box{width:100%;height:100%}

+ 1 - 0
src/styles/index.scss

@@ -8,6 +8,7 @@
   --v-primary-lighten3: #80CBC4;
   --v-primary-lighten4: #B2DFDB;
   --default-text: #666;
+  --zIndex-breadcrumbs: 999;
 }
 
 // 长按钮

+ 1 - 1
src/views/enterprise/positionManagement/components/details.vue

@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div class="default-width mb-5">
     <div class="banner px-6">
       <div class="banner-title">
         <h1 class="ellipsis">{{ info.name }}</h1>