certificatesList.vue 3.9 KB

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