index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view class="container">
  3. <!-- <view class="top">
  4. 普及培训
  5. </view> -->
  6. <swiper class="swiper-box" duration="300" @change="changeTab">
  7. <swiper-item class="tab-content">
  8. <scroll-view class="list-scroll-content" scroll-y>
  9. <!-- 空白页 -->
  10. <empty v-if="loaded && list.length === 0"></empty>
  11. <!-- 订单列表 -->
  12. <view class="order-item" @click="ToDetail(item)" v-for="(item, index) in list" :key="index">
  13. <view class="list-cell">
  14. <image class="image" :src="baseURL + item.image"></image>
  15. <view class="list-tpl">{{ item.title }}</view>
  16. <view class="list-tip">{{ item.info }}</view>
  17. <view class="info-box">
  18. <view class="list-info">
  19. <image src="../../static/img/time.png" mode=""></image>
  20. <view class="list-font">
  21. 开始时间:{{ item.reg_start }}
  22. </view>
  23. </view>
  24. <view class="list-info">
  25. <image src="../../static/img/time.png" mode=""></image>
  26. <view class="list-font">
  27. 结束时间:{{ item.reg_end }}
  28. </view>
  29. </view>
  30. <view class="flex">
  31. <view class="list-info" style="width: 50%;">
  32. <image src="../../static/img/people.png" mode=""></image>
  33. <view class="list-font">
  34. 当前报名人数:{{ item.number }}
  35. </view>
  36. </view>
  37. <view class="list-info" style="width: 50%;">
  38. <image src="../../static/img/people.png" mode=""></image>
  39. <view class="list-font">
  40. 最大报名人数:{{ item.max_number || 0 }}
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </scroll-view>
  48. </swiper-item>
  49. </swiper>
  50. </view>
  51. </template>
  52. <script>
  53. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  54. import empty from '@/components/empty';
  55. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  56. import { training } from '@/api/index.js';
  57. import { mapState, mapMutations } from 'vuex';
  58. export default {
  59. components: {
  60. uniLoadMore,
  61. empty,
  62. uniPopup
  63. },
  64. data() {
  65. return {
  66. page: 1, //当前页数
  67. limit: 6, //每次信息条数
  68. list: [],
  69. loadingType: 'more' ,//加载更多状态
  70. loaded: false
  71. };
  72. },
  73. computed: {
  74. ...mapState(['baseURL'])
  75. },
  76. onLoad() {
  77. console.log(22);
  78. this.loadData();
  79. },
  80. onReachBottom() {
  81. this.loadData();
  82. },
  83. methods: {
  84. //获取订单列表
  85. loadData(type) {
  86. let obj = this;
  87. if(obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
  88. return
  89. }
  90. obj.loadingType = 'loading'
  91. training({
  92. page: obj.page,
  93. limit: obj.limit,
  94. })
  95. .then(data => {
  96. data.data.forEach(item => {});
  97. let arr = data.data;
  98. obj.list = obj.list.concat(arr);
  99. obj.page++;
  100. if (obj.limit == arr.length) {
  101. obj.loadingType = 'more';
  102. } else {
  103. obj.loadingType = 'noMore';
  104. }
  105. obj.loaded = true
  106. })
  107. .catch(e => {
  108. obj.loadingType = 'noMore';
  109. });
  110. },
  111. //跳转到详情
  112. ToDetail(e) {
  113. let type = e.type;
  114. let id = e.id;
  115. // console.log(e.)
  116. if(e.is_create) {
  117. uni.showModal({
  118. title: '提示',
  119. content: '您已报名,无需再次报名'
  120. })
  121. return
  122. }
  123. uni.navigateTo({
  124. url: '/pages/train/sign?id=' + id
  125. });
  126. }
  127. }
  128. };
  129. </script>
  130. <style lang="scss">
  131. page {
  132. background: #f2f2f2;
  133. height: 100%;
  134. padding-bottom: 25rpx;
  135. }
  136. .container {
  137. height: 100%;
  138. .top {
  139. background-color: #ffffff;
  140. height: 88rpx;
  141. display: flex;
  142. align-items: center;
  143. justify-content: center;
  144. font-size: 36rpx;
  145. font-weight: 500;
  146. color: #333333;
  147. }
  148. .swiper-box {
  149. height: 100%;
  150. .list-scroll-content {
  151. height: 100%;
  152. }
  153. }
  154. }
  155. .scroll-list {
  156. width: 100%;
  157. overflow: hidden;
  158. white-space: nowrap;
  159. background-color: #ffffff;
  160. font-size: 32rpx;
  161. .scoll-box {
  162. text-align: center;
  163. display: inline-block;
  164. margin: 0rpx 38rpx;
  165. padding: 15rpx 0rpx;
  166. .scoll-img {
  167. width: 130rpx;
  168. height: 85rpx;
  169. border-radius: 100%;
  170. image {
  171. width: 85rpx;
  172. height: 100%;
  173. border-radius: 100%;
  174. }
  175. }
  176. .scoll-name {
  177. padding-top: 15rpx;
  178. }
  179. &.active {
  180. color: #ef3d28;
  181. border-bottom: 6rpx solid #ef3d28;
  182. }
  183. }
  184. }
  185. .order-item {
  186. width: 100%;
  187. padding: 0rpx 25rpx;
  188. padding-top: 25rpx !important;
  189. .list-cell {
  190. background-color: #ffffff;
  191. border-radius: 20rpx;
  192. width: 100%;
  193. box-shadow: 0px 0px 40px 0px rgba(0, 0, 0, 0.06);
  194. .image {
  195. width: 100%;
  196. height: 300rpx;
  197. border-top-left-radius: 25rpx;
  198. border-top-right-radius: 25rpx;
  199. }
  200. .list-tpl {
  201. padding: 25rpx 25rpx;
  202. padding-bottom: 0rpx !important;
  203. font-size: 34rpx;
  204. color: #222222;
  205. font-weight: 500;
  206. }
  207. .list-tip {
  208. padding: 10rpx 25rpx 35rpx;
  209. font-size: 24rpx;
  210. color: #b4b4b4;
  211. }
  212. .info-box {
  213. padding: 0 25rpx 35rpx;
  214. .list-info {
  215. margin-top: 10rpx;
  216. display: flex;
  217. justify-content: flex-start;
  218. align-items: center;
  219. image{
  220. width: 24rpx;
  221. height: 24rpx;
  222. }
  223. .list-font {
  224. margin-left: 6rpx;
  225. font-size: 24rpx;
  226. }
  227. }
  228. }
  229. }
  230. }
  231. </style>