history.nvue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="page">
  3. <!-- 状态栏占位 -->
  4. <view class="status-bar" :style="{height: statusBarHeight + 'px'}"></view>
  5. <!-- 自定义导航栏 -->
  6. <view class="nav-bar">
  7. <image src="/static/public/backBlack.png" mode="aspectFill" class="back-img" @click="goBack"></image>
  8. <text class="nav-title">使用记录</text>
  9. <view class="nav-right"></view>
  10. </view>
  11. <!-- 使用记录列表 -->
  12. <list class="history-list" v-if="list.length > 0">
  13. <cell v-for="(itm, index) in list" :key="index">
  14. <view class="history-item">
  15. <view class="history-top-line">
  16. <text class="history-name">{{itm.name || '未知设备'}}</text>
  17. <text class="history-type">{{itm.type || ''}}</text>
  18. </view>
  19. <text class="history-time">{{itm.createTime || ''}}</text>
  20. </view>
  21. </cell>
  22. </list>
  23. <!-- 空状态 -->
  24. <view class="empty-wrap" v-else>
  25. <text class="empty-text">暂无使用记录</text>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. statusBarHeight: 44,
  34. list: [],
  35. page: 1
  36. }
  37. },
  38. onLoad() {
  39. const sysInfo = uni.getSystemInfoSync()
  40. this.statusBarHeight = sysInfo.statusBarHeight || 44
  41. this.init()
  42. },
  43. onPullDownRefresh() {
  44. this.page = 1
  45. this.list = []
  46. this.init()
  47. },
  48. onReachBottom() {
  49. this.page++
  50. this.init()
  51. },
  52. methods: {
  53. goBack() {
  54. uni.navigateBack()
  55. },
  56. init() {
  57. // TODO: 后续对接后台接口获取使用记录
  58. uni.stopPullDownRefresh()
  59. }
  60. }
  61. }
  62. </script>
  63. <style>
  64. .page {
  65. flex: 1;
  66. background-color: #FFFFFF;
  67. }
  68. .status-bar {
  69. background-color: #FFFFFF;
  70. }
  71. .nav-bar {
  72. flex-direction: row;
  73. align-items: center;
  74. justify-content: space-between;
  75. height: 88rpx;
  76. padding-left: 54rpx;
  77. padding-right: 54rpx;
  78. background-color: #FFFFFF;
  79. }
  80. .back-img {
  81. width: 50rpx;
  82. height: 50rpx;
  83. }
  84. .nav-title {
  85. font-weight: bold;
  86. font-size: 32rpx;
  87. color: #545F71;
  88. }
  89. .nav-right {
  90. width: 50rpx;
  91. height: 50rpx;
  92. }
  93. /* 使用记录列表 */
  94. .history-list {
  95. flex: 1;
  96. margin-left: 38rpx;
  97. margin-right: 38rpx;
  98. }
  99. .history-item {
  100. padding-top: 20rpx;
  101. padding-bottom: 20rpx;
  102. border-bottom-width: 1px;
  103. border-bottom-color: #EEF1F4;
  104. border-bottom-style: solid;
  105. }
  106. .history-top-line {
  107. flex-direction: row;
  108. justify-content: space-between;
  109. margin-bottom: 6rpx;
  110. }
  111. .history-name {
  112. font-size: 32rpx;
  113. color: #545F71;
  114. line-height: 44rpx;
  115. }
  116. .history-type {
  117. font-size: 26rpx;
  118. color: #9BA5B7;
  119. line-height: 44rpx;
  120. }
  121. .history-time {
  122. font-size: 26rpx;
  123. color: #9BA5B7;
  124. line-height: 44rpx;
  125. }
  126. /* 空状态 */
  127. .empty-wrap {
  128. flex: 1;
  129. align-items: center;
  130. padding-top: 200rpx;
  131. }
  132. .empty-text {
  133. font-size: 28rpx;
  134. color: #9BA5B7;
  135. }
  136. </style>