detail.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <view class="page-content">
  3. <mx-nav-bar :title="overview.name"/>
  4. <mx-tabs-swiper v-model="currentTab" :tabs="tabs" border :preload="false">
  5. <template #职业介绍>
  6. <vocation-overview/>
  7. </template>
  8. <template #就业岗位>
  9. <vocation-posts v-if="posts.length"/>
  10. <uv-empty v-else margin-top="100"/>
  11. </template>
  12. </mx-tabs-swiper>
  13. </view>
  14. </template>
  15. <script setup>
  16. import {ref, onMounted} from 'vue'
  17. import {useTransfer} from "@/hooks/useTransfer";
  18. import {vocationalOverview, vocationalPosts} from "@/api/webApi/collegemajor";
  19. import VocationOverview from "@/pages/vocation-library/detail/components/vocation-overview.vue";
  20. import VocationPosts from "@/pages/vocation-library/detail/components/vocation-posts.vue";
  21. import {useProvideVocationDetailService} from "@/pages/vocation-library/detail/components/useVocationDetailInjection";
  22. const {prevData} = useTransfer()
  23. const overview = ref({})
  24. const posts = ref([])
  25. const tabs = ref([{name: '职业介绍'}, {name: '就业岗位'}])
  26. const currentTab = ref(0)
  27. const currentPostName = ref('')
  28. const scrollTop = ref(0)
  29. useProvideVocationDetailService(overview, posts, currentTab, currentPostName, scrollTop)
  30. onMounted(async () => {
  31. const res = await vocationalOverview({code: prevData.value.code})
  32. overview.value = res.data
  33. })
  34. onMounted(async () => {
  35. const res = await vocationalPosts({code: prevData.value.code})
  36. posts.value = res.data
  37. })
  38. </script>
  39. <style lang="scss">
  40. </style>