activity-list.vue 4.9 KB

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