|
@@ -1,24 +1,25 @@
|
|
|
<template>
|
|
|
<view class="box defaultBgc">
|
|
|
- <scroll-view class="scrollBox" scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
|
|
|
- <view class="white-bgc">
|
|
|
- <uni-search-bar
|
|
|
- v-model="query.content"
|
|
|
- radius="8"
|
|
|
- placeholder="请输入关键字"
|
|
|
- cancelButton="none"
|
|
|
- :focus="false"
|
|
|
- @confirm="onSearch($event.value)"
|
|
|
- @clear="query.content = ''; onSearch()"
|
|
|
- />
|
|
|
- </view>
|
|
|
- <view class="white-bgc px-10 mb-10">
|
|
|
- <SwiperAd :list="swiperAdList"></SwiperAd>
|
|
|
- <view class="px-5">
|
|
|
- <FilterList :list="filterList" idValue="label" @change="handleSearch"></FilterList>
|
|
|
- </view>
|
|
|
+ <view class="white-bgc stick">
|
|
|
+ <uni-search-bar
|
|
|
+ v-model="query.content"
|
|
|
+ radius="8"
|
|
|
+ placeholder="请输入关键字"
|
|
|
+ cancelButton="none"
|
|
|
+ :focus="false"
|
|
|
+ @confirm="onSearch($event.value)"
|
|
|
+ @clear="query.content = ''; onSearch()"
|
|
|
+ />
|
|
|
+ </view>
|
|
|
+ <view class="white-bgc px-10 mb-10">
|
|
|
+ <SwiperAd :list="swiperAdList"></SwiperAd>
|
|
|
+ <view class="px-5">
|
|
|
+ <FilterList :list="filterList" idValue="label" @change="handleSearch"></FilterList>
|
|
|
</view>
|
|
|
- <PositionList class="pb-10" :list="positionListData" :noMore="noMore"></PositionList>
|
|
|
+ </view>
|
|
|
+ <scroll-view class="scrollBox" scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
|
|
|
+ <PositionList :list="positionListData" :noMore="false"></PositionList>
|
|
|
+ <uni-load-more :status="more" />
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -41,6 +42,7 @@ onShow(() => {
|
|
|
currentTabBar?.setData({ selected: 0 });
|
|
|
})
|
|
|
|
|
|
+const more = ref('more')
|
|
|
const swiperAdList = ref(swiperAdListTest)
|
|
|
const filterList = ref([
|
|
|
{ label: '城市', dictType: 'areaTreeData', key: 'areaIds', map: { text: 'name', value: 'id' } },
|
|
@@ -52,9 +54,8 @@ const filterList = ref([
|
|
|
|
|
|
//
|
|
|
const positionListData = ref([])
|
|
|
-const noMore = ref(false)
|
|
|
const query = reactive({
|
|
|
- pageSize: 10,
|
|
|
+ pageSize: 20,
|
|
|
pageNo: 1,
|
|
|
content: '',
|
|
|
areaIds: [],
|
|
@@ -65,17 +66,27 @@ const query = reactive({
|
|
|
})
|
|
|
//
|
|
|
const getData = async () => {
|
|
|
- // console.log('query', query)
|
|
|
- const res = await getJobAdvertisedSearch(query)
|
|
|
- const list = res?.data?.list || []
|
|
|
- if (list?.length) {
|
|
|
- list.forEach(e => {
|
|
|
- e.job = { ...e.job, ...dealDictObjData({}, e.job) }
|
|
|
- e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
|
|
|
- })
|
|
|
- positionListData.value = positionListData.value.concat(list)
|
|
|
+ try {
|
|
|
+ const res = await getJobAdvertisedSearch(query)
|
|
|
+ const list = res?.data?.list || []
|
|
|
+ positionListData.value.push(...list.map(e => {
|
|
|
+ if (!e) {
|
|
|
+ return e
|
|
|
+ }
|
|
|
+ e.job = { ...e.job, ...dealDictObjData({}, e.job) }
|
|
|
+ e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
|
|
|
+ return e
|
|
|
+ }))
|
|
|
+ if (positionListData.value.length === +res.data.total) {
|
|
|
+ more.value = 'noMore'
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ query.pageNo--
|
|
|
+ more.value = 'more'
|
|
|
}
|
|
|
- if (list?.length < query.pageSize) noMore.value = true
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
getData()
|
|
|
|
|
@@ -86,12 +97,12 @@ const handleSearch = (key, value) => {
|
|
|
|
|
|
const onSearch = () => {
|
|
|
query.pageNo = 1
|
|
|
- noMore.value = false
|
|
|
positionListData.value = []
|
|
|
getData()
|
|
|
}
|
|
|
|
|
|
const loadingMore = () => { // 加载更多
|
|
|
+ more.value = 'loading'
|
|
|
query.pageNo++
|
|
|
getData()
|
|
|
}
|
|
@@ -99,8 +110,13 @@ const loadingMore = () => { // 加载更多
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
+.stick {
|
|
|
+ position: sticky;
|
|
|
+}
|
|
|
.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
|
|
|
-.pb-10 { padding-bottom: 10px; }
|
|
|
+.pb-10 {
|
|
|
+ padding-bottom: 10px;
|
|
|
+}
|
|
|
.pb-20 { padding-bottom: 20px; }
|
|
|
.px-5 { padding-left: 5px; padding-right: 5px; }
|
|
|
.px-10 { padding-left: 10px; padding-right: 10px; }
|
|
@@ -110,8 +126,17 @@ const loadingMore = () => { // 加载更多
|
|
|
.box {
|
|
|
height: 100vh;
|
|
|
overflow: hidden;
|
|
|
+ padding-bottom: 120rpx;
|
|
|
+ // box-sizing: border-box;
|
|
|
+ // padding-bottom: 160rpx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
}
|
|
|
.scrollBox{
|
|
|
- height: 100%;
|
|
|
+ // height: 100%;
|
|
|
+ flex: 1;
|
|
|
+ height: 0 !important;
|
|
|
+ // padding-bottom: 160rpx;
|
|
|
}
|
|
|
</style>
|