position.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. getData(name)
  54. }
  55. const refresh = () => {
  56. page.pageNo++
  57. getData()
  58. }
  59. </script>
  60. <style scoped lang="scss">
  61. .pb-10 { padding-bottom: 10px; }
  62. .pb-20 { padding-bottom: 20px; }
  63. .box {
  64. height: calc(100vh - 110px);
  65. overflow: hidden;
  66. .block{
  67. margin-bottom: 10px;
  68. padding: 0 10px;
  69. background-color: #fff;
  70. }
  71. }
  72. .scrollBox{
  73. height: 100%;
  74. }
  75. </style>