activity-list.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <view class="activity-container">
  3. <scroll-view scroll-y="true" >
  4. <view class="list" v-for="(item, index) in list" :key="index">
  5. <image class="list-image" :src="item.image" mode="scaleToFill"></image>
  6. <view class="title">{{item.title}}</view>
  7. <view class="time" v-show="item.status!=3">
  8. <view class="text">{{item.detail }}</view>
  9. </view>
  10. </view>
  11. <!--加载loadding-->
  12. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  13. <tui-nomore :visible="!pullUpOn" bgcolor="#F7F7F7" :text='nomoreText'></tui-nomore>
  14. <!--加载loadding-->
  15. </scroll-view>
  16. </view>
  17. </template>
  18. <script>
  19. import tuiLoadmore from "@/components/tui-components/loadmore/loadmore"
  20. import tuiNomore from "@/components/tui-components/nomore/nomore"
  21. export default {
  22. components:{
  23. tuiLoadmore,
  24. tuiNomore,
  25. },
  26. data() {
  27. return {
  28. isEmpty:false,
  29. nomoreText: '上拉显示更多',
  30. listQuery:{
  31. pageNum:1,
  32. pageSize:10,
  33. },
  34. hasNextPage:false,
  35. loadding: false,
  36. pullUpOn: true,
  37. pullFlag: true,
  38. allowDataStatus:true,
  39. wrapperHeight:'100%',
  40. scrollHeight:'',
  41. list:[],
  42. }
  43. },
  44. onLoad(option) {
  45. },
  46. methods:{
  47. GetPromotionsrList(){//获取专题列表
  48. this.ProductService.GetPromotionsrList(this.listQuery).then(response =>{
  49. let responseData = response.data
  50. if(responseData.list&&responseData.list.length > 0){
  51. this.isEmpty = false
  52. this.hasNextPage = responseData.hasNextPage
  53. this.list = responseData.list
  54. this.pullFlag = false;
  55. setTimeout(()=>{this.pullFlag = true;},500)
  56. if(this.hasNextPage){
  57. this.pullUpOn = false
  58. this.nomoreText = '上拉显示更多'
  59. }else{
  60. this.pullUpOn = true
  61. this.loadding = false
  62. this.nomoreText = '已至底部'
  63. }
  64. }else{
  65. this.isEmpty = true
  66. }
  67. }).catch(error =>{
  68. this.$util.msg(error.msg,2000)
  69. })
  70. },
  71. GetPromotionsrListBottomData(){
  72. this.listQuery.pageNum+=1
  73. this.ProductService.GetPromotionsrList(this.listQuery).then(response =>{
  74. let responseData = response.data
  75. if(responseData.list&&responseData.list.length > 0){
  76. this.hasNextPage = response.data.hasNextPage
  77. this.list = this.list.concat(responseData.list)
  78. this.pullFlag = false;// 防上拉暴滑
  79. setTimeout(()=>{this.pullFlag = true;},500)
  80. if(this.hasNextPage){
  81. this.pullUpOn = false
  82. this.nomoreText = '上拉显示更多'
  83. }else{
  84. this.pullUpOn = false
  85. this.loadding = false
  86. this.nomoreText = '已至底部'
  87. }
  88. }
  89. }).catch(error =>{
  90. this.$util.msg(error.msg,2000)
  91. })
  92. },
  93. navToDetailPage() {//跳转商品详情页
  94. this.$api.navigateTo(`/pages/goods/product?id=${this.productID}`)
  95. },
  96. },
  97. onReachBottom() {
  98. if(this.hasNextPage){
  99. this.loadding = true
  100. this.pullUpOn = true
  101. this.GetPromotionsrListBottomData()
  102. }
  103. },
  104. onShow() {
  105. this.GetPromotionsrList()
  106. }
  107. }
  108. </script>
  109. <style lang="scss">
  110. page{
  111. background-color: #FFFFFF;
  112. }
  113. .activity-container{
  114. width: 100%;
  115. height: auto;
  116. box-sizing: border-box;
  117. padding: 0 24rpx;
  118. }
  119. .list{
  120. width: 100%;
  121. height: 318rpx;
  122. float: left;
  123. margin-bottom: 20rpx;
  124. position: relative;
  125. .list-image{
  126. width: 100%;
  127. height: 318rpx;
  128. display: block;
  129. }
  130. .title{
  131. width: 100%;
  132. height: 72rpx;
  133. line-height: 72rpx;
  134. text-align: center;
  135. background: rgba(254,246,243,0.8);
  136. color: $color-system;
  137. position: absolute;
  138. bottom: 0;
  139. left: 0;
  140. font-size: $font-size-26;
  141. }
  142. .time{
  143. width: 100%;
  144. height: 48rpx;
  145. position: absolute;
  146. top: 0;
  147. left: 0;
  148. .text{
  149. width: 475rpx;
  150. height: 48rpx;
  151. font-size: $font-size-24;
  152. margin: 0 auto;
  153. line-height: 48rpx;
  154. background: linear-gradient(315deg, #f94b4b 0%, #bc3cff 100%);
  155. color: #FFFFFF;
  156. text-align: center;
  157. }
  158. }
  159. }
  160. </style>