activity-list.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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" @click="NavigateToActivity(item)">
  5. <image class="list-image" :src="item.image" mode="scaleToFill"></image>
  6. <view class="title">{{item.title}}</view>
  7. <view class="time" v-if="item.status!=3">
  8. <view class="text">{{ item.detail }}</view>
  9. </view>
  10. <view class="mack" v-if="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. NavigateToActivity(item){//跳转活动详情
  97. if(item.status!=3){
  98. this.$api.navigateTo(`/h5/pages/activity/activity?id=${item.linkParam.id}`)
  99. }else{
  100. this.$util.msg('活动已经结束',2000)
  101. }
  102. }
  103. },
  104. onReachBottom() {
  105. if(this.hasNextPage){
  106. this.loadding = true
  107. this.pullUpOn = true
  108. this.GetPromotionsrList()
  109. }
  110. },
  111. onPullDownRefresh() {//下拉刷新
  112. this.listQuery.pageNum = 1
  113. this.queryProductPromotionList()
  114. uni.stopPullDownRefresh()
  115. },
  116. onShow() {
  117. this.GetPromotionsrList()
  118. }
  119. }
  120. </script>
  121. <style lang="scss">
  122. page{
  123. background-color: #FFFFFF;
  124. }
  125. .activity-container{
  126. width: 100%;
  127. height: auto;
  128. box-sizing: border-box;
  129. padding: 0 24rpx;
  130. }
  131. .list{
  132. width: 100%;
  133. height: 318rpx;
  134. float: left;
  135. margin-bottom: 20rpx;
  136. position: relative;
  137. .list-image{
  138. width: 100%;
  139. height: 318rpx;
  140. display: block;
  141. }
  142. .title{
  143. width: 100%;
  144. height: 72rpx;
  145. line-height: 72rpx;
  146. text-align: center;
  147. background: rgba(254,246,243,0.8);
  148. color: $color-system;
  149. position: absolute;
  150. bottom: 0;
  151. left: 0;
  152. font-size: $font-size-26;
  153. }
  154. .time{
  155. width: 100%;
  156. height: 48rpx;
  157. position: absolute;
  158. top: 0;
  159. left: 0;
  160. .text{
  161. width: 475rpx;
  162. height: 48rpx;
  163. font-size: $font-size-24;
  164. margin: 0 auto;
  165. line-height: 48rpx;
  166. background: linear-gradient(315deg, #f94b4b 0%, #bc3cff 100%);
  167. color: #FFFFFF;
  168. text-align: center;
  169. }
  170. }
  171. .mack{
  172. width: 100%;
  173. height: 100%;
  174. position: absolute;
  175. top: 0;
  176. left: 0;
  177. z-index: 9999;
  178. background: rgba(0,0,0,.1);
  179. border-radius: 2rpx;
  180. display: flex;
  181. flex-direction: column;
  182. align-items: center;
  183. justify-content: center;
  184. .mack-text{
  185. width: 220rpx;
  186. height: 70rpx;
  187. border-radius: 35rpx;
  188. text-align: center;
  189. background: rgba(0,0,0,.4);
  190. color: #FFFFFF;
  191. line-height: 70rpx;
  192. font-size: $font-size-26;
  193. }
  194. }
  195. }
  196. </style>