activityLIst.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <view>
  3. <u-sticky bgColor="#fff">
  4. <u-tabs :current='current' :scrollable='false' lineColor='#A890FE' itemStyle="width: 125px;padding-bottom:10px" :activeStyle="{
  5. color: '#303133',
  6. fontWeight: 'bold',
  7. transform: 'scale(1.05)'
  8. }" :list="list" @change="change"></u-tabs>
  9. </u-sticky>
  10. <view class="" v-if="activityList.length!=0">
  11. <view class="item" v-for="(item,index) in activityList" :key="index" @click="toinfo(item)">
  12. <view class="top">
  13. <image src="../../static/activity/status@2x.png" mode="" class="status"></image>
  14. <image src="../../static/activity/count@2x.png" mode="" class="count"></image>
  15. <text v-if="item.status==1">距活动开始 <u-count-down @end="toback()"
  16. bg-color="rgba(62, 62, 62, 0)" separator-color="#fff" color="#fff" fontSize="20" :timestamp="time(item)"></u-count-down></text>
  17. <text v-if="item.status==2">活动报名中</text>
  18. <text v-if="item.status==3">报名已满</text>
  19. <text v-if="item.status==4">报名结束</text>
  20. <text v-if="item.status==5">活动进行中</text>
  21. <text v-if="item.status==6">活动结束</text>
  22. </view>
  23. <view class="bottom u-flex">
  24. <image :src="item.show_image" mode=""></image>
  25. <view class="">
  26. <view class="title">
  27. {{item.title}}
  28. </view>
  29. <view class="time">
  30. <text>活动时间</text> {{item.av_statime}}-{{item.av_endtime}}
  31. </view>
  32. <view class="num">
  33. <text>报名号</text> {{item.number}}
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. onLoad() {
  44. this.getList()
  45. },
  46. onReachBottom() {
  47. this.page++
  48. this.getList()
  49. },
  50. data() {
  51. return {
  52. activityList:[],
  53. page:1,
  54. current:0,
  55. list: [{
  56. name: '待开始',
  57. }, {
  58. name: '已开始',
  59. }, {
  60. name: '已结束'
  61. }]
  62. }
  63. },
  64. computed:{
  65. },
  66. methods: {
  67. toinfo(item){
  68. uni.navigateTo({
  69. url:'./activityInfo?id='+item.id
  70. })
  71. },
  72. time(item){
  73. var time = new Date(item.av_statime.replace(/-/g, "/")).getTime()
  74. var time1 = new Date().getTime()
  75. time = (time - time1) / 1000
  76. return time
  77. },
  78. getList(){
  79. uni.$u.http.post('/api/user/myactivity',{page:this.page,type:this.current+1}).then(res => {
  80. if(this.page==1){
  81. this.activityList=res.data
  82. }else{
  83. this.activityList=[...this.activityList,...res.data]
  84. }
  85. })
  86. },
  87. change(e){
  88. if(this.current!=e.index){
  89. this.current=e.index
  90. this.page=1
  91. this.getList()
  92. }
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss">
  98. .bottom{
  99. padding: 28rpx 20rpx;
  100. image{
  101. width: 160rpx;
  102. height: 160rpx;
  103. border-radius: 20rpx;
  104. margin-right: 20rpx;
  105. }
  106. .title{
  107. font-size: 28rpx;
  108. font-weight: 600;
  109. }
  110. .time{
  111. margin: 24rpx 0 12rpx;
  112. font-size: 20rpx;
  113. text{
  114. color: #888888;
  115. margin-right: 12rpx;
  116. }
  117. }
  118. .num{
  119. font-size: 20rpx;
  120. text{
  121. color: #888888;
  122. margin-right: 31rpx;
  123. }
  124. }
  125. }
  126. .item{
  127. position: relative;
  128. font-size: 26rpx;
  129. margin: 24rpx auto 0;
  130. width: 690rpx;
  131. background: #FFFFFF;
  132. border-radius: 28rpx;
  133. .have{
  134. width: 120rpx;
  135. height: 120rpx;
  136. position: absolute;
  137. top: 0;
  138. right: 0;
  139. z-index: 1;
  140. }
  141. .top{
  142. padding-left: 28rpx;
  143. position: relative;
  144. width: 690rpx;
  145. height: 60rpx;
  146. line-height: 60rpx;
  147. .status{
  148. position: absolute;
  149. top: 0;
  150. right: 0;
  151. left: 0;
  152. bottom: 0;
  153. width: 690rpx;
  154. height: 60rpx;
  155. z-index: 0;
  156. }
  157. .count{
  158. width: 40rpx;
  159. height: 40rpx;
  160. vertical-align: middle;
  161. margin-right: 8rpx;
  162. margin-bottom: 4rpx;
  163. position: relative;
  164. }
  165. text{
  166. position: relative;
  167. font-weight:600;
  168. }
  169. }
  170. }
  171. page{
  172. background-color: #F3F3F3;
  173. }
  174. </style>