index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view :style="viewColor">
  3. <view class="application-list" v-if="listData.length">
  4. <view @click="goDetail(item)" class="card-list" v-for="item in listData" :key="item.activity_id">
  5. <view class="card-top" :style="'background-image: url('+item.pic+')'"></view>
  6. <view class="card-bottom">
  7. <view class="title">{{item.activity_name}}</view>
  8. <view class="bottom acea-row">
  9. <view>
  10. <view class="item">
  11. <view class="name">已报名人数:</view>
  12. <view class="count">
  13. {{item.total}}人
  14. </view>
  15. </view>
  16. <view class="item">
  17. <view class="name">报名截止时间:</view>
  18. <view class="count">
  19. {{formatDate(new Date(item.end_time))}}
  20. </view>
  21. </view>
  22. </view>
  23. <view v-if="item.total==item.count && item.count!=0" class="go-sign disabled">已报满</view>
  24. <view v-else class="go-sign" :class="{'disabled' : item.time_status!=1}">{{item.time_status==-1?'已结束' : item.time_status==0?'未开始':'去报名'}}</view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class='no-shop' v-if="!listData.length && !loading">
  30. <view class='pictrue' style="margin: 0 auto;">
  31. <image :src="`${domain}/static/images/noCart.png`"></image>
  32. <text>暂无数据!</text>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. // +----------------------------------------------------------------------
  39. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  40. // +----------------------------------------------------------------------
  41. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  42. // +----------------------------------------------------------------------
  43. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  44. // +----------------------------------------------------------------------
  45. // | Author: CRMEB Team <admin@crmeb.com>
  46. // +----------------------------------------------------------------------
  47. import { getRechargeList } from '@/api/user.js'
  48. import {HTTP_REQUEST_URL} from '@/config/app';
  49. import { toLogin } from '@/libs/login.js';
  50. import { mapGetters } from "vuex";
  51. export default {
  52. data() {
  53. return {
  54. domain:HTTP_REQUEST_URL,
  55. loading: false,
  56. listData: [],
  57. count: 0,
  58. pageData: {
  59. page: 1,
  60. limit: 3,
  61. }
  62. }
  63. },
  64. computed:{
  65. ...mapGetters(['isLogin','uid','viewColor']),
  66. },
  67. onLoad() {
  68. this.getListData()
  69. },
  70. methods: {
  71. getListData() {
  72. this.loading = true
  73. uni.showLoading({
  74. title: '数据加载中',
  75. });
  76. getRechargeList(this.pageData).then(res => {
  77. this.count = res.data.count
  78. this.listData = this.listData.concat(res.data.list)
  79. uni.hideLoading();
  80. this.loading = false
  81. })
  82. },
  83. formatDate(date){
  84. let year = date.getFullYear();
  85. let month = date.getMonth()+1;
  86. let day = date.getDate();
  87. month = month < 10 ?'0'+ month : month;
  88. day = day < 10 ?'0'+ day : day;
  89. return year +'-'+ month +'-'+ day;
  90. },
  91. goDetail(item){
  92. if(this.isLogin){
  93. uni.navigateTo({
  94. url: `/pages/activity/registrate_activity/index?id=${item.activity_id}&spid=${this.uid}`
  95. });
  96. }else{
  97. toLogin()
  98. }
  99. },
  100. },
  101. // 滚动到底部
  102. onReachBottom() {
  103. if (this.count == this.listData.length) {
  104. uni.showToast({
  105. title: '没有更多啦',
  106. icon: 'none',
  107. duration: 1000
  108. });
  109. } else {
  110. this.pageData.page += 1
  111. this.getListData()
  112. }
  113. },
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. .application-list {
  118. background-color: #F5F5F5;
  119. padding: 30rpx;
  120. .card-list {
  121. width: 100%;
  122. background-color: #ffffff;
  123. margin-bottom: 30rpx;
  124. border-radius: 16rpx;
  125. .card-top{
  126. background-size: 100%;
  127. background-repeat: no-repeat;
  128. width: 690rpx;
  129. height: 322rpx;
  130. border-radius: 16rpx 16rpx 0 0;
  131. }
  132. .card-bottom {
  133. padding: 30rpx;
  134. .title{
  135. font-size: 30rpx;
  136. color: #333333;
  137. font-weight: bold;
  138. }
  139. .bottom{
  140. margin-top: 30rpx;
  141. align-items: flex-end;
  142. justify-content: space-between;
  143. .item{
  144. display: flex;
  145. align-items: center;
  146. color: #999999;
  147. &:last-child{
  148. margin-top: 20rpx;
  149. }
  150. &::before{
  151. content: "";
  152. width: 6rpx;
  153. height: 6rpx;
  154. background: #FFAA00;
  155. border-radius: 100%;
  156. margin-right: 10rpx;
  157. }
  158. .count{
  159. color: #666666;
  160. text{
  161. color: var(--view-theme);
  162. display: inline-block;
  163. margin-left: 6rpx;
  164. }
  165. }
  166. }
  167. .go-sign{
  168. font-size: 26rpx;
  169. color: #ffffff;
  170. width: 140rpx;
  171. height: 56rpx;
  172. display: flex;
  173. align-items: center;
  174. justify-content: center;
  175. border-radius: 30rpx;
  176. background: var(--view-theme);
  177. &.disabled{
  178. background: #BBBBBB;
  179. }
  180. }
  181. }
  182. }
  183. }
  184. }
  185. .no-shop {
  186. width: 100%;
  187. background-color: #fff;
  188. height: 100vh;
  189. .pictrue {
  190. display: flex;
  191. flex-direction: column;
  192. align-items: center;
  193. color: $uni-nothing-text;
  194. image {
  195. width: 414rpx;
  196. height: 380rpx;
  197. }
  198. }
  199. }
  200. </style>