index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <view class="box defaultBgc">
  3. <view style="background-color: #fff;">
  4. <uni-segmented-control
  5. :current="current"
  6. :values="tabList.map(e => e.label)"
  7. @clickItem="changeControl"
  8. styleType="text"
  9. activeColor="#00B760"
  10. ></uni-segmented-control>
  11. </view>
  12. <scroll-view class="scrollBox" :scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
  13. <CardItem v-if="items?.length" :items="items" :current="tabList[current].value" @refresh="handleRefresh" />
  14. <uni-load-more :status="more" />
  15. </scroll-view>
  16. </view>
  17. </template>
  18. <script setup>
  19. import { ref } from 'vue'
  20. import { timesTampChange } from '@/utils/date'
  21. import { dealDictObjData } from '@/utils/position'
  22. import CardItem from './item.vue'
  23. import { getPersonCvPage, getInterviewInvitePage, personCvUnfitPage } from '@/api/resume'
  24. const current = ref(0)
  25. const tabList = ref([
  26. { label: '投递简历', value: 0, api: getPersonCvPage, status: null },
  27. { label: '已邀约', value: 1, api: getInterviewInvitePage, status: '0' },
  28. { label: '已入职', value: 2, api: getInterviewInvitePage, status: '1' },
  29. { label: '已结算', value: 3, api: getInterviewInvitePage, status: '2' },
  30. { label: '不合适', value: 4, api: personCvUnfitPage },
  31. ])
  32. const more = ref('more')
  33. const total = ref(0)
  34. const items = ref([])
  35. const query = ref({
  36. pageNo: 1,
  37. pageSize: 10,
  38. type: null,
  39. status: null,
  40. })
  41. // 获取牛人列表
  42. const getList = async () => {
  43. more.value = 'loading'
  44. const api = tabList.value[current.value].api
  45. if (current.value !== 0) {
  46. query.value.conversationStatus = tabList.value[current.value].status
  47. delete query.value.status
  48. delete query.value.type
  49. }
  50. try {
  51. const { data } = await api(query.value)
  52. const { list, total: number } = data
  53. if (!list.length) {
  54. more.value = 'noMore'
  55. return
  56. }
  57. total.value = number
  58. const arr = list.map(e => {
  59. let obj = e
  60. if (e.person) obj.person = Object.assign(e.person, dealDictObjData({}, e.person))
  61. obj.job = Object.assign(e.job, dealDictObjData({}, e.job))
  62. obj.createTime = timesTampChange(e.createTime, 'Y-M-D h:m')
  63. return obj
  64. })
  65. items.value = items.value.concat(arr)
  66. if (items.value.length === +number) {
  67. more.value = 'noMore'
  68. return
  69. }
  70. } catch {
  71. query.value.pageNo--
  72. more.value = 'more'
  73. }
  74. }
  75. getList()
  76. const handleRefresh = () => {
  77. items.value = []
  78. total.value = 0
  79. query.value.pageNo = 1
  80. getList()
  81. }
  82. const changeControl = (e) => {
  83. current.value = e.currentIndex
  84. handleRefresh()
  85. }
  86. // 加载更多
  87. const loadingMore = () => {
  88. if (more.value === 'noMore') return
  89. more.value = 'loading'
  90. query.value.pageNo++
  91. getList()
  92. }
  93. </script>
  94. <style scoped lang="scss">
  95. .box {
  96. height: 100vh;
  97. overflow: hidden;
  98. box-sizing: border-box;
  99. display: flex;
  100. flex-direction: column;
  101. }
  102. .scrollBox{
  103. flex: 1;
  104. padding-bottom: 24rpx;
  105. box-sizing: border-box;
  106. height: 0 !important;
  107. }
  108. </style>