activity-list.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. source:2,
  35. pageNum:1,
  36. pageSize:10,
  37. },
  38. hasNextPage:false,
  39. loadding: false,
  40. pullUpOn: true,
  41. pullFlag: true,
  42. allowDataStatus:true,
  43. wrapperHeight:'100%',
  44. scrollHeight:'',
  45. list:[],
  46. }
  47. },
  48. onLoad(option) {
  49. },
  50. methods:{
  51. GetPromotionsrList(){//获取专题列表
  52. this.ProductService.GetPromotionsrList(this.listQuery).then(response =>{
  53. let responseData = response.data
  54. if(responseData.list&&responseData.list.length > 0){
  55. this.isEmpty = false
  56. this.hasNextPage = responseData.hasNextPage
  57. this.list = responseData.list
  58. this.pullFlag = false;
  59. setTimeout(()=>{this.pullFlag = true;},500)
  60. if(this.hasNextPage){
  61. this.pullUpOn = false
  62. this.nomoreText = '上拉显示更多'
  63. }else{
  64. this.pullUpOn = true
  65. this.loadding = false
  66. this.nomoreText = '已至底部'
  67. }
  68. }else{
  69. this.isEmpty = true
  70. }
  71. }).catch(error =>{
  72. this.$util.msg(error.msg,2000)
  73. })
  74. },
  75. GetPromotionsrListBottomData(){
  76. this.listQuery.pageNum+=1
  77. this.ProductService.GetPromotionsrList(this.listQuery).then(response =>{
  78. let responseData = response.data
  79. if(responseData.list&&responseData.list.length > 0){
  80. this.hasNextPage = response.data.hasNextPage
  81. this.list = this.list.concat(responseData.list)
  82. this.pullFlag = false;// 防上拉暴滑
  83. setTimeout(()=>{this.pullFlag = true;},500)
  84. if(this.hasNextPage){
  85. this.pullUpOn = false
  86. this.nomoreText = '上拉显示更多'
  87. }else{
  88. this.pullUpOn = false
  89. this.loadding = false
  90. this.nomoreText = '已至底部'
  91. }
  92. }
  93. }).catch(error =>{
  94. this.$util.msg(error.msg,2000)
  95. })
  96. },
  97. NavigateToActivity(item){//跳转活动详情
  98. if(item.status!=3){
  99. this.$api.navigateTo(`/h5/pages/activity/activity?title=${item.title}&link=${item.crmLink}`)
  100. }else{
  101. this.$util.msg('活动已经结束',2000)
  102. }
  103. }
  104. },
  105. onReachBottom() {
  106. if(this.hasNextPage){
  107. this.loadding = true
  108. this.pullUpOn = true
  109. this.GetPromotionsrListBottomData()
  110. }
  111. },
  112. onPullDownRefresh() {//下拉刷新
  113. this.listQuery.pageNum = 1
  114. this.GetPromotionsrList()
  115. uni.stopPullDownRefresh()
  116. },
  117. onShow() {
  118. this.GetPromotionsrList()
  119. }
  120. }
  121. </script>
  122. <style lang="scss">
  123. page{
  124. background-color: #FFFFFF;
  125. }
  126. .activity-container{
  127. width: 100%;
  128. height: auto;
  129. box-sizing: border-box;
  130. padding: 0 24rpx;
  131. }
  132. .list{
  133. width: 100%;
  134. height: 318rpx;
  135. float: left;
  136. margin-bottom: 20rpx;
  137. position: relative;
  138. .list-image{
  139. width: 100%;
  140. height: 318rpx;
  141. display: block;
  142. }
  143. .title{
  144. width: 100%;
  145. height: 72rpx;
  146. line-height: 72rpx;
  147. text-align: center;
  148. background: rgba(254,246,243,0.8);
  149. color: $color-system;
  150. position: absolute;
  151. bottom: 0;
  152. left: 0;
  153. font-size: $font-size-26;
  154. text-overflow:ellipsis;
  155. display: -webkit-box;
  156. word-break: break-all;
  157. -webkit-box-orient: vertical;
  158. -webkit-line-clamp: 1;
  159. overflow: hidden;
  160. }
  161. .time{
  162. width: 100%;
  163. height: 48rpx;
  164. position: absolute;
  165. top: 0;
  166. left: 0;
  167. .text{
  168. width: 475rpx;
  169. height: 48rpx;
  170. font-size: $font-size-24;
  171. margin: 0 auto;
  172. line-height: 48rpx;
  173. background: linear-gradient(315deg, #f94b4b 0%, #bc3cff 100%);
  174. color: #FFFFFF;
  175. text-align: center;
  176. }
  177. }
  178. .mack{
  179. width: 100%;
  180. height: 100%;
  181. position: absolute;
  182. top: 0;
  183. left: 0;
  184. z-index: 9999;
  185. background: rgba(0,0,0,.1);
  186. border-radius: 2rpx;
  187. display: flex;
  188. flex-direction: column;
  189. align-items: center;
  190. justify-content: center;
  191. .mack-text{
  192. width: 220rpx;
  193. height: 70rpx;
  194. border-radius: 35rpx;
  195. text-align: center;
  196. background: rgba(0,0,0,.4);
  197. color: #FFFFFF;
  198. line-height: 70rpx;
  199. font-size: $font-size-26;
  200. }
  201. }
  202. }
  203. </style>