devicePhoto.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <view class="device-photo-page">
  3. <!-- 顶部导航栏 -->
  4. <view class="device-detail__header">
  5. <u-icon
  6. size="36"
  7. class="arrow-left"
  8. name="arrow-left"
  9. @click="handleBack"
  10. ></u-icon>
  11. {{ title }}
  12. </view>
  13. <!-- 日期选择器 -->
  14. <view class="date-picker">
  15. <view class="date-input">
  16. <text class="date-label">开始日期</text>
  17. </view>
  18. <view class="date-separator">-</view>
  19. <view class="date-input">
  20. <text class="date-label">结束日期</text>
  21. </view>
  22. <u-icon name="calendar" class="calendar"></u-icon>
  23. </view>
  24. <!-- 主图片区域 -->
  25. <view class="main-photo">
  26. <image
  27. src="https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=insects%20on%20a%20white%20surface%20with%20markers&image_size=portrait_4_3"
  28. class="main-photo-image"
  29. />
  30. <view class="photo-timestamp">2025-12-28 08:00:00</view>
  31. </view>
  32. <!-- 缩略图预览 -->
  33. <view class="thumbnail-preview">
  34. <view class="thumbnail-scroll">
  35. <view
  36. class="thumbnail-item"
  37. v-for="(item, index) in thumbnails"
  38. :key="index"
  39. :class="{ active: index === currentThumbnail }"
  40. @click="selectThumbnail(index)"
  41. >
  42. <image
  43. :src="item.src"
  44. class="thumbnail-image"
  45. />
  46. </view>
  47. </view>
  48. </view>
  49. <!-- 识别结果 -->
  50. <view class="recognition-result">
  51. <view class="result-title">当前图片识别结果</view>
  52. <!-- 一类害虫 -->
  53. <view class="pest-category">
  54. <view class="category-header">
  55. <text class="category-title">一类害虫</text>
  56. <text class="category-count">数量</text>
  57. </view>
  58. <view class="pest-item" v-for="(pest, index) in category1Pests" :key="index">
  59. <view class="pest-info">
  60. <view class="pest-color" :style="{ backgroundColor: pest.color }"></view>
  61. <text class="pest-name">{{ pest.name }}</text>
  62. </view>
  63. <text class="pest-count">{{ pest.count }}</text>
  64. </view>
  65. </view>
  66. <!-- 二类害虫 -->
  67. <view class="pest-category">
  68. <view class="category-header">
  69. <text class="category-title">二类害虫</text>
  70. <text class="category-count">数量</text>
  71. </view>
  72. <view class="pest-item" v-for="(pest, index) in category2Pests" :key="index">
  73. <view class="pest-info">
  74. <view class="pest-color" :style="{ backgroundColor: pest.color }"></view>
  75. <text class="pest-name">{{ pest.name }}</text>
  76. </view>
  77. <text class="pest-count">{{ pest.count }}</text>
  78. </view>
  79. </view>
  80. <!-- 三类害虫 -->
  81. <view class="pest-category">
  82. <view class="category-header">
  83. <text class="category-title">三类害虫</text>
  84. <text class="category-count">数量</text>
  85. </view>
  86. <view class="pest-item" v-for="(pest, index) in category3Pests" :key="index">
  87. <view class="pest-info">
  88. <view class="pest-color" :style="{ backgroundColor: pest.color }"></view>
  89. <text class="pest-name">{{ pest.name }}</text>
  90. </view>
  91. <text class="pest-count">{{ pest.count }}</text>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. </template>
  97. <script>
  98. export default {
  99. data() {
  100. return {
  101. title: '查看图片',
  102. currentThumbnail: 2,
  103. thumbnails: [
  104. { src: "https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=insects%20on%20white%20surface&image_size=square" },
  105. { src: "https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=insects%20on%20white%20surface&image_size=square" },
  106. { src: "https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=insects%20on%20white%20surface&image_size=square" },
  107. { src: "https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=insects%20on%20white%20surface&image_size=square" },
  108. { src: "https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=insects%20on%20white%20surface&image_size=square" },
  109. { src: "https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=insects%20on%20white%20surface&image_size=square" },
  110. { src: "https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=insects%20on%20white%20surface&image_size=square" },
  111. { src: "https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=insects%20on%20white%20surface&image_size=square" },
  112. { src: "https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=insects%20on%20white%20surface&image_size=square" },
  113. { src: "https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=insects%20on%20white%20surface&image_size=square" },
  114. { src: "https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=insects%20on%20white%20surface&image_size=square" },
  115. { src: "https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=insects%20on%20white%20surface&image_size=square" }
  116. ],
  117. category1Pests: [
  118. { name: '蚜虫', color: '#FF9933', count: 3 },
  119. { name: '松墨天牛', color: '#FF3333', count: 3 },
  120. { name: '夜蛾', color: '#3366FF', count: 3 }
  121. ],
  122. category2Pests: [
  123. { name: '蚜虫', color: '#FF9933', count: 3 },
  124. { name: '松墨天牛', color: '#FF3333', count: 3 },
  125. { name: '夜蛾', color: '#3366FF', count: 3 }
  126. ],
  127. category3Pests: [
  128. { name: '蚜虫', color: '#FF9933', count: 3 },
  129. { name: '松墨天牛', color: '#FF3333', count: 3 },
  130. { name: '夜蛾', color: '#3366FF', count: 3 }
  131. ]
  132. };
  133. },
  134. methods: {
  135. goBack() {
  136. uni.navigateBack();
  137. },
  138. selectThumbnail(index) {
  139. this.currentThumbnail = index;
  140. }
  141. }
  142. };
  143. </script>
  144. <style lang="scss" scoped>
  145. .device-photo-page {
  146. background-color: #F5F5F5;
  147. min-height: 100vh;
  148. width: 100%;
  149. padding-top: 112rpx;
  150. background: linear-gradient(180deg, #ffffff00 0%, #F5F6FA 23.64%, #F5F6FA 100%), linear-gradient(102deg, #BFEADD 6.77%, #B8F1E7 40.15%, #B9EEF5 84.02%);
  151. .device-detail__header {
  152. width: 100%;
  153. font-size: 28rpx;
  154. color: #999;
  155. color: #042118;
  156. font-family: 'Source Han Sans CN VF';
  157. font-weight: 700;
  158. position: relative;
  159. text-align: center;
  160. .arrow-left {
  161. position: absolute;
  162. left: 32rpx;
  163. margin-right: 12rpx;
  164. }
  165. }
  166. /* 顶部导航栏 */
  167. .nav-bar {
  168. display: flex;
  169. align-items: center;
  170. justify-content: space-between;
  171. padding: 24rpx;
  172. background-color: #E6F7EF;
  173. .nav-left {
  174. .back-icon {
  175. font-size: 36rpx;
  176. color: #042118;
  177. }
  178. }
  179. .nav-title {
  180. font-size: 32rpx;
  181. font-weight: 700;
  182. color: #042118;
  183. }
  184. .nav-right {
  185. display: flex;
  186. align-items: center;
  187. .more-icon {
  188. font-size: 32rpx;
  189. color: #042118;
  190. margin-right: 24rpx;
  191. }
  192. .eye-icon {
  193. font-size: 32rpx;
  194. }
  195. }
  196. }
  197. /* 日期选择器 */
  198. .date-picker {
  199. display: flex;
  200. align-items: center;
  201. padding: 20rpx 24rpx;
  202. background-color: #FFFFFF;
  203. margin-bottom: 24rpx;
  204. width: 90%;
  205. margin:20rpx auto;
  206. border-radius: 48rpx;
  207. position: relative;
  208. .date-input {
  209. display: flex;
  210. flex-direction: column;
  211. width: 35%;
  212. .date-label {
  213. font-size: 24rpx;
  214. color: #999999;
  215. margin-bottom: 8rpx;
  216. }
  217. .date-value {
  218. font-size: 28rpx;
  219. color: #042118;
  220. font-weight: 500;
  221. }
  222. }
  223. .calendar {
  224. position: absolute;
  225. right: 24rpx;
  226. top: 50%;
  227. transform: translateY(-50%);
  228. font-size: 32rpx;
  229. color: #999999;
  230. }
  231. .date-separator {
  232. margin: 0 24rpx;
  233. font-size: 28rpx;
  234. color: #999999;
  235. }
  236. }
  237. /* 主图片区域 */
  238. .main-photo {
  239. position: relative;
  240. margin: 0 24rpx 24rpx;
  241. background-color: #FFFFFF;
  242. border-radius: 16rpx;
  243. padding: 0;
  244. overflow: hidden;
  245. .main-photo-image {
  246. width: 100%;
  247. height: 400rpx;
  248. object-fit: cover;
  249. border-radius: 8rpx;
  250. }
  251. .photo-timestamp {
  252. position: absolute;
  253. bottom: 0rpx;
  254. left: 0rpx;
  255. width:100%;
  256. background-color: rgba(0, 0, 0, 0.6);
  257. color: #FFFFFF;
  258. padding: 8rpx 16rpx;
  259. border-radius: 8rpx;
  260. font-size: 24rpx;
  261. }
  262. }
  263. /* 缩略图预览 */
  264. .thumbnail-preview {
  265. margin: 0 24rpx 24rpx;
  266. .thumbnail-scroll {
  267. gap: 16rpx;
  268. padding-bottom: 16rpx;
  269. box-sizing: border-box;
  270. white-space: nowrap;
  271. overflow-x: auto;
  272. overflow-y: hidden;
  273. width: 100%;
  274. // 隐藏滚动条
  275. -ms-overflow-style: none;
  276. scrollbar-width: none;
  277. .thumbnail-item {
  278. width: 120rpx;
  279. height: 120rpx;
  280. border-radius: 8rpx;
  281. overflow: hidden;
  282. border: 2rpx solid transparent;
  283. display: inline-block;
  284. box-sizing: border-box;
  285. margin-right: 10rpx;
  286. &.active {
  287. border-color: #0BBC58;
  288. }
  289. .thumbnail-image {
  290. width: 100%;
  291. height: 100%;
  292. object-fit: cover;
  293. }
  294. }
  295. }
  296. }
  297. /* 识别结果 */
  298. .recognition-result {
  299. margin: 0 24rpx 24rpx;
  300. background-color: #FFFFFF;
  301. border-radius: 16rpx;
  302. padding: 24rpx;
  303. .result-title {
  304. font-size: 28rpx;
  305. font-weight: 700;
  306. color: #042118;
  307. margin-bottom: 24rpx;
  308. }
  309. /* 害虫类别 */
  310. .pest-category {
  311. margin-bottom: 32rpx;
  312. border: 1px solid #E4E7ED;
  313. border-radius: 16rpx;
  314. &:last-child {
  315. margin-bottom: 0;
  316. }
  317. .category-header {
  318. display: flex;
  319. justify-content: space-between;
  320. margin-bottom: 16rpx;
  321. background: #F6F8FC;
  322. padding: 18rpx 24rpx;
  323. .category-title {
  324. font-size: 24rpx;
  325. font-weight: 500;
  326. color: #042118;
  327. }
  328. .category-count {
  329. font-size: 24rpx;
  330. color: #999999;
  331. }
  332. }
  333. .pest-item {
  334. display: flex;
  335. justify-content: space-between;
  336. align-items: center;
  337. margin-bottom: 12rpx;
  338. padding: 6rpx 24rpx;
  339. &:last-child {
  340. margin-bottom: 0;
  341. }
  342. .pest-info {
  343. display: flex;
  344. align-items: center;
  345. .pest-color {
  346. width: 16rpx;
  347. height: 16rpx;
  348. border-radius: 50%;
  349. margin-right: 12rpx;
  350. }
  351. .pest-name {
  352. font-size: 24rpx;
  353. color: #042118;
  354. }
  355. }
  356. .pest-count {
  357. font-size: 24rpx;
  358. color: #042118;
  359. }
  360. }
  361. }
  362. }
  363. }
  364. </style>