activity-list.vue 4.4 KB

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