index.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. '/headhunting',
  33. '/headhunting/service',
  34. '/headhunting/service/details',
  35. '/recruit/personal/resume/analysis'
  36. ]
  37. const router = useRouter()
  38. const sharedState = useSharedState()
  39. const layoutClick = () => {
  40. sharedState.increment()
  41. }
  42. onMounted(async () => {
  43. await useMallStore().getMallDiyTemplate()
  44. })
  45. </script>
  46. <style lang="scss" scoped>
  47. .parent {
  48. background-color: var(--default-bgc);
  49. position: relative;
  50. }
  51. .headers {
  52. position: fixed;
  53. right: 0;
  54. left: 0;
  55. top: 0;
  56. z-index: 999;
  57. }
  58. .slider {
  59. position: fixed;
  60. bottom: 50%;
  61. right: 24px;
  62. translate: 0 50%;
  63. z-index: 999;
  64. }
  65. .content {
  66. min-height: calc(100vh - 242px);
  67. margin-top: 50px;
  68. }
  69. </style>