details.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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.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. timestampToTime(timestamp) {
  85. var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  86. var Y = date.getFullYear() + '/';
  87. var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1):date.getMonth()+1) + '/';
  88. var D = (date.getDate()< 10 ? '0'+date.getDate():date.getDate())+ ' ';
  89. var h = (date.getHours() < 10 ? '0'+date.getHours():date.getHours())+ ':';
  90. var m = (date.getMinutes() < 10 ? '0'+date.getMinutes():date.getMinutes()) + ':';
  91. var s = date.getSeconds() < 10 ? '0'+date.getSeconds():date.getSeconds();
  92. return Y+M+D+h+m+s;
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss">
  98. .leave {
  99. position: relative;
  100. padding-left: 24rpx;
  101. padding-top: 34rpx;
  102. margin: 0 auto;
  103. margin: 20rpx;
  104. padding-bottom: 20rpx;
  105. background: #FFFFFF;
  106. box-shadow: 0px 5rpx 24rpx 0px rgba(4, 0, 0, 0.06);
  107. border-radius: 15rpx;
  108. .type {
  109. position: absolute;
  110. top: 38rpx;
  111. right: 32rpx;
  112. width: 97rpx;
  113. height: 38rpx;
  114. background: #FCF0D8;
  115. border-radius: 5rpx;
  116. text-align: center;
  117. font-size: 22rpx;
  118. font-weight: 500;
  119. color: #FEA42C;
  120. line-height: 38rpx;
  121. }
  122. .top {
  123. justify-content: start;
  124. margin-bottom: 34rpx;
  125. image {
  126. width: 63rpx;
  127. height: 66rpx;
  128. }
  129. .font {
  130. margin-left: 10rpx;
  131. .title {
  132. font-size: 32rpx;
  133. font-family: PingFang SC;
  134. font-weight: bold;
  135. color: #303338;
  136. }
  137. .time {
  138. font-size: 24rpx;
  139. font-family: PingFang SC;
  140. font-weight: 500;
  141. color: #989DA5;
  142. }
  143. }
  144. }
  145. .leavefont {
  146. font-size: 28rpx;
  147. font-weight: 500;
  148. color: #808080;
  149. margin-bottom: 10rpx;
  150. }
  151. }
  152. </style>