myAction.vue 2.4 KB

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