track.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. onLoad((options) => {
  46. currentId.value = options.id
  47. getData()
  48. })
  49. const currentId = ref()
  50. // 筛选区域当前索引
  51. const activeIndex = ref(0)
  52. // 筛选区域数组
  53. const searchList = ref([
  54. {
  55. value: 0,
  56. text: '今天'
  57. },
  58. {
  59. value: 1,
  60. text: '昨天'
  61. },
  62. {
  63. value: 2,
  64. text: '前天'
  65. }
  66. ])
  67. // 学生轨迹数组
  68. const list = ref([])
  69. // 步骤条样式
  70. const customStyle = {
  71. marginBottom: '30rpx'
  72. }
  73. const getData = async () => {
  74. const res = await myRequest({
  75. url: '/wanzai/api/smartFaceDiscern/track',
  76. data: {
  77. id: currentId.value,
  78. dateTime: activeIndex.value
  79. }
  80. })
  81. // console.log(res)
  82. if (res.code == 200) {
  83. list.value = res.data
  84. }
  85. }
  86. // 切换筛选时间时的函数
  87. const changeIndex = (v) => {
  88. activeIndex.value = v
  89. getData()
  90. }
  91. </script>
  92. <style lang="scss" scoped>
  93. .container {
  94. display: flex;
  95. flex-direction: column;
  96. min-height: 100vh;
  97. background-color: #f1f6fe;
  98. // 顶部筛选区域样式
  99. .search {
  100. display: flex;
  101. justify-content: space-evenly;
  102. margin: 30rpx 0;
  103. height: 65rpx;
  104. .search_box {
  105. display: flex;
  106. justify-content: center;
  107. align-items: center;
  108. box-sizing: border-box;
  109. width: 195rpx;
  110. height: 65rpx;
  111. font-size: 28rpx;
  112. border-radius: 72rpx;
  113. background-color: #fff;
  114. }
  115. .active {
  116. color: #1e7dfb;
  117. border: 1rpx solid #1e7dfb;
  118. }
  119. }
  120. // 地图区域样式
  121. .map {
  122. width: 750rpx;
  123. height: 469rpx;
  124. }
  125. // 轨迹区域样式
  126. .track {
  127. padding: 0 20rpx 20rpx 20rpx;
  128. .track_title {
  129. margin: 30rpx 0;
  130. font-size: 32rpx;
  131. font-weight: bold;
  132. }
  133. .track_time {
  134. font-size: 28rpx;
  135. font-weight: bold;
  136. }
  137. .track_desc {
  138. display: flex;
  139. margin-top: 10rpx;
  140. color: #808080;
  141. font-size: 24rpx;
  142. .img {
  143. width: 100rpx;
  144. height: 160rpx;
  145. }
  146. }
  147. }
  148. }
  149. </style>