flat: 修改
This commit is contained in:
73
packageA/pages/moreJobs/moreJobs.vue
Normal file
73
packageA/pages/moreJobs/moreJobs.vue
Normal file
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<view class="collection-content">
|
||||
<renderJobs :list="list" :longitude="longitudeVal" :latitude="latitudeVal"></renderJobs>
|
||||
<loadmore ref="loadmoreRef"></loadmore>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import dictLabel from '@/components/dict-Label/dict-Label.vue';
|
||||
import { reactive, inject, watch, ref, onMounted } from 'vue';
|
||||
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
|
||||
import useUserStore from '@/stores/useUserStore';
|
||||
const { $api, navTo, navBack, vacanciesTo } = inject('globalFunction');
|
||||
import { storeToRefs } from 'pinia';
|
||||
import useLocationStore from '@/stores/useLocationStore';
|
||||
import { usePagination } from '@/hook/usePagination';
|
||||
import { jobMoreMap } from '@/utils/markdownParser';
|
||||
const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore());
|
||||
const loadmoreRef = ref(null);
|
||||
|
||||
// 响应式搜索条件(可以被修改)
|
||||
const searchParams = ref({});
|
||||
const pageSize = ref(10);
|
||||
const { list, loading, refresh, loadMore } = usePagination(
|
||||
(params) => $api.createRequest('/app/job/list', params, 'GET', true),
|
||||
null, // 转换函数
|
||||
{
|
||||
pageSize: pageSize,
|
||||
search: searchParams,
|
||||
autoWatchSearch: true,
|
||||
onBeforeRequest: () => {
|
||||
loadmoreRef.value?.change('loading');
|
||||
},
|
||||
onAfterRequest: () => {
|
||||
loadmoreRef.value?.change('more');
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
onLoad((options) => {
|
||||
let params = jobMoreMap.get(options.jobId);
|
||||
if (params) {
|
||||
uni.setStorageSync('jobMoreMap', params);
|
||||
} else {
|
||||
params = uni.getStorageSync('jobMoreMap');
|
||||
}
|
||||
const objs = removeNullProperties(params);
|
||||
searchParams.value = objs;
|
||||
refresh();
|
||||
});
|
||||
|
||||
function removeNullProperties(obj) {
|
||||
for (const key in obj) {
|
||||
if (obj.hasOwnProperty(key) && obj[key] === null) {
|
||||
delete obj[key]; // 删除值为 null 的属性
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
onReachBottom(() => {
|
||||
loadMore();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.collection-content{
|
||||
padding: 1rpx 28rpx 20rpx 28rpx;
|
||||
background: #F4F4F4;
|
||||
height: 100%
|
||||
min-height: calc(100vh - var(--window-top) - var(--status-bar-height) - var(--window-bottom));
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user