actionList.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view class="content">
  3. <empty v-if="loaded && list.length == 0"></empty>
  4. <view class="action" v-for="item in list" @click="goAction(item)">
  5. <image :src="item.image_input[0]" mode="" class="action-img"></image>
  6. <view class="action-tit">
  7. {{item.title}}
  8. </view>
  9. </view>
  10. <uni-load-more :status="loadingType"></uni-load-more>
  11. </view>
  12. </template>
  13. <script>
  14. import {
  15. articleList,
  16. record,
  17. } from '@/api/index.js'
  18. export default {
  19. data() {
  20. return {
  21. page: 1,
  22. limit: 10,
  23. list: [],
  24. loadingType: 'more',
  25. loaded: false,
  26. type: 0,
  27. };
  28. },
  29. onLoad(opt) {
  30. if(opt.type) {
  31. this.type = opt.type
  32. }
  33. },
  34. onShow() {
  35. this.getActionList()
  36. },
  37. onReachBottom() {
  38. },
  39. methods: {
  40. goAction(item) {
  41. if(this.type == 0) {
  42. uni.navigateTo({
  43. url: '/pages/shop/action?id=' + item.id
  44. })
  45. }
  46. },
  47. getActionList() {
  48. if (this.loadingType == 'loading' || this.loadingType == 'noMore') {
  49. return
  50. }
  51. this.loadingType = 'more'
  52. articleList({
  53. page: this.page,
  54. limit: this.limit
  55. },2).then(res => {
  56. this.list = this.list.concat(res.data)
  57. this.page++
  58. if (res.data.lengt == this.limit) {
  59. this.loadingType = 'more'
  60. } else {
  61. this.loadingType = 'noMore'
  62. }
  63. this.loaded = true
  64. })
  65. }
  66. }
  67. };
  68. </script>
  69. <style lang="scss" scoped>
  70. page {
  71. background-color: #f2f2f2;
  72. height: auto;
  73. min-height: 100%;
  74. }
  75. .action {
  76. width: 700rpx;
  77. margin: 25rpx auto;
  78. border-radius: 35rpx;
  79. overflow: hidden;
  80. background-color: #fff;
  81. .action-img {
  82. width: 700rpx;
  83. height: 300rpx;
  84. background-color: #333;
  85. }
  86. .action-tit {
  87. min-height: 100rpx;
  88. font-size: 34rpx;
  89. font-weight: 500;
  90. color: #0E0E0E;
  91. display: flex;
  92. align-items: center;
  93. padding: 15rpx;
  94. padding-left: 30rpx;
  95. }
  96. }
  97. </style>