index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. <!-- 条件搜索 -->
  12. <uni-search-bar
  13. v-model="query.name"
  14. radius="5"
  15. placeholder="投递人姓名"
  16. cancelButton="none"
  17. :focus="false"
  18. @clear="handleSearch('name', null)"
  19. @confirm="handleSearch('name', query.name)"
  20. ></uni-search-bar>
  21. <view style="padding: 0 10px;">
  22. <FilterList :list="filterList" idValue="label" labelWidth="93%" :paddingBottom="10" @change="handleSearch"></FilterList>
  23. </view>
  24. </view>
  25. <scroll-view class="scrollBox" :scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
  26. <CardItem v-if="items?.length" :items="items" :current="tabList[current].value" @refresh="handleRefresh" />
  27. <uni-load-more :status="more" />
  28. </scroll-view>
  29. </view>
  30. </template>
  31. <script setup>
  32. import { ref } from 'vue'
  33. import { timesTampChange } from '@/utils/date'
  34. import { dealDictObjData } from '@/utils/position'
  35. import CardItem from './item.vue'
  36. import FilterList from '@/components/FilterList'
  37. import { getInterviewInvitePage } from '@/api/interview'
  38. import { getPersonCvPage, personCvUnfitPage } from '@/api/resume'
  39. import { getJobFairList } from '@/api/jobFair'
  40. import { getJobAdvertised } from '@/api/search'
  41. import { onLoad } from '@dcloudio/uni-app'
  42. const filterList = ref([
  43. { label: '投递职位',key: 'jobId', dataLabel: 'name', dataValue: 'id', api: getJobAdvertised, isFormatText: true },
  44. { label: '招聘会', key: 'jobFairId', dataLabel: 'title', dataValue: 'id', isRichText: true, api: getJobFairList },
  45. { label: '最高学历', dictType: 'menduner_education_type', key: 'eduType' },
  46. { label: '工作经验', dictType: 'menduner_exp_type', key: 'expType' },
  47. { label: '求职状态', dictType: 'menduner_job_seek_status', key: 'jobStatus' }
  48. ])
  49. const current = ref(0)
  50. const tabList = ref([
  51. { label: '投递简历', value: 0, api: getPersonCvPage, status: null },
  52. { label: '已邀约', value: 1, api: getInterviewInvitePage, status: '0' },
  53. { label: '已入职', value: 2, api: getInterviewInvitePage, status: '1' },
  54. { label: '已结算', value: 3, api: getInterviewInvitePage, status: '2' },
  55. { label: '不合适', value: 4, api: personCvUnfitPage },
  56. ])
  57. const more = ref('more')
  58. const total = ref(0)
  59. const items = ref([])
  60. const query = ref({
  61. pageNo: 1,
  62. pageSize: 10,
  63. type: null,
  64. status: null,
  65. name: null
  66. })
  67. // 获取牛人列表
  68. const getList = async () => {
  69. more.value = 'loading'
  70. const api = tabList.value[current.value].api
  71. if (current.value !== 0) {
  72. query.value.conversationStatus = tabList.value[current.value].status
  73. delete query.value.status
  74. delete query.value.type
  75. }
  76. try {
  77. const { data } = await api(query.value)
  78. const { list, total: number } = data
  79. if (!list.length) {
  80. more.value = 'noMore'
  81. return
  82. }
  83. total.value = number
  84. const arr = list.map(e => {
  85. let obj = e
  86. if (e.person) obj.person = Object.assign(e.person, dealDictObjData({}, e.person))
  87. obj.job = Object.assign(e.job, dealDictObjData({}, e.job))
  88. obj.createTime = timesTampChange(e.createTime, 'Y-M-D h:m')
  89. return obj
  90. })
  91. items.value = items.value.concat(arr)
  92. if (items.value.length === +number) {
  93. more.value = 'noMore'
  94. return
  95. }
  96. } catch {
  97. query.value.pageNo--
  98. more.value = 'more'
  99. }
  100. }
  101. onLoad((options) => {
  102. if (options?.jobId) {
  103. query.value.jobId = options.jobId
  104. const item = filterList.value.find(e => e.key === 'jobId')
  105. item.value = options.jobId
  106. item.name = decodeURIComponent(options.jobName)
  107. }
  108. if (options?.jobFairId) {
  109. query.value.jobFairId = options.jobFairId
  110. const item = filterList.value.find(e => e.key === 'jobFairId')
  111. item.value = options.jobFairId
  112. item.name = decodeURIComponent(options.jobFairName)
  113. }
  114. query.value.pageNo = 1
  115. getList()
  116. })
  117. const handleSearch = (key, value) => {
  118. query.value.pageNo = 1
  119. query.value[key] = value
  120. items.value = []
  121. total.value = 0
  122. getList()
  123. }
  124. const handleRefresh = () => {
  125. items.value = []
  126. total.value = 0
  127. query.value.pageNo = 1
  128. getList()
  129. }
  130. const changeControl = (e) => {
  131. current.value = e.currentIndex
  132. handleRefresh()
  133. }
  134. // 加载更多
  135. const loadingMore = () => {
  136. if (more.value === 'noMore') return
  137. more.value = 'loading'
  138. query.value.pageNo++
  139. getList()
  140. }
  141. </script>
  142. <style scoped lang="scss">
  143. .box {
  144. height: 100vh;
  145. overflow: hidden;
  146. box-sizing: border-box;
  147. display: flex;
  148. flex-direction: column;
  149. }
  150. .scrollBox{
  151. flex: 1;
  152. padding-bottom: 24rpx;
  153. box-sizing: border-box;
  154. height: 0 !important;
  155. }
  156. </style>