track.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view class="container">
  3. <!-- 顶部筛选区域 -->
  4. <view class="search">
  5. <uni-datetime-picker v-model="datetimerangeValue" type="datetimerange" rangeSeparator="至" :clear-icon="false" @change="changeTime" />
  6. </view>
  7. <!-- 地图区域 -->
  8. <view class="map">
  9. <MapContainer />
  10. </view>
  11. <!-- 轨迹区域 -->
  12. <view class="track">
  13. <view class="track_title">全天状态</view>
  14. <!-- 步骤条区域 -->
  15. <uv-steps activeColor="#1E7DFB" direction="column" dot :current="list.length" v-if="list.length">
  16. <uv-steps-item v-for="item in list" :key="item.id" :customStyle="customStyle">
  17. <template v-slot:title>
  18. <view class="track_time">
  19. {{ item.type }}
  20. </view>
  21. </template>
  22. <template v-slot:desc>
  23. <view class="track_desc">地点:{{ item.location }}</view>
  24. <view class="track_desc">时间:{{ item.dateTime }}</view>
  25. <view class="track_desc" v-if="item.image">
  26. 图片:
  27. <img class="img" mode="aspectFill" :src="item.image" @click="previewImage(item.image)" />
  28. </view>
  29. </template>
  30. </uv-steps-item>
  31. </uv-steps>
  32. <NoData v-else />
  33. </view>
  34. </view>
  35. </template>
  36. <script setup>
  37. import { ref } from 'vue'
  38. import { onLoad } from '@dcloudio/uni-app'
  39. import MapContainer from '@/components/MapContainer.vue'
  40. import NoData from '@/components/noData.vue'
  41. import { myRequest } from '@/utils/api.js'
  42. import { previewImage } from '@/utils/previewImage.js'
  43. import { decryptDes } from '@/utils/des.js'
  44. import dayjs from 'dayjs'
  45. onLoad((options) => {
  46. currentId.value = options.id
  47. datetimerangeValue.value = [dayjs(Date.now() - 24 * 3600 * 1000).format('YYYY-MM-DD hh:mm:ss'), dayjs(Date.now()).format('YYYY-MM-DD hh:mm:ss')]
  48. getData()
  49. })
  50. const currentId = ref()
  51. const datetimerangeValue = ref()
  52. // 学生轨迹数组
  53. const list = ref([])
  54. // 步骤条样式
  55. const customStyle = {
  56. marginBottom: '30rpx'
  57. }
  58. const getData = async () => {
  59. const res = await myRequest({
  60. url: '/wanzai/api/smartFaceDiscern/track',
  61. data: {
  62. id: currentId.value,
  63. startTime: datetimerangeValue.value[0],
  64. endTime: datetimerangeValue.value[1]
  65. }
  66. })
  67. // console.log(res)
  68. if (res.code == 200) {
  69. const result = JSON.parse(decryptDes(res.data))
  70. // console.log(result)
  71. list.value = result
  72. }
  73. }
  74. const changeTime = (e) => {
  75. // console.log(e)
  76. if (e.length) {
  77. getData()
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .container {
  83. display: flex;
  84. flex-direction: column;
  85. min-height: 100vh;
  86. background-color: #f1f6fe;
  87. // 顶部筛选区域样式
  88. .search {
  89. display: flex;
  90. justify-content: space-evenly;
  91. padding: 0 30rpx;
  92. margin: 30rpx 0;
  93. height: 65rpx;
  94. }
  95. // 地图区域样式
  96. .map {
  97. width: 750rpx;
  98. height: 469rpx;
  99. }
  100. // 轨迹区域样式
  101. .track {
  102. padding: 0 20rpx 20rpx 20rpx;
  103. .track_title {
  104. margin: 30rpx 0;
  105. font-size: 32rpx;
  106. font-weight: bold;
  107. }
  108. .track_time {
  109. font-size: 28rpx;
  110. font-weight: bold;
  111. }
  112. .track_desc {
  113. display: flex;
  114. margin-top: 10rpx;
  115. color: #808080;
  116. font-size: 24rpx;
  117. .img {
  118. width: 100rpx;
  119. height: 160rpx;
  120. }
  121. }
  122. }
  123. }
  124. </style>