recordList.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view class="my__order">
  3. <view class="my__order-content">
  4. <view class="order_item" v-for="(item,index) in data" :key="index">
  5. <view class="item-top">
  6. <view class="top-box-address">
  7. <u-icon name="map-fill" color="#3D8EFE" size="20"></u-icon>
  8. <p class="top-box-address-text">{{item.positionName}}</p>
  9. </view>
  10. <view class="top-box-time">
  11. {{item.patrolStartTime}}~{{item.patrolEndTime}}
  12. </view>
  13. </view>
  14. <view class="item-cnetent">
  15. <view class="order_info">
  16. <view class="info-1">{{item.signTime}}</view>
  17. <view class="info-2">签到成功</view>
  18. </view>
  19. <view class="order__ok-img">
  20. <u-avatar :src="item.photo" size="56"></u-avatar>
  21. <!-- <image :src="item.photo" mode=""></image> -->
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="line" style="margin-top: 30px;">
  27. <u-loadmore loadmoreText="没有更多了" line />
  28. </view>
  29. <view class="footer">
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import {
  35. getRecordList
  36. } from '@/api/login.js'
  37. export default {
  38. onLoad() {
  39. // this.searchData.pageNumber = 1
  40. // this.data = []
  41. // this.fetchData()
  42. },
  43. onShow() {
  44. this.searchData.pageNumber = 1
  45. this.data = []
  46. this.fetchData()
  47. },
  48. onReachBottom() {
  49. const {
  50. total,
  51. searchData: {
  52. pageNumber,
  53. pageSize
  54. }
  55. } = this
  56. if (total <= (pageNumber - 1) * pageSize) {
  57. return uni.$u.toast('没有更多了')
  58. }
  59. if (this.isLoading) return
  60. this.fetchData()
  61. },
  62. data() {
  63. return {
  64. isLoading: false,
  65. searchData: {
  66. data: {},
  67. pageNumber: 1, // 页码
  68. pageSize: 10 // 每页条数
  69. },
  70. total: 0,
  71. data: [],
  72. src: 'https://img0.baidu.com/it/u=2193304985,460318092&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1715706000&t=0cda76fae9f5a9284e8d2a0d30a92f37'
  73. };
  74. },
  75. methods: {
  76. // 获取列表
  77. async fetchData() {
  78. uni.showLoading({
  79. title: '加载中...',
  80. icon: 'loading',
  81. mask: true
  82. })
  83. this.isLoading = true
  84. try {
  85. const res = await getRecordList(this.searchData)
  86. uni.hideLoading()
  87. if (res.data.records && res.data.records.length > 0) {
  88. this.data = [...this.data, ...res.data.records]
  89. }
  90. this.total = res.data.total
  91. this.searchData.pageNumber++
  92. } finally {
  93. this.isLoading = false
  94. uni.hideLoading()
  95. }
  96. },
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .my__order-content {
  102. padding: 0 12px;
  103. .order_item {
  104. background: #fff;
  105. padding: 12px 8px;
  106. margin-top: 14px;
  107. &:last-child {
  108. margin-bottom: 40px;
  109. }
  110. .item-top {
  111. display: flex;
  112. align-items: center;
  113. justify-content: space-between;
  114. margin-bottom: 7.5px;
  115. .top-box-address {
  116. display: flex;
  117. align-items: center;
  118. margin-bottom: 10px;
  119. font-size: 17px;
  120. .top-box-address-text {
  121. margin-left: 10px;
  122. }
  123. }
  124. .top-box-time {
  125. padding: 5px 10px;
  126. border-radius: 15px;
  127. background: #F0F8FF;
  128. height: 20px;
  129. line-height: 20px;
  130. font-size: 13px;
  131. }
  132. }
  133. .item-cnetent {
  134. display: flex;
  135. align-items: center;
  136. justify-content: space-between;
  137. .order_info {
  138. margin-left: 12px;
  139. .info-1 {
  140. font-size: 16px;
  141. font-weight: 500;
  142. line-height: 30px;
  143. }
  144. .info-2 {
  145. font-size: 15px;
  146. color: #5592E8;
  147. line-height: 22.5px;
  148. }
  149. }
  150. .order__ok-img {
  151. width: 56px;
  152. height: 56px;
  153. border-radius: 50%;
  154. // overflow: hidden;
  155. // image {
  156. // width: 100%;
  157. // height: 100%;
  158. // object-fit: contain;
  159. // }
  160. }
  161. }
  162. }
  163. }
  164. .footer {
  165. height: 40px;
  166. }
  167. </style>
  168. </view>