index.vue 4.7 KB

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