activity-list.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <view class="container activity">
  3. <view class="activity-content">
  4. <view class="activity-list" v-for="(activity,index) in activityList" :key="index" @click="NavigatorPath(activity)">
  5. <view class="activity-list-pic">
  6. <image class="activity-image" :src="activity.listImage" mode=""></image>
  7. </view>
  8. <view class="activity-list-msg">
  9. <view class="activity-title">{{ activity.name }}</view>
  10. <view class="activity-numbe">商品数:<text class="color">{{ activity.productCount }}</text> </view>
  11. <view class="activity-times">
  12. <text class="label">活动时间:</text>
  13. <text class="color">{{ activity.beginTime }}~{{ activity.endTime }}</text>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. export default{
  22. data(){
  23. return{
  24. activityList:[],
  25. hasNextPage:false,
  26. listQuery:{
  27. userId:0,
  28. pageNum:1,
  29. pageSize:10
  30. }
  31. }
  32. },
  33. onLoad() {
  34. },
  35. methods:{
  36. GetInitProductList(){//初始化活动列表数据
  37. this.ProductService.GetProductActivityAreaList(this.listQuery).then(response => {
  38. const data = response.data
  39. this.hasNextPage = data.hasNextPage
  40. this.activityList = data.list
  41. }).catch(error =>{
  42. this.$util.msg(error.msg,2000);
  43. })
  44. },
  45. GetOnReachBottomData(){//上滑加载更多
  46. this.listQuery.pageNum+=1
  47. this.ProductService.GetProductActivityAreaList(this.listQuery).then(response => {
  48. const data = response.data
  49. this.hasNextPage = data.hasNextPage
  50. this.activityList = this.activityList.concat(data.list)
  51. }).catch(error =>{
  52. this.$util.msg(error.msg,2000);
  53. })
  54. },
  55. NavigatorPath(item){
  56. console.log(item)
  57. this.$api.navigateTo(`/pages/user/activity/activity?activityId=${item.activityId}&userId=${this.listQuery.userId}`)
  58. }
  59. },
  60. onPullDownRefresh() {//下拉刷新
  61. this.listQuery.pageNum = 1
  62. this.GetInitProductList()
  63. uni.stopPullDownRefresh()
  64. },
  65. onReachBottom(){
  66. if(this.hasNextPage){
  67. this.GetOnReachBottomData()
  68. }
  69. },
  70. onShow() {
  71. this.$api.getStorage().then((resolve) => {
  72. this.listQuery.userId = resolve.userId ? resolve.userId : '';
  73. this.GetInitProductList()
  74. })
  75. }
  76. }
  77. </script>
  78. <style lang="scss">
  79. page{
  80. height: auto !important;
  81. background-color: $color-system;
  82. }
  83. .activity-content{
  84. width: 100%;
  85. height: auto;
  86. box-sizing: border-box;
  87. padding: 24rpx;
  88. .activity-list{
  89. width: 100%;
  90. height: 228rpx;
  91. box-sizing: border-box;
  92. padding: 24rpx 20rpx;
  93. background-color: #FFFFFF;
  94. border-radius: 16rpx;
  95. margin-bottom: 24rpx;
  96. .activity-list-pic{
  97. width: 180rpx;
  98. height: 180rpx;
  99. float: left;
  100. box-sizing: border-box;
  101. border: 1px solid #e1e1e1;
  102. border-radius: 8rpx;
  103. .activity-image{
  104. width: 178rpx;
  105. height: 178rpx;
  106. display: block;
  107. border-radius: 8rpx;
  108. }
  109. }
  110. .activity-list-msg{
  111. width: 460rpx;
  112. height: 100%;
  113. float: right;
  114. position: relative;
  115. .activity-title{
  116. width: 100%;
  117. height: auto;
  118. line-height: 36rpx;
  119. text-overflow: ellipsis;
  120. overflow: hidden;
  121. display: -webkit-box;
  122. -webkit-line-clamp: 2;
  123. line-clamp: 2;
  124. -webkit-box-orient: vertical;
  125. font-size: $font-size-26;
  126. color: #333333;
  127. text-align: justify;
  128. float: left;
  129. }
  130. .activity-numbe{
  131. width: 100%;
  132. height: 28rpx;
  133. float: left;
  134. margin-top: 4rpx;
  135. text-align: left;
  136. line-height: 28rpx;
  137. font-size: $font-size-24;
  138. color: #999999;
  139. .color{
  140. color: #666666;
  141. }
  142. }
  143. .activity-times{
  144. width: 100%;
  145. height: 44rpx;
  146. position: absolute;
  147. bottom: 0;
  148. left: 0;
  149. font-size:18rpx;
  150. color: #666666;
  151. line-height: 44rpx;
  152. .label{
  153. display: inline-block;
  154. float: left;
  155. }
  156. .color{
  157. display: inline-block;
  158. float: left;
  159. color: $color-system;
  160. }
  161. }
  162. }
  163. }
  164. }
  165. </style>