geomagDetails.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view class="details">
  3. <z-paging ref="paging" v-model="list" @query="queryList">
  4. <view class="details-tabs" slot="top">
  5. <u-tabs :list="tabList" @click="tabClick" lineWidth="40"></u-tabs>
  6. </view>
  7. <view class="details-list">
  8. <view class="details-list-item" v-for="(item, index) in list" :key="index" @click="jumpPage('pages/index/deviceDetails/deviceDetails', { type: 1 })">
  9. <view class="details-list-item-header">
  10. <view>{{ item.roadNo }}</view>
  11. <view>{{ item.signal }}信号</view>
  12. </view>
  13. <view class="details-list-item-cardNo">
  14. {{ item.cardNum }}
  15. </view>
  16. <view class="details-list-item-img">
  17. <u--image v-if="item.cardNum" src="../../../static/icons/has-car-icon.svg" width="152rpx" height="152rpx"></u--image>
  18. <u--image v-else src="../../../static/icons/no-car-icon.svg" width="152rpx" height="152rpx"></u--image>
  19. </view>
  20. <view class="details-list-item-time">
  21. {{ item.inTime ? getTimeLong(item.inTime) : '' }}
  22. </view>
  23. <view class="details-list-item-bottom">
  24. <view>{{ item.deviceNo }}</view>
  25. <view>
  26. <view>{{ item.electric }}V</view>
  27. <view class="ele">
  28. <u--image v-if="item.electric < 10" src="../../../static/icons/no-ele-icon.svg" width="48rpx" height="48rpx"></u--image>
  29. <u--image v-else src="../../../static/icons/has-ele-icon.svg" width="48rpx" height="48rpx"></u--image>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </z-paging>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. roadInfo: {
  43. roadName: ''
  44. },
  45. tabList: [{
  46. name: '全部',
  47. value: ''
  48. },
  49. {
  50. name: '异常',
  51. value: 1
  52. },
  53. {
  54. name: '低电量',
  55. value: 2
  56. },
  57. {
  58. name: '低信号',
  59. value: 3
  60. }
  61. ],
  62. list: []
  63. }
  64. },
  65. onLoad(page) {
  66. if (page.roadName) {
  67. this.roadInfo.roadName = page.roadName
  68. uni.setNavigationBarTitle({
  69. title: page.roadName
  70. })
  71. }
  72. },
  73. methods: {
  74. queryList(pageNo, pageSize) {
  75. this.$refs.paging.complete([{
  76. roadNo: 'KC001',
  77. signal: '-90',
  78. inTime: '2021-12-17 09:30:50',
  79. cardNum: '贵A12345',
  80. deviceNo: '202103051265',
  81. electric: 9.9
  82. }, {
  83. roadNo: 'KC001',
  84. signal: '-90',
  85. inTime: '',
  86. cardNum: '',
  87. deviceNo: '202103051265',
  88. electric: 10
  89. }])
  90. },
  91. tabClick(val) {
  92. console.log(val)
  93. },
  94. getTimeLong(date) {
  95. const nowDate = (new Date()).valueOf()
  96. const curDate = (new Date(date)).valueOf()
  97. const timeLen = (nowDate - curDate) / 1000
  98. const day = parseInt(timeLen / (24 * 3600));
  99. const hour = parseInt((timeLen - day * 24 * 3600) / 3600);
  100. const minutes = parseInt((timeLen - day * 24 * 3600 - hour * 3600) / 60)
  101. const second = parseInt(timeLen % 60)
  102. return `${day}天${hour}时${minutes}分${second}秒`
  103. },
  104. jumpPage(url, params) {
  105. uni.$u.route({
  106. url, params
  107. })
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss" scoped>
  113. page {
  114. min-height: calc(100vh - 88rpx);
  115. background-color: #F6F6FF;
  116. }
  117. .details {
  118. font-family: 'PingFangSC-regular';
  119. &-tabs {
  120. background-color: #fff;
  121. }
  122. &-list {
  123. padding: 40rpx 20rpx;
  124. display: flex;
  125. justify-content: space-between;
  126. flex-wrap: wrap;
  127. &-item {
  128. width: calc(50% - 52rpx);
  129. background-color: #fff;
  130. border-radius: 16rpx;
  131. padding: 20rpx;
  132. margin-bottom: 20rpx;
  133. &-header {
  134. display: flex;
  135. justify-content: space-between;
  136. color: #101010;
  137. font-size: 26rpx;
  138. }
  139. &-cardNo {
  140. text-align: center;
  141. color: #101010;
  142. height: 40rpx;
  143. line-height: 40rpx;
  144. font-size: 26rpx;
  145. margin-bottom: 10rpx;
  146. }
  147. &-img {
  148. width: 152rpx;
  149. height: 152rpx;
  150. margin: 0 auto;
  151. }
  152. &-time {
  153. text-align: center;
  154. margin-top: 12rpx;
  155. margin-bottom: 20rpx;
  156. font-size: 26rpx;
  157. color: #101010;
  158. height: 40rpx;
  159. overflow: hidden;
  160. text-overflow: ellipsis;
  161. white-space: nowrap;
  162. }
  163. &-bottom {
  164. display: flex;
  165. justify-content: space-between;
  166. align-items: center;
  167. font-size: 24rpx;
  168. color: #101010;
  169. view {
  170. &:last-child {
  171. display: flex;
  172. align-items: center;
  173. }
  174. }
  175. .ele {
  176. transform: rotate(-90deg);
  177. }
  178. }
  179. }
  180. }
  181. }
  182. </style>