You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.3 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view class="content">
  3. <view class="padding">
  4. <notice :list="noticeList"/>
  5. <view style="padding-bottom: 20rpx;" v-if="noticeList.length>0">
  6. <u-loadmore :status="status" />
  7. </view>
  8. <nodata v-if="!noticeList.length&&status=='nomore'">暂无投票信息~</nodata>
  9. </view>
  10. </view>
  11. </template>
  12. <script setup>
  13. import notice from '@/pages/tabbar/index/comp/notice.vue'
  14. import { getNoticeList, } from '@/config/api.js'
  15. import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
  16. import { ref } from 'vue'
  17. let status = ref('loading')
  18. let params = ref({
  19. "pageNo": 1,
  20. "pageSize": 30,
  21. })
  22. let noticeList = ref([])
  23. const total = ref(0)
  24. async function getNoticeListFn() {
  25. const {data: res} = await getNoticeList(params.value)
  26. noticeList.value.push(...res.list)
  27. total.value = res.total
  28. if(noticeList.value.length>=total.value) status.value = 'nomore'
  29. console.log(res)
  30. }
  31. getNoticeListFn()
  32. async function initList () {
  33. params.value.pageNo = 1
  34. noticeList.value = []
  35. await getNoticeListFn()
  36. }
  37. onPullDownRefresh(async()=>{
  38. await initList()
  39. uni.stopPullDownRefresh()
  40. })
  41. onReachBottom(()=>{
  42. if(total.value > noticeList.value.length) {
  43. getNoticeListFn()
  44. }
  45. })
  46. </script>
  47. <style lang="scss" scoped>
  48. .content {
  49. padding-bottom: 80rpx;
  50. }
  51. </style>