| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 | <template>  <view class="box defaultBgc">    <scroll-view class="scrollBox" scroll-y="true" @scrolltolower="loadingMore" @refresherrefresh="refresh" style="position:relative;">      <view class="white-bgc">        <uni-search-bar          radius="8"          placeholder="请输入关键字"          cancelButton="none"          :focus="false"          @confirm="onSearch($event.value)"        />      </view>      <view class="white-bgc px-10 pb-10 mb-10">        <SwiperAd :list="swiperAdList"></SwiperAd>        <!-- <FilterList :list="filterList" idValue="label"></FilterList> -->      </view>      <PositionList class="pb-10" :list="positionListData" :noMore="noMore"></PositionList>    </scroll-view>  </view></template><script setup>import SwiperAd from '@/components/SwiperAd'// import SearchBar from '@/components/SearchBar'// import FilterList from '@/components/FilterList'import PositionList from '@/components/PositionList'import { swiperAdListTest, positionList } from '@/utils/testData'import { dealDictObjData } from '@/utils/position'import { getJobAdvertisedSearch } from '@/api/position';import { ref, reactive } from 'vue'import { onPullDownRefresh } from '@dcloudio/uni-app';let searchContent = ''const swiperAdList = ref(swiperAdListTest)const filterList = ref([  { label: '行业' },  { label: '城市' },  { label: '工作性质' },  { label: '月薪范围' },  { label: '工作经验' },])// const positionListData = ref([])const noMore = ref(false)const query = reactive({ pageSize: 10, pageNo: 1 })//const getData = async () => {  query.content = searchContent  const res = await getJobAdvertisedSearch(query)  const list = res?.data?.list || []  // const list = positionList  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)  }  if (list?.length < query.pageSize) noMore.value = true  // console.log('列表', positionListData.value)}getData()const onSearch = (name) => {  query.pageNo = 1  noMore.value = false  searchContent = name  positionListData.value = []  getData(name)}const loadingMore = () => { // 加载更多  query.pageNo++  getData()}const refresh = () => { // 下拉刷新  onSearch(searchContent)}//下拉刷新onPullDownRefresh(() => { // 下拉刷新  // debugger  onSearch(searchContent)})</script><style scoped lang="scss">.px-0 { padding-left: 0 !important; padding-right: 0 !important; }.pb-10 { padding-bottom: 10px; }.pb-20 { padding-bottom: 20px; }.px-10 { padding-left: 10px; padding-right: 10px; }.mb-10 { margin-bottom: 10px; }.box {  height: calc(100vh - 110px);  overflow: hidden;}.scrollBox{  height: 100%;}</style>
 |