track.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <view class="container">
  3. <!-- 顶部筛选区域 -->
  4. <view class="search">
  5. <view class="search_box" :class="{ active: item.value === activeIndex }" v-for="item in searchList" :key="item.value" @click="changeIndex(item.value)">
  6. {{ item.text }}
  7. </view>
  8. </view>
  9. <!-- 地图区域 -->
  10. <view class="map">
  11. <MapContainer />
  12. </view>
  13. <!-- 轨迹区域 -->
  14. <view class="track">
  15. <view class="track_title">全天状态</view>
  16. <!-- 步骤条区域 -->
  17. <uv-steps activeColor="#1E7DFB" direction="column" dot :current="list.length" v-if="list.length">
  18. <uv-steps-item v-for="item in list" :key="item.id" :customStyle="customStyle">
  19. <template v-slot:title>
  20. <view class="track_time">
  21. {{ item.type }}
  22. </view>
  23. </template>
  24. <template v-slot:desc>
  25. <view class="track_desc">地点:{{ item.location }}</view>
  26. <view class="track_desc">时间:{{ item.dateTime }}</view>
  27. <view class="track_desc" v-if="item.image">
  28. 图片:
  29. <img class="img" mode="aspectFill" :src="item.image" @click="previewImage(item.image)" />
  30. </view>
  31. </template>
  32. </uv-steps-item>
  33. </uv-steps>
  34. <NoData v-else />
  35. </view>
  36. </view>
  37. </template>
  38. <script setup>
  39. import { ref } from 'vue'
  40. import { onLoad } from '@dcloudio/uni-app'
  41. import MapContainer from '@/components/MapContainer.vue'
  42. import NoData from '@/components/noData.vue'
  43. import { myRequest } from '@/utils/api.js'
  44. import { previewImage } from '@/utils/previewImage.js'
  45. import { decryptDes } from '@/utils/des.js'
  46. onLoad((options) => {
  47. currentId.value = options.id
  48. getData()
  49. })
  50. const currentId = ref()
  51. // 筛选区域当前索引
  52. const activeIndex = ref(0)
  53. // 筛选区域数组
  54. const searchList = ref([
  55. {
  56. value: 0,
  57. text: '今天'
  58. },
  59. {
  60. value: 1,
  61. text: '昨天'
  62. },
  63. {
  64. value: 2,
  65. text: '前天'
  66. }
  67. ])
  68. // 学生轨迹数组
  69. const list = ref([])
  70. // 步骤条样式
  71. const customStyle = {
  72. marginBottom: '30rpx'
  73. }
  74. const getData = async () => {
  75. const res = await myRequest({
  76. url: '/wanzai/api/smartFaceDiscern/track',
  77. data: {
  78. id: currentId.value,
  79. dateTime: activeIndex.value
  80. }
  81. })
  82. // console.log(res)
  83. if (res.code == 200) {
  84. const result = JSON.parse(decryptDes(res.data))
  85. // console.log(result)
  86. list.value = result
  87. }
  88. }
  89. // 切换筛选时间时的函数
  90. const changeIndex = (v) => {
  91. activeIndex.value = v
  92. getData()
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. .container {
  97. display: flex;
  98. flex-direction: column;
  99. min-height: 100vh;
  100. background-color: #f1f6fe;
  101. // 顶部筛选区域样式
  102. .search {
  103. display: flex;
  104. justify-content: space-evenly;
  105. margin: 30rpx 0;
  106. height: 65rpx;
  107. .search_box {
  108. display: flex;
  109. justify-content: center;
  110. align-items: center;
  111. box-sizing: border-box;
  112. width: 195rpx;
  113. height: 65rpx;
  114. font-size: 28rpx;
  115. border-radius: 72rpx;
  116. background-color: #fff;
  117. }
  118. .active {
  119. color: #1e7dfb;
  120. border: 1rpx solid #1e7dfb;
  121. }
  122. }
  123. // 地图区域样式
  124. .map {
  125. width: 750rpx;
  126. height: 469rpx;
  127. }
  128. // 轨迹区域样式
  129. .track {
  130. padding: 0 20rpx 20rpx 20rpx;
  131. .track_title {
  132. margin: 30rpx 0;
  133. font-size: 32rpx;
  134. font-weight: bold;
  135. }
  136. .track_time {
  137. font-size: 28rpx;
  138. font-weight: bold;
  139. }
  140. .track_desc {
  141. display: flex;
  142. margin-top: 10rpx;
  143. color: #808080;
  144. font-size: 24rpx;
  145. .img {
  146. width: 100rpx;
  147. height: 160rpx;
  148. }
  149. }
  150. }
  151. }
  152. </style>