position.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view class="box defaultBgc">
  3. <scroll-view class="scrollBox" scroll-y="true" @scrolltolower="getData" @refresherrefresh="refresh" style="position:relative;">
  4. <uni-search-bar
  5. class="ss-flex-1 white-bgc"
  6. radius="8"
  7. placeholder="请输入关键字"
  8. cancelButton="none"
  9. :focus="false"
  10. @confirm="onSearch($event.value)"
  11. />
  12. <view class="block">
  13. <SwiperAd class="pb-20" :list="swiperAdList"></SwiperAd>
  14. <FilterList class="pb-10" :list="filterList" idValue="label"></FilterList>
  15. </view>
  16. <PositionList class="pb-10" :list="positionListData" :noMore="noMore"></PositionList>
  17. </scroll-view>
  18. </view>
  19. </template>
  20. <script setup>
  21. import SwiperAd from '@/components/SwiperAd'
  22. // import SearchBar from '@/components/SearchBar'
  23. import FilterList from '@/components/FilterList'
  24. import PositionList from '@/components/PositionList'
  25. import { positionList, swiperAdListTest } from '@/utils/testData'
  26. import { ref } from 'vue'
  27. const swiperAdList = ref(swiperAdListTest)
  28. const filterList = ref([
  29. { label: '行业' },
  30. { label: '城市' },
  31. { label: '工作性质' },
  32. { label: '月薪范围' },
  33. { label: '工作经验' },
  34. ])
  35. //
  36. const positionListData = ref([])
  37. const noMore = ref(false)
  38. let page = { pageSize: 8, pageNo: 1 }
  39. //
  40. const getData = (name) => {
  41. if (positionListData.value.length > 30) return noMore.value = true
  42. positionListData.value = positionListData.value.concat(positionList)
  43. }
  44. getData()
  45. const onSearch = (name) => {
  46. page.pageNo = 1
  47. positionListData.value = []
  48. getData(name)
  49. }
  50. const refresh = () => {
  51. page.pageNo++
  52. getData()
  53. }
  54. </script>
  55. <style scoped lang="scss">
  56. .pb-10 { padding-bottom: 10px; }
  57. .pb-20 { padding-bottom: 20px; }
  58. .box {
  59. height: calc(100vh - 110px);
  60. overflow: hidden;
  61. .block{
  62. margin-bottom: 10px;
  63. padding: 0 10px;
  64. background-color: #fff;
  65. }
  66. }
  67. .scrollBox{
  68. height: 100%;
  69. }
  70. </style>