certificatesList.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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" v-if="item.project_area == 0">
  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. page: 1,
  66. limit: 100
  67. })
  68. .then(data => {
  69. if (type === 'refresh') {
  70. obj.list = [];
  71. }
  72. let arr = data.data
  73. obj.list = obj.list.concat(arr);
  74. //判断是否还有下一页,有是more 没有是nomore
  75. if (obj.limit == arr.length) {
  76. obj.page++;
  77. obj.loadingType = 'more';
  78. } else {
  79. obj.loadingType = 'nomore';
  80. }
  81. // 判断是否为刷新数据
  82. if (type === 'refresh') {
  83. console.log('refresh');
  84. // 判断是否为点击搜索按钮跳转加载
  85. if (obj.loading == 1) {
  86. uni.hideLoading();
  87. } else {
  88. uni.stopPullDownRefresh();
  89. }
  90. }
  91. })
  92. .catch(e => {
  93. obj.loadingType = 'nomore';
  94. uni.hideLoading();
  95. });
  96. },
  97. //跳转到详情
  98. ToDetail(e) {
  99. let type = e.type;
  100. let id = e.id;
  101. uni.navigateTo({
  102. url: '/pages/form/certificates?type=' + type+'&id='+id
  103. });
  104. }
  105. }
  106. };
  107. </script>
  108. <style lang="scss">
  109. page {
  110. background: #F2F2F2;
  111. height: 100%;
  112. padding-bottom: 25rpx;
  113. }
  114. .container {
  115. height: 100%;
  116. .top{
  117. background-color: #FFFFFF;
  118. height: 88rpx;
  119. display: flex;
  120. align-items: center;
  121. justify-content: center;
  122. font-size: 36rpx;
  123. font-weight: 500;
  124. color: #333333;
  125. }
  126. .swiper-box {
  127. height:100%;
  128. .list-scroll-content {
  129. height:100%;
  130. }
  131. }
  132. }
  133. .scroll-list {
  134. width: 100%;
  135. overflow: hidden;
  136. white-space: nowrap;
  137. background-color: #ffffff;
  138. font-size: 32rpx;
  139. .scoll-box {
  140. text-align: center;
  141. display: inline-block;
  142. margin: 0rpx 38rpx;
  143. padding: 15rpx 0rpx;
  144. .scoll-img {
  145. width: 130rpx;
  146. height: 85rpx;
  147. border-radius: 100%;
  148. image {
  149. width: 85rpx;
  150. height: 100%;
  151. border-radius: 100%;
  152. }
  153. }
  154. .scoll-name {
  155. padding-top: 15rpx;
  156. }
  157. &.active {
  158. color: #ef3d28;
  159. border-bottom: 6rpx solid #ef3d28;
  160. }
  161. }
  162. }
  163. .order-item {
  164. width: 100%;
  165. padding: 0rpx 25rpx;
  166. padding-top: 25rpx !important;
  167. .list-cell {
  168. background-color: #ffffff;
  169. border-radius: 20rpx;
  170. width: 100%;
  171. box-shadow: 0px 0px 40px 0px rgba(0, 0, 0, 0.06);
  172. .image {
  173. width: 100%;
  174. height: 300rpx;
  175. border-top-left-radius: 25rpx;
  176. border-top-right-radius: 25rpx;
  177. }
  178. .list-tpl {
  179. padding: 25rpx 25rpx;
  180. padding-bottom: 35rpx !important;
  181. font-size: 34rpx;
  182. color: #222222;
  183. font-weight:500;
  184. }
  185. }
  186. }
  187. </style>