sop.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="content">
  3. <mescroll-body top="0rpx" bottom="0" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
  4. <view class="sop-list">
  5. <view class="sop-item" v-for="(item) in dataList" @click.stop="navTo('/pages/user/courseSop/sopLosList?sopId='+item.id)" >
  6. <view class="name-box">
  7. <view class="name">{{item.name}}</view>
  8. </view>
  9. <view class="desc-box">
  10. <view class="label">创建时间:</view>
  11. <view class="value">{{item.createTime}}</view>
  12. </view>
  13. </view>
  14. </view>
  15. </mescroll-body>
  16. </view>
  17. </template>
  18. <script>
  19. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  20. import {getCourseSopList} from '@/api/course.js'
  21. export default {
  22. mixins: [MescrollMixin], // 使用mixin
  23. data() {
  24. return {
  25. mescroll:null,
  26. downOption: {
  27. auto:false//不要自动加载
  28. },
  29. upOption: {
  30. onScroll:false,
  31. use: true, // 是否启用上拉加载; 默认true
  32. page: {
  33. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  34. size: 10 // 每页数据的数量,默认10
  35. },
  36. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  37. textNoMore:"已经到底了",
  38. empty: {
  39. icon:'/static/images/empty.png',
  40. tip: '暂无数据'
  41. }
  42. },
  43. dataList: []
  44. }
  45. },
  46. onShow() {
  47. },
  48. methods: {
  49. mescrollInit(mescroll) {
  50. this.mescroll = mescroll;
  51. },
  52. /*下拉刷新的回调 */
  53. downCallback(mescroll) {
  54. mescroll.resetUpScroll()
  55. },
  56. upCallback(page) {
  57. //联网加载数据
  58. var that = this;
  59. var data={
  60. pageNum: page.num,
  61. pageSize: page.size
  62. };
  63. uni.showLoading({
  64. title:"加载中..."
  65. })
  66. getCourseSopList(data).then(res => {
  67. uni.hideLoading()
  68. if(res.code==200){
  69. //设置列表数据
  70. if (page.num == 1) {
  71. that.dataList = res.data.list;
  72. } else {
  73. that.dataList = that.dataList.concat(res.data.list);
  74. }
  75. that.mescroll.endBySize(res.data.list.length, res.data.total);
  76. }else{
  77. uni.showToast({
  78. icon:'none',
  79. title: "请求失败",
  80. });
  81. that.dataList = null;
  82. that.mescroll.endErr();
  83. }
  84. });
  85. },
  86. navTo(url){
  87. uni.navigateTo({
  88. url: url
  89. })
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="scss">
  95. page{
  96. height: 100%;
  97. background: #f6f6f6;
  98. }
  99. </style>
  100. <style scoped lang="scss">
  101. .content{
  102. height: 100%;
  103. padding: 0rpx;
  104. .tabs{
  105. z-index: 10000;
  106. position: absolute;
  107. top:0rpx;
  108. left:0rpx;
  109. height: 88rpx;
  110. background-color: #fff;
  111. width: 100%;
  112. }
  113. .sop-list{
  114. display: flex;
  115. flex-direction: column;
  116. padding: 15rpx;
  117. .sop-item{
  118. padding: 15rpx;
  119. border-radius: 15rpx;
  120. background-color: #fff;
  121. margin-bottom: 15rpx;
  122. width: 100%;
  123. .name-box{
  124. width: 100%;
  125. display: flex;
  126. align-items: center;
  127. justify-content: flex-start;
  128. .name{
  129. flex: 1;
  130. font-size: 32rpx;
  131. color:#111;
  132. }
  133. .btns{
  134. .btn{
  135. margin-left: 10rpx;
  136. width: 40rpx;
  137. height:40rpx;
  138. }
  139. }
  140. }
  141. .desc-box{
  142. margin-top: 15rpx;
  143. width: 100%;
  144. display: flex;
  145. align-items: center;
  146. justify-content: flex-start;
  147. .label{
  148. font-size: 28rpx;
  149. color: #a8a8a8;
  150. }
  151. .value{
  152. font-size: 28rpx;
  153. color: #a8a8a8;
  154. }
  155. }
  156. }
  157. }
  158. }
  159. </style>