index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <div class="parent" @click="layoutClick">
  3. <NavBar class="headers"></NavBar>
  4. <div class="content">
  5. <router-view :key="router.currentRoute.value.path + Math.random()"></router-view>
  6. <!-- <router-view v-slot="{ Component }">
  7. <keep-alive>
  8. <component :is="Component" :key="router.currentRoute.value.path" v-if="router.currentRoute.value.meta?.keepAlive"/>
  9. </keep-alive>
  10. <component :is="Component" :key="router.currentRoute.value.path" v-if="!router.currentRoute.value.meta?.keepAlive"/>
  11. </router-view> -->
  12. </div>
  13. <Footers v-if="footerWhiteList.indexOf(router.currentRoute.value.path) === -1" :class="{'mt-10': !router.currentRoute.value.path.includes('/mall')}"></Footers>
  14. <Slider v-if="whiteList.indexOf(router.currentRoute.value.path) === -1" class="slider"></Slider>
  15. </div>
  16. </template>
  17. <script setup>
  18. defineOptions({ name: 'personal-layout-index' })
  19. import { onMounted, watch } from 'vue'
  20. import NavBar from './personal/navBar.vue'
  21. import Footers from './personal/footer.vue'
  22. import Slider from './personal/slider.vue'
  23. import { useSharedState } from '@/store/sharedState'
  24. import { useRouter } from 'vue-router'
  25. import { useMallStore } from '@/store/mall'
  26. // 不展示侧边栏名单
  27. const whiteList = ['/login', '/privacyPolicy', '/userAgreement', '/register', '/recruit/personal/advertisement/introduce']
  28. // 不展示页脚白名单
  29. const footerWhiteList = [
  30. '/recruit/personal/message',
  31. '/recruit/personal/advertisement/introduce',
  32. '/about',
  33. '/headhunting',
  34. '/headhunting/service',
  35. '/headhunting/service/details',
  36. '/recruit/personal/resume/analysis'
  37. ]
  38. const router = useRouter()
  39. const sharedState = useSharedState()
  40. const layoutClick = () => {
  41. sharedState.increment()
  42. }
  43. onMounted(async () => {
  44. await useMallStore().getMallDiyTemplate()
  45. })
  46. </script>
  47. <style lang="scss" scoped>
  48. .parent {
  49. background-color: var(--default-bgc);
  50. position: relative;
  51. }
  52. .headers {
  53. position: fixed;
  54. right: 0;
  55. left: 0;
  56. top: 0;
  57. z-index: 999;
  58. }
  59. .slider {
  60. position: fixed;
  61. bottom: 50%;
  62. right: 24px;
  63. translate: 0 50%;
  64. z-index: 999;
  65. }
  66. .content {
  67. min-height: calc(100vh - 242px);
  68. margin-top: 50px;
  69. }
  70. </style>