agriculturalDetail.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div class="agricultural-detail">
  3. <custom-header name="农事详情"></custom-header>
  4. <div class="detail-content">
  5. <!-- 采样信息卡片 -->
  6. <div class="card-wrap">
  7. <div class="card-box sampling-card">
  8. <div class="sampling-title">采样时间: {{ imgInfo.samplingTime }}</div>
  9. <div class="sampling-desc">本次飞巡采样了1区、2区和5区,拍摄了 120棵树</div>
  10. </div>
  11. </div>
  12. <!-- 农情照片卡片 -->
  13. <div class="card-wrap">
  14. <div class="card-box photo-card">
  15. <div class="card-title">农情照片</div>
  16. <div class="ratio-tip">出现新梢的果树占比为5%</div>
  17. <div class="photo-grid">
  18. <div
  19. v-for="photo in imgInfo.imageList"
  20. :key="photo.id"
  21. class="photo-item"
  22. @click="handlePhotoClick(photo.url)"
  23. >
  24. <img :src="photo.url" alt="农情照片" />
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </template>
  32. <script setup>
  33. import { useRoute } from "vue-router";
  34. import { ref, onMounted } from "vue";
  35. import customHeader from "@/components/customHeader.vue";
  36. import { showImagePreview } from 'vant';
  37. const route = useRoute();
  38. const handlePhotoClick = (photo) => {
  39. showImagePreview({
  40. images: [photo],
  41. startPosition: 0,
  42. closeable: true,
  43. showIndex: true,
  44. });
  45. };
  46. onMounted(() => {
  47. getFarmImagePage();
  48. });
  49. const imgInfo = ref({});
  50. const getFarmImagePage = () => {
  51. VE_API.monitor.getFarmImagePage({
  52. farmId: route.query.farmId,
  53. regionId: route.query.regionId,
  54. uploadDate: route.query.date,
  55. }).then((res) => {
  56. if (res.code === 0) {
  57. imgInfo.value = res.data;
  58. }
  59. });
  60. };
  61. </script>
  62. <style lang="scss" scoped>
  63. .agricultural-detail {
  64. min-height: 100vh;
  65. width: 100%;
  66. background: #f2f3f5;
  67. .detail-content {
  68. padding: 12px;
  69. padding-bottom: 24px;
  70. box-sizing: border-box;
  71. .card-wrap {
  72. margin-bottom: 12px;
  73. .card-box {
  74. background: #fff;
  75. border-radius: 8px;
  76. padding: 12px 16px;
  77. box-sizing: border-box;
  78. }
  79. .sampling-card {
  80. .sampling-title {
  81. font-size: 16px;
  82. font-weight: 500;
  83. color: #333;
  84. margin-bottom: 6px;
  85. }
  86. .sampling-desc {
  87. font-size: 14px;
  88. color: rgba(0, 0, 0, 0.5);
  89. }
  90. }
  91. .photo-card {
  92. .card-title {
  93. font-size: 16px;
  94. font-weight: bold;
  95. color: #333;
  96. margin-bottom: 12px;
  97. }
  98. .ratio-tip {
  99. font-size: 14px;
  100. color: #2199f8;
  101. padding: 10px 12px;
  102. background: rgba(33, 153, 248, 0.08);
  103. border-radius: 8px;
  104. }
  105. .photo-grid {
  106. margin-top: 12px;
  107. display: grid;
  108. grid-template-columns: repeat(4, 1fr);
  109. grid-gap: 6px;
  110. .photo-item {
  111. position: relative;
  112. width: 100%;
  113. padding-bottom: 100%;
  114. border-radius: 8px;
  115. overflow: hidden;
  116. background: #e5f5e5;
  117. img {
  118. position: absolute;
  119. inset: 0;
  120. width: 100%;
  121. height: 100%;
  122. object-fit: cover;
  123. display: block;
  124. }
  125. }
  126. }
  127. }
  128. }
  129. }
  130. }
  131. .image-popup {
  132. width: 327px;
  133. border-radius: 8px;
  134. .popup-content {
  135. width: 100%;
  136. }
  137. }
  138. </style>