123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <template>
- <view class="box defaultBgc">
- <view style="background-color: #fff;">
- <uni-segmented-control
- :current="current"
- :values="tabList.map(e => e.label)"
- @clickItem="changeControl"
- styleType="text"
- activeColor="#00B760"
- ></uni-segmented-control>
- </view>
- <scroll-view class="scrollBox" :scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
- <CardItem v-if="items?.length" :items="items" :current="tabList[current].value" @refresh="handleRefresh" />
- <uni-load-more :status="more" />
- </scroll-view>
- </view>
- </template>
- <script setup>
- import { ref } from 'vue'
- import { timesTampChange } from '@/utils/date'
- import { dealDictObjData } from '@/utils/position'
- import CardItem from './item.vue'
- import { getPersonCvPage, getInterviewInvitePage, personCvUnfitPage } from '@/api/resume'
- const current = ref(0)
- const tabList = ref([
- { label: '投递简历', value: 0, api: getPersonCvPage, status: null },
- { label: '已邀约', value: 1, api: getInterviewInvitePage, status: '0' },
- { label: '已入职', value: 2, api: getInterviewInvitePage, status: '1' },
- { label: '已结算', value: 3, api: getInterviewInvitePage, status: '2' },
- { label: '不合适', value: 4, api: personCvUnfitPage },
- ])
- const more = ref('more')
- const total = ref(0)
- const items = ref([])
- const query = ref({
- pageNo: 1,
- pageSize: 10,
- type: null,
- status: null,
- })
- // 获取牛人列表
- const getList = async () => {
- more.value = 'loading'
- const api = tabList.value[current.value].api
- if (current.value !== 0) {
- query.value.conversationStatus = tabList.value[current.value].status
- delete query.value.status
- delete query.value.type
- }
- try {
- const { data } = await api(query.value)
- const { list, total: number } = data
- if (!list.length) {
- more.value = 'noMore'
- return
- }
- total.value = number
- const arr = list.map(e => {
- let obj = e
- if (e.person) obj.person = Object.assign(e.person, dealDictObjData({}, e.person))
- obj.job = Object.assign(e.job, dealDictObjData({}, e.job))
- obj.createTime = timesTampChange(e.createTime, 'Y-M-D h:m')
- return obj
- })
- items.value = items.value.concat(arr)
- if (items.value.length === +number) {
- more.value = 'noMore'
- return
- }
- } catch {
- query.value.pageNo--
- more.value = 'more'
- }
- }
- getList()
- const handleRefresh = () => {
- items.value = []
- total.value = 0
- query.value.pageNo = 1
- getList()
- }
- const changeControl = (e) => {
- current.value = e.currentIndex
- handleRefresh()
- }
- // 加载更多
- const loadingMore = () => {
- if (more.value === 'noMore') return
- more.value = 'loading'
- query.value.pageNo++
- getList()
- }
- </script>
- <style scoped lang="scss">
- .box {
- height: 100vh;
- overflow: hidden;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- }
- .scrollBox{
- flex: 1;
- padding-bottom: 24rpx;
- box-sizing: border-box;
- height: 0 !important;
- }
- </style>
|