index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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" v-if="item.title != '救护员培训'">
  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. nactt() {
  85. // @click="navTo('http://www.crcntc.org.cn/spring/wx/user/main/outLogin?userId=2c91ebf16f0c3201016f0dc5cebc23a3')"
  86. },
  87. //获取订单列表
  88. loadData(type) {
  89. let obj = this;
  90. if(obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
  91. return
  92. }
  93. obj.loadingType = 'loading'
  94. training({
  95. page: obj.page,
  96. limit: obj.limit,
  97. })
  98. .then(data => {
  99. data.data.forEach(item => {});
  100. let arr = data.data;
  101. obj.list = obj.list.concat(arr);
  102. obj.page++;
  103. if (obj.limit == arr.length) {
  104. obj.loadingType = 'more';
  105. } else {
  106. obj.loadingType = 'noMore';
  107. }
  108. obj.loaded = true
  109. })
  110. .catch(e => {
  111. obj.loadingType = 'noMore';
  112. });
  113. },
  114. //跳转到详情
  115. ToDetail(e) {
  116. let type = e.type;
  117. let id = e.id;
  118. // console.log(e.)
  119. if(e.is_create) {
  120. uni.showModal({
  121. title: '提示',
  122. content: '您已报名,无需再次报名'
  123. })
  124. return
  125. }
  126. // if(e.)
  127. if(e.title == '救护员培训') {
  128. window.location.href = 'http://www.crcntc.org.cn/spring/wx/user/main/outLogin?userId=2c91ebf16f0c3201016f0dc5cebc23a3'
  129. }else {
  130. uni.navigateTo({
  131. url: '/pages/train/sign?id=' + id
  132. });
  133. }
  134. }
  135. }
  136. };
  137. </script>
  138. <style lang="scss">
  139. page {
  140. background: #f2f2f2;
  141. height: 100%;
  142. padding-bottom: 25rpx;
  143. }
  144. .container {
  145. height: 100%;
  146. .top {
  147. background-color: #ffffff;
  148. height: 88rpx;
  149. display: flex;
  150. align-items: center;
  151. justify-content: center;
  152. font-size: 36rpx;
  153. font-weight: 500;
  154. color: #333333;
  155. }
  156. .swiper-box {
  157. height: 100%;
  158. .list-scroll-content {
  159. height: 100%;
  160. }
  161. }
  162. }
  163. .scroll-list {
  164. width: 100%;
  165. overflow: hidden;
  166. white-space: nowrap;
  167. background-color: #ffffff;
  168. font-size: 32rpx;
  169. .scoll-box {
  170. text-align: center;
  171. display: inline-block;
  172. margin: 0rpx 38rpx;
  173. padding: 15rpx 0rpx;
  174. .scoll-img {
  175. width: 130rpx;
  176. height: 85rpx;
  177. border-radius: 100%;
  178. image {
  179. width: 85rpx;
  180. height: 100%;
  181. border-radius: 100%;
  182. }
  183. }
  184. .scoll-name {
  185. padding-top: 15rpx;
  186. }
  187. &.active {
  188. color: #ef3d28;
  189. border-bottom: 6rpx solid #ef3d28;
  190. }
  191. }
  192. }
  193. .order-item {
  194. width: 100%;
  195. padding: 0rpx 25rpx;
  196. padding-top: 25rpx !important;
  197. .list-cell {
  198. background-color: #ffffff;
  199. border-radius: 20rpx;
  200. width: 100%;
  201. box-shadow: 0px 0px 40px 0px rgba(0, 0, 0, 0.06);
  202. .image {
  203. width: 100%;
  204. height: 300rpx;
  205. border-top-left-radius: 25rpx;
  206. border-top-right-radius: 25rpx;
  207. }
  208. .list-tpl {
  209. padding: 25rpx 25rpx;
  210. padding-bottom: 0rpx !important;
  211. font-size: 34rpx;
  212. color: #222222;
  213. font-weight: 500;
  214. }
  215. .list-tip {
  216. padding: 10rpx 25rpx 35rpx;
  217. font-size: 24rpx;
  218. color: #b4b4b4;
  219. }
  220. .info-box {
  221. padding: 0 25rpx 35rpx;
  222. .list-info {
  223. margin-top: 10rpx;
  224. display: flex;
  225. justify-content: flex-start;
  226. align-items: center;
  227. image{
  228. width: 24rpx;
  229. height: 24rpx;
  230. }
  231. .list-font {
  232. margin-left: 6rpx;
  233. font-size: 24rpx;
  234. }
  235. }
  236. }
  237. }
  238. }
  239. </style>