position.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 } from '@/utils/testData'
  26. import { ref } from 'vue'
  27. const swiperAdList = ref([
  28. 'https://img.bosszhipin.com/beijin/activity/img/20240829/488f35070cc7d0b615328d1e05fe62df4b7d0ebc36568cfb80c0fe17b37418f00945b742138a9e17.jpg.webp',
  29. 'https://img.bosszhipin.com/beijin/activity/img/20240829/488f35070cc7d0b615328d1e05fe62df4b7d0ebc36568cfb80c0fe17b37418f00945b742138a9e17.jpg.webp',
  30. 'https://img.bosszhipin.com/beijin/activity/img/20240829/488f35070cc7d0b615328d1e05fe62df4b7d0ebc36568cfb80c0fe17b37418f00945b742138a9e17.jpg.webp',
  31. ])
  32. const filterList = ref([
  33. { label: '行业' },
  34. { label: '城市' },
  35. { label: '工作性质' },
  36. { label: '月薪范围' },
  37. { label: '工作经验' },
  38. ])
  39. //
  40. const positionListData = ref([])
  41. const noMore = ref(false)
  42. let page = { pageSize: 8, pageNo: 1 }
  43. //
  44. const getData = (name) => {
  45. if (positionListData.value.length > 30) return noMore.value = true
  46. positionListData.value = positionListData.value.concat(positionList)
  47. console.log('name', name)
  48. console.log('positionListData', positionListData.value)
  49. }
  50. getData()
  51. const onSearch = (name) => {
  52. page.pageNo = 1
  53. positionListData.value = []
  54. getData(name)
  55. }
  56. const refresh = () => {
  57. page.pageNo++
  58. getData()
  59. }
  60. </script>
  61. <style scoped lang="scss">
  62. .pb-10 { padding-bottom: 10px; }
  63. .pb-20 { padding-bottom: 20px; }
  64. .box {
  65. height: calc(100vh - 110px);
  66. overflow: hidden;
  67. .block{
  68. margin-bottom: 10px;
  69. padding: 0 10px;
  70. background-color: #fff;
  71. }
  72. }
  73. .scrollBox{
  74. height: 100%;
  75. }
  76. </style>