track.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. if (options.time) {
  48. datetimerangeValue.value = [options.time, options.time.slice(0, 10) + ' 23:59:59']
  49. } else {
  50. datetimerangeValue.value = [dayjs(Date.now()).format('YYYY-MM-DD') + ' 00:00:00', dayjs(Date.now()).format('YYYY-MM-DD') + ' 23:59:59']
  51. }
  52. getData()
  53. })
  54. const currentId = ref()
  55. const datetimerangeValue = ref()
  56. // 学生轨迹数组
  57. const list = ref([])
  58. // 步骤条样式
  59. const customStyle = {
  60. marginBottom: '30rpx'
  61. }
  62. const getData = async () => {
  63. const res = await myRequest({
  64. url: '/wanzai/api/smartFaceDiscern/track',
  65. data: {
  66. id: currentId.value,
  67. startTime: datetimerangeValue.value[0],
  68. endTime: datetimerangeValue.value[1]
  69. }
  70. })
  71. // console.log(res)
  72. if (res.code == 200) {
  73. const result = JSON.parse(decryptDes(res.data))
  74. // console.log(result)
  75. list.value = result
  76. }
  77. }
  78. const changeTime = (e) => {
  79. // console.log(e)
  80. if (e.length) {
  81. getData()
  82. }
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .container {
  87. display: flex;
  88. flex-direction: column;
  89. min-height: 100vh;
  90. background-color: #f1f6fe;
  91. // 顶部筛选区域样式
  92. .search {
  93. display: flex;
  94. justify-content: space-evenly;
  95. padding: 0 30rpx;
  96. margin: 30rpx 0;
  97. height: 65rpx;
  98. }
  99. // 地图区域样式
  100. .map {
  101. width: 750rpx;
  102. height: 469rpx;
  103. }
  104. // 轨迹区域样式
  105. .track {
  106. padding: 0 20rpx 20rpx 20rpx;
  107. .track_title {
  108. margin: 30rpx 0;
  109. font-size: 32rpx;
  110. font-weight: bold;
  111. }
  112. .track_time {
  113. font-size: 28rpx;
  114. font-weight: bold;
  115. }
  116. .track_desc {
  117. display: flex;
  118. margin-top: 10rpx;
  119. color: #808080;
  120. font-size: 24rpx;
  121. .img {
  122. width: 100rpx;
  123. height: 160rpx;
  124. }
  125. }
  126. }
  127. }
  128. </style>