activity-list.vue 5.0 KB

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