index.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <div class="parent" @click="layoutClick">
  3. <NavBar class="headers"></NavBar>
  4. <div class="content">
  5. <router-view></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 } 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. '/mall/pointExchange/records'
  38. ]
  39. const router = useRouter()
  40. const sharedState = useSharedState()
  41. const layoutClick = () => {
  42. sharedState.increment()
  43. }
  44. onMounted(async () => {
  45. await useMallStore().getMallDiyTemplate()
  46. })
  47. </script>
  48. <style lang="scss" scoped>
  49. .parent {
  50. background-color: var(--default-bgc);
  51. position: relative;
  52. }
  53. .headers {
  54. position: fixed;
  55. right: 0;
  56. left: 0;
  57. top: 0;
  58. z-index: 999;
  59. }
  60. .slider {
  61. position: fixed;
  62. bottom: 50%;
  63. right: 24px;
  64. translate: 0 50%;
  65. z-index: 999;
  66. }
  67. .content {
  68. min-height: calc(100vh - (48px + 225px));
  69. margin-top: 50px;
  70. }
  71. </style>