details.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view class="center">
  3. <scroll-view scroll-y="true">
  4. <view v-for="(item,index) in leaveList" :key="index">
  5. <view class="leave">
  6. <view class="type">审批中</view>
  7. <view class="top flex">
  8. <image src="../../static/img/indexKcpj.png"></image>
  9. <view class="font">
  10. <view class="title">请假</view>
  11. <view class="time">time</view>
  12. </view>
  13. </view>
  14. <view class="leavefont">请假类型:事假</view>
  15. <view class="leavefont">开始时间:2021/3/18上午</view>
  16. <view class="leavefont">结束时间:2021/3/18下午</view>
  17. <view class="leavefont">理由:{{ item.reason }}</view>
  18. </view>
  19. </view>
  20. </scroll-view>
  21. </view>
  22. </template>
  23. <script>
  24. import { getLeave } from '@/api/course.js'
  25. export default {
  26. data() {
  27. return{
  28. page: 1,
  29. limit: 10,
  30. loadingType: 'more',
  31. leaveList:[]
  32. }
  33. },
  34. onLoad() {
  35. this.loadData()
  36. },
  37. //下拉刷新
  38. onPullDownRefresh() {
  39. this.loadData('refresh');
  40. },
  41. //监听页面是否滚动到底部加载更多
  42. onReachBottom() {
  43. this.loadData();
  44. },
  45. methods: {
  46. async loadData(type = 'add', loading){
  47. let obj = this;
  48. if (type === 'add') {
  49. if (obj.loadingType === 'nomore') {
  50. return;
  51. }
  52. obj.loadingType = 'loading';
  53. } else {
  54. obj.loadingType = 'more';
  55. }
  56. if (type === 'refresh') {
  57. // 清空数组
  58. obj.courseList = [];
  59. obj.page = 1
  60. }
  61. //获取反馈列表
  62. getLeave({
  63. page: obj.page,
  64. limit: obj.limit
  65. }).then(e => {
  66. obj.leaveList = obj.leaveList.concat(e.data.data);
  67. console.log(obj.leaveList)
  68. //判断是否还有下一页,有是more 没有是nomore
  69. if (obj.limit==e.data.length) {
  70. obj.page++
  71. obj.loadingType='more'
  72. } else{
  73. obj.loadingType='nomore'
  74. }
  75. if (type === 'refresh') {
  76. if (loading == 1) {
  77. uni.hideLoading();
  78. } else {
  79. uni.stopPullDownRefresh();
  80. }
  81. }
  82. })
  83. },
  84. }
  85. }
  86. </script>
  87. <style lang="scss">
  88. .leave {
  89. position: relative;
  90. padding-left: 24rpx;
  91. padding-top: 34rpx;
  92. margin: 0 auto;
  93. margin: 20rpx;
  94. padding-bottom: 20rpx;
  95. background: #FFFFFF;
  96. box-shadow: 0px 5rpx 24rpx 0px rgba(4, 0, 0, 0.06);
  97. border-radius: 15rpx;
  98. .type {
  99. position: absolute;
  100. top: 38rpx;
  101. right: 32rpx;
  102. width: 97rpx;
  103. height: 38rpx;
  104. background: #FCF0D8;
  105. border-radius: 5rpx;
  106. text-align: center;
  107. font-size: 22rpx;
  108. font-weight: 500;
  109. color: #FEA42C;
  110. line-height: 38rpx;
  111. }
  112. .top {
  113. justify-content: start;
  114. margin-bottom: 34rpx;
  115. image {
  116. width: 63rpx;
  117. height: 66rpx;
  118. }
  119. .font {
  120. margin-left: 10rpx;
  121. .title {
  122. font-size: 32rpx;
  123. font-family: PingFang SC;
  124. font-weight: bold;
  125. color: #303338;
  126. }
  127. .time {
  128. font-size: 24rpx;
  129. font-family: PingFang SC;
  130. font-weight: 500;
  131. color: #989DA5;
  132. }
  133. }
  134. }
  135. .leavefont {
  136. font-size: 28rpx;
  137. font-weight: 500;
  138. color: #808080;
  139. margin-bottom: 10rpx;
  140. }
  141. }
  142. </style>