track.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view class="container">
  3. <!-- 顶部筛选区域 -->
  4. <view class="search">
  5. <view class="search_box" :class="{ active: item.id === activeIndex }" v-for="item in searchList" :key="item.id" @click="changeIndex(item.id)">{{ item.text }}</view>
  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">
  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.title }}
  20. </view>
  21. </template>
  22. <template v-slot:desc>
  23. <view class="track_desc">
  24. {{ item.desc }}
  25. </view>
  26. </template>
  27. </uv-steps-item>
  28. </uv-steps>
  29. </view>
  30. </view>
  31. </template>
  32. <script setup>
  33. import { ref } from 'vue'
  34. import { onLoad } from '@dcloudio/uni-app'
  35. import MapContainer from '@/components/MapContainer.vue'
  36. onLoad(() => {})
  37. // 筛选区域当前索引
  38. const activeIndex = ref(0)
  39. // 筛选区域数组
  40. const searchList = ref([
  41. {
  42. id: 0,
  43. text: '今天'
  44. },
  45. {
  46. id: 1,
  47. text: '昨天'
  48. },
  49. {
  50. id: 2,
  51. text: '前天'
  52. }
  53. ])
  54. // 学生轨迹数组
  55. const list = ref([
  56. {
  57. id: 1,
  58. title: '入校06:00',
  59. desc: '地点:万载三中大门口'
  60. },
  61. {
  62. id: 2,
  63. title: '入校07:00',
  64. desc: '地点:万载三中大门口'
  65. },
  66. {
  67. id: 3,
  68. title: '入校08:00',
  69. desc: '地点:万载三中大门口'
  70. },
  71. {
  72. id: 4,
  73. title: '入校09:00',
  74. desc: '地点:万载三中大门口'
  75. },
  76. {
  77. id: 5,
  78. title: '入校10:00',
  79. desc: '地点:万载三中大门口'
  80. }
  81. ])
  82. // 步骤条样式
  83. const customStyle = {
  84. marginBottom: '30rpx'
  85. }
  86. // 切换筛选时间时的函数
  87. const changeIndex = (id) => {
  88. activeIndex.value = id
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. .container {
  93. display: flex;
  94. flex-direction: column;
  95. min-height: 100vh;
  96. background-color: #f1f6fe;
  97. // 顶部筛选区域样式
  98. .search {
  99. display: flex;
  100. justify-content: space-evenly;
  101. margin: 30rpx 0;
  102. height: 65rpx;
  103. .search_box {
  104. display: flex;
  105. justify-content: center;
  106. align-items: center;
  107. box-sizing: border-box;
  108. width: 195rpx;
  109. height: 65rpx;
  110. font-size: 28rpx;
  111. border-radius: 72rpx;
  112. background-color: #fff;
  113. }
  114. .active {
  115. color: #1e7dfb;
  116. border: 1rpx solid #1e7dfb;
  117. }
  118. }
  119. // 地图区域样式
  120. .map {
  121. width: 750rpx;
  122. height: 469rpx;
  123. }
  124. // 轨迹区域样式
  125. .track {
  126. padding: 0 20rpx 20rpx 20rpx;
  127. .track_title {
  128. margin: 30rpx 0;
  129. font-size: 32rpx;
  130. font-weight: bold;
  131. }
  132. .track_time {
  133. font-size: 28rpx;
  134. font-weight: bold;
  135. }
  136. .track_desc {
  137. margin-top: 10rpx;
  138. color: #808080;
  139. font-size: 24rpx;
  140. }
  141. }
  142. }
  143. </style>