123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <template>
- <view class="box defaultBgc">
- <view style="padding: 10px 15px 10px 15px;">
- <uni-data-select
- v-model="query.jobId"
- :clear="false"
- :localdata="jobList"
- @change="handleChangeJob"
- placeholder="招聘中职位"
- ></uni-data-select>
- </view>
-
- <scroll-view class="scrollBox" :scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
- <TalentItem v-if="query.jobId && (items?.length || more !== 'loading')" :items="items" />
- <uni-load-more v-if="query.jobId" :status="more" />
- <view v-else class="noJobId">请先选择职位</view>
- </scroll-view>
- </view>
- </template>
- <script setup>
- import { ref, nextTick } from 'vue'
- import TalentItem from './talentItem.vue'
- import { getPersonRecommendPage } from '@/api/search'
- import { dealDictArrayData } from '@/utils/position'
- defineProps({ jobList: Array })
- const query = ref({
- pageNo: 1,
- paeSize: 20,
- jobId: null
- })
- const items = ref([])
- const more = ref('more')
- const total = ref(0)
- // 根据职位id获取推荐人才列表
- const getRecommendList = async () => {
- try {
- more.value = 'loading'
- const { data } = await getPersonRecommendPage(query.value)
- if (!data.list.length) {
- more.value = 'noMore'
- return
- }
- const list = dealDictArrayData([], data.list)
- items.value = items.value.concat(list)
- total.value = data.total
- if (items.value.length === +data.total) {
- more.value = 'noMore'
- return
- }
- } catch {
- query.value.pageNo--
- more.value = 'more'
- }
- }
- // 选择招聘中职位
- const handleChangeJob = (e) => {
- query.value.pageNo = 1
- items.value = []
- total.value = 0
- if (e) getRecommendList()
- }
- // 加载更多
- const loadingMore = () => {
- if (more.value === 'noMore') return
- more.value = 'loading'
- query.value.pageNo++
- getRecommendList()
- }
- </script>
- <style scoped lang="scss">
- .noJobId {
- text-align: center;
- line-height: 60vh;
- color: #666;
- }
- .box {
- height: 100vh;
- overflow: hidden;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- }
- .scrollBox{
- flex: 1;
- padding-bottom: 100px;
- box-sizing: border-box;
- height: 0 !important;
- }
- </style>
|