position.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <view class="defaultBgc">
  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.citupro.com/dev/static/nodata.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 queryParams = ref({
  21. pageSize: 10,
  22. pageNo: 1
  23. })
  24. const items = ref([])
  25. const getList = async () => {
  26. const { data } = await getJobFavoriteList(queryParams.value)
  27. const list = data?.list || []
  28. if (list?.length) {
  29. list.forEach(e => {
  30. e.job = { ...e.job, ...dealDictObjData({}, e.job) }
  31. e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
  32. })
  33. items.value = items.value.concat(list)
  34. }
  35. status.value = items.value?.length === +data.total ? 'noMore' : 'more'
  36. }
  37. getList()
  38. const loadingMore = () => {
  39. status.value = 'loading'
  40. queryParams.value.pageNo++
  41. getList()
  42. }
  43. </script>
  44. <style scoped lang="scss">
  45. </style>