activity-list.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. // 采美活动点击量统计
  104. this.cmsMoudleHits(3, item.id)
  105. this.$api.navigateTo(`/pages/h5/activity/activity?link=${item.crmLink}&linkId=${item.linkParam.id}`)
  106. }
  107. }else{
  108. this.$util.msg('活动已经结束',2000)
  109. }
  110. }
  111. },
  112. onReachBottom() {
  113. if(this.hasNextPage){
  114. this.loadding = true
  115. this.pullUpOn = true
  116. this.GetPromotionsrListBottomData()
  117. }
  118. },
  119. onPullDownRefresh() {//下拉刷新
  120. this.listQuery.pageNum = 1
  121. this.GetPromotionsrList()
  122. uni.stopPullDownRefresh()
  123. },
  124. onShareAppMessage(res) {
  125. //分享转发
  126. if (res.from === 'button') {
  127. // 来自页面内转发按钮
  128. }
  129. return {
  130. title: '最近优惠~',
  131. path: 'pages/h5/activity/activity-list',
  132. imageUrl: 'https://static.caimei365.com/app/img/bg/min-banner.jpg'
  133. }
  134. },
  135. onShow() {
  136. this.GetPromotionsrList()
  137. }
  138. }
  139. </script>
  140. <style lang="scss">
  141. page{
  142. background-color: #FFFFFF;
  143. }
  144. .activity-container{
  145. width: 100%;
  146. height: auto;
  147. box-sizing: border-box;
  148. padding: 0 24rpx;
  149. }
  150. .list{
  151. width: 100%;
  152. height: 318rpx;
  153. float: left;
  154. margin-bottom: 20rpx;
  155. position: relative;
  156. .list-image{
  157. width: 100%;
  158. height: 318rpx;
  159. display: block;
  160. }
  161. .title{
  162. width: 100%;
  163. height: 72rpx;
  164. line-height: 72rpx;
  165. text-align: center;
  166. background: rgba(254,246,243,0.8);
  167. color: $color-system;
  168. position: absolute;
  169. bottom: 0;
  170. left: 0;
  171. font-size: $font-size-26;
  172. text-overflow:ellipsis;
  173. display: -webkit-box;
  174. word-break: break-all;
  175. -webkit-box-orient: vertical;
  176. -webkit-line-clamp: 1;
  177. overflow: hidden;
  178. }
  179. .time{
  180. width: 100%;
  181. height: 48rpx;
  182. position: absolute;
  183. top: 0;
  184. left: 0;
  185. .text{
  186. width: 475rpx;
  187. height: 48rpx;
  188. font-size: $font-size-24;
  189. margin: 0 auto;
  190. line-height: 48rpx;
  191. background: linear-gradient(315deg, #f94b4b 0%, #bc3cff 100%);
  192. color: #FFFFFF;
  193. text-align: center;
  194. }
  195. }
  196. .mack{
  197. width: 100%;
  198. height: 100%;
  199. position: absolute;
  200. top: 0;
  201. left: 0;
  202. z-index: 9999;
  203. background: rgba(0,0,0,.1);
  204. border-radius: 2rpx;
  205. display: flex;
  206. flex-direction: column;
  207. align-items: center;
  208. justify-content: center;
  209. .mack-text{
  210. width: 220rpx;
  211. height: 70rpx;
  212. border-radius: 35rpx;
  213. text-align: center;
  214. background: rgba(0,0,0,.4);
  215. color: #FFFFFF;
  216. line-height: 70rpx;
  217. font-size: $font-size-26;
  218. }
  219. }
  220. }
  221. </style>