position.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <view>
  3. <scroll-view class="scrollBox" scroll-y="true" @scrolltolower="loadingMore" style="height: 100vh;">
  4. <view v-if="items.length">
  5. <PositionList class="pb-10" :list="items" :noMore="false"></PositionList>
  6. <uni-load-more :status="status" />
  7. </view>
  8. <view v-else class="nodata-img-parent">
  9. <image src="https://minio.menduner.com/dev/bb43df1dc91945e05ee93da76e49b34f87b0d10203eb76c20e2d4999a13b9a0a.png" mode="widthFix" style="width: 100vw;height: 100vh;"></image>
  10. </view>
  11. </scroll-view>
  12. </view>
  13. </template>
  14. <script setup>
  15. import { ref } from 'vue'
  16. import { getJobFavoriteList } from '@/api/user'
  17. import { dealDictObjData } from '@/utils/position'
  18. import PositionList from '@/components/PositionList'
  19. const status = ref('more')
  20. const total = ref(0)
  21. const queryParams = ref({
  22. pageSize: 10,
  23. pageNo: 1
  24. })
  25. const items = ref([])
  26. const getList = async () => {
  27. const { data } = await getJobFavoriteList(queryParams.value)
  28. const list = data?.list || []
  29. if (list?.length) {
  30. list.forEach(e => {
  31. e.job = { ...e.job, ...dealDictObjData({}, e.job) }
  32. e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
  33. })
  34. items.value = items.value.concat(list)
  35. }
  36. total.value = data?.total || 0
  37. status.value = items.value?.length === total.value ? 'noMore' : 'more'
  38. }
  39. getList()
  40. const loadingMore = () => {
  41. if (total.value <= 0) return
  42. status.value = 'loading'
  43. queryParams.value.pageNo++
  44. getList()
  45. }
  46. </script>
  47. <style scoped lang="scss">
  48. </style>