index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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" />
  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' },
  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(async (options) => {
  102. const jobFairList = []
  103. // 招聘会列表
  104. try {
  105. const { data } = await getJobFairList()
  106. jobFairList = data.map(e => ({ label: e.title.replace(/<\/?p[^>]*>/gi, ''), value: e.id }))
  107. } catch {}
  108. if (options?.jobId) {
  109. query.value.jobId = options.jobId
  110. const item = filterList.value.find(e => e.key === 'jobId')
  111. item.value = options.jobId
  112. item.name = decodeURIComponent(options.jobName)
  113. }
  114. if (options?.jobFairId) {
  115. query.value.jobFairId = options.jobFairId
  116. const item = filterList.value.find(e => e.key === 'jobFairId')
  117. item.items = jobFairList
  118. // 招聘会存在才添加其参数
  119. if (jobFairList.find(k => k.id === options.jobFairId)) {
  120. item.value = options.jobFairId
  121. item.name = decodeURIComponent(options.jobFairName)
  122. }
  123. }
  124. query.value.pageNo = 1
  125. getList()
  126. })
  127. const handleSearch = (key, value) => {
  128. query.value.pageNo = 1
  129. query.value[key] = value
  130. items.value = []
  131. total.value = 0
  132. getList()
  133. }
  134. const handleRefresh = () => {
  135. items.value = []
  136. total.value = 0
  137. query.value.pageNo = 1
  138. getList()
  139. }
  140. const changeControl = (e) => {
  141. current.value = e.currentIndex
  142. handleRefresh()
  143. }
  144. // 加载更多
  145. const loadingMore = () => {
  146. if (more.value === 'noMore') return
  147. more.value = 'loading'
  148. query.value.pageNo++
  149. getList()
  150. }
  151. </script>
  152. <style scoped lang="scss">
  153. .box {
  154. height: 100vh;
  155. overflow: hidden;
  156. box-sizing: border-box;
  157. display: flex;
  158. flex-direction: column;
  159. }
  160. .scrollBox{
  161. flex: 1;
  162. padding-bottom: 24rpx;
  163. box-sizing: border-box;
  164. height: 0 !important;
  165. }
  166. </style>