index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. <BackTop />
  16. </div>
  17. </template>
  18. <script setup>
  19. defineOptions({ name: 'personal-layout-index' })
  20. import { onMounted, watch } from 'vue'
  21. import NavBar from './personal/navBar.vue'
  22. import Footers from './personal/footer.vue'
  23. import Slider from './personal/slider.vue'
  24. import { useSharedState } from '@/store/sharedState'
  25. import { useRouter } from 'vue-router'
  26. import { useMallStore } from '@/store/mall'
  27. import BackTop from '@/components/BackTop'
  28. // 不展示侧边栏名单
  29. const whiteList = ['/login', '/privacyPolicy', '/userAgreement', '/register', '/recruit/personal/advertisement/introduce', '/contactService']
  30. // 不展示页脚白名单
  31. const footerWhiteList = [
  32. '/recruit/personal/message',
  33. '/recruit/personal/advertisement/introduce',
  34. '/headhunting',
  35. '/headhunting/service',
  36. '/headhunting/service/details',
  37. '/recruit/personal/resume/analysis',
  38. '/contactService'
  39. ]
  40. const router = useRouter()
  41. const sharedState = useSharedState()
  42. const layoutClick = () => {
  43. sharedState.increment()
  44. }
  45. onMounted(async () => {
  46. await useMallStore().getMallDiyTemplate()
  47. })
  48. </script>
  49. <style lang="scss" scoped>
  50. .parent {
  51. background-color: var(--default-bgc);
  52. position: relative;
  53. }
  54. .headers {
  55. position: fixed;
  56. right: 0;
  57. left: 0;
  58. top: 0;
  59. z-index: 999;
  60. }
  61. .slider {
  62. position: fixed;
  63. bottom: 50%;
  64. right: 24px;
  65. translate: 0 50%;
  66. z-index: 999;
  67. }
  68. .content {
  69. min-height: calc(100vh - 242px);
  70. margin-top: 50px;
  71. }
  72. </style>