activity-list.vue 4.3 KB

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