certificatesList.vue 3.9 KB

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