certificatesList.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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="loadingType === true && 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.training.image"></image>
  15. <view class="list-tpl">{{ item.training.title }}</view>
  16. </view>
  17. </view>
  18. </scroll-view>
  19. </swiper-item>
  20. </swiper>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. mapState,
  26. mapMutations
  27. } from 'vuex';
  28. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  29. import empty from '@/components/empty';
  30. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  31. import { myTrainingList } from '@/api/index.js';
  32. export default {
  33. components: {
  34. uniLoadMore,
  35. empty,
  36. uniPopup
  37. },
  38. computed: {
  39. ...mapState(['baseURL'])
  40. },
  41. data() {
  42. return {
  43. page: 1, //当前页数
  44. limit: 6, //每次信息条数
  45. list: [],
  46. loadingType: 'more', //加载更多状态
  47. };
  48. },
  49. onLoad() {
  50. console.log(22)
  51. this.loadData();
  52. },
  53. methods: {
  54. //获取订单列表
  55. loadData(type) {
  56. //这里是将订单挂载到tab列表下
  57. let obj = this;
  58. if (type != 'refresh') {
  59. console.log(obj.loadingType, '456');
  60. //没有更多数据直接跳出方法
  61. if (obj.loadingType === 'nomore') {
  62. return;
  63. } else {
  64. // 设置当前为数据载入中
  65. obj.loadingType = 'loading';
  66. }
  67. } else {
  68. //当重新加载数据时更新状态为可继续添加数据
  69. obj.loadingType = 'more';
  70. }
  71. myTrainingList({})
  72. .then(data => {
  73. if (type === 'refresh') {
  74. obj.list = [];
  75. }
  76. let arr = data.data
  77. obj.list = obj.list.concat(arr);
  78. //判断是否还有下一页,有是more 没有是nomore
  79. if (obj.limit == arr.length) {
  80. obj.page++;
  81. obj.loadingType = 'more';
  82. } else {
  83. obj.loadingType = 'nomore';
  84. }
  85. // 判断是否为刷新数据
  86. if (type === 'refresh') {
  87. console.log('refresh');
  88. // 判断是否为点击搜索按钮跳转加载
  89. if (obj.loading == 1) {
  90. uni.hideLoading();
  91. } else {
  92. uni.stopPullDownRefresh();
  93. }
  94. }
  95. })
  96. .catch(e => {
  97. obj.loadingType = 'nomore';
  98. uni.hideLoading();
  99. });
  100. },
  101. //跳转到详情
  102. ToDetail(e) {
  103. let type = e.num == 1 ? '0': '1';//0是个人报名,1是团体报名
  104. // let id = e.id;
  105. uni.navigateTo({
  106. url: '/pages/form/certificates?type=' + type+ '&send_time=' + e.sendtime + '&name=' + encodeURI(e.name)
  107. });
  108. }
  109. }
  110. };
  111. </script>
  112. <style lang="scss">
  113. page {
  114. background: #F2F2F2;
  115. height: 100%;
  116. padding-bottom: 25rpx;
  117. }
  118. .container {
  119. height: 100%;
  120. .top{
  121. background-color: #FFFFFF;
  122. height: 88rpx;
  123. display: flex;
  124. align-items: center;
  125. justify-content: center;
  126. font-size: 36rpx;
  127. font-weight: 500;
  128. color: #333333;
  129. }
  130. .swiper-box {
  131. height:100%;
  132. .list-scroll-content {
  133. height:100%;
  134. }
  135. }
  136. }
  137. .scroll-list {
  138. width: 100%;
  139. overflow: hidden;
  140. white-space: nowrap;
  141. background-color: #ffffff;
  142. font-size: 32rpx;
  143. .scoll-box {
  144. text-align: center;
  145. display: inline-block;
  146. margin: 0rpx 38rpx;
  147. padding: 15rpx 0rpx;
  148. .scoll-img {
  149. width: 130rpx;
  150. height: 85rpx;
  151. border-radius: 100%;
  152. image {
  153. width: 85rpx;
  154. height: 100%;
  155. border-radius: 100%;
  156. }
  157. }
  158. .scoll-name {
  159. padding-top: 15rpx;
  160. }
  161. &.active {
  162. color: #ef3d28;
  163. border-bottom: 6rpx solid #ef3d28;
  164. }
  165. }
  166. }
  167. .order-item {
  168. width: 100%;
  169. padding: 0rpx 25rpx;
  170. padding-top: 25rpx !important;
  171. .list-cell {
  172. background-color: #ffffff;
  173. border-radius: 20rpx;
  174. width: 100%;
  175. box-shadow: 0px 0px 40px 0px rgba(0, 0, 0, 0.06);
  176. .image {
  177. width: 100%;
  178. height: 300rpx;
  179. border-top-left-radius: 25rpx;
  180. border-top-right-radius: 25rpx;
  181. }
  182. .list-tpl {
  183. padding: 25rpx 25rpx;
  184. padding-bottom: 35rpx !important;
  185. font-size: 34rpx;
  186. color: #222222;
  187. font-weight:500;
  188. }
  189. }
  190. }
  191. </style>