actionList.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <view class="content">
  3. <view class="" style="height: 1rpx;"></view>
  4. <empty v-if="loaded === true && list.length === 0"></empty>
  5. <view class="action-wrap" v-for="item in list" @click="goAction(item)">
  6. <image :src="item.pics.split(',')[0]" mode=""></image>
  7. </view>
  8. <uni-load-more :status="loadingType"></uni-load-more>
  9. </view>
  10. </template>
  11. <script>
  12. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  13. import empty from '@/components/empty';
  14. import {getActionList} from '@/api/index.js'
  15. export default {
  16. components: {
  17. uniLoadMore,
  18. empty
  19. },
  20. data() {
  21. return {
  22. page: 1,
  23. limit: 10,
  24. loadingType: 'more',
  25. loaded: false,
  26. list: []
  27. }
  28. },
  29. onLoad(opt) {
  30. },
  31. onShow() {
  32. this.getList()
  33. },
  34. onReachBottom() {
  35. },
  36. onReady() {
  37. },
  38. methods: {
  39. goAction(item) {
  40. uni.navigateTo({
  41. url:'/pages/index/actionDetail?id=' + item.id
  42. })
  43. },
  44. getList() {
  45. let that = this
  46. if(that.loadingType == 'loading' || that.loadingType == 'noMore') {
  47. return
  48. }
  49. getActionList({
  50. page: that.page,
  51. limit: that.limit
  52. }).then(res => {
  53. let list = res.data
  54. that.list = that.list.concat(list)
  55. that.page++
  56. if(list.length == that.limit) {
  57. that.loadingType = 'more'
  58. }else {
  59. that.loadingType = 'noMore'
  60. }
  61. that.loaded = true
  62. })
  63. }
  64. }
  65. }
  66. </script>
  67. <style lang="scss">
  68. .action-wrap {
  69. width: 704rpx;
  70. height: 330rpx;
  71. margin:20rpx auto;
  72. image {
  73. width: 704rpx;
  74. height: 330rpx;
  75. border-radius: 20rpx;
  76. }
  77. }
  78. </style>