devicePhoto.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  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-container">
  15. <!-- <view class="select-year">
  16. <view class="select-year-item" @click="showPicker = true">
  17. {{ currentYear }}
  18. <u-icon name="arrow-down" size="18" class="arrow-down"></u-icon>
  19. </view>
  20. </view> -->
  21. <view class="date-picker" @click="show = true">
  22. <view class="date-input">
  23. <text class="date-label">{{ time_begin || '-' }}</text>
  24. </view>
  25. <!-- <view class="date-separator">-</view>
  26. <view class="date-input">
  27. <text class="date-label">{{ time_end || '-' }}</text>
  28. </view> -->
  29. <u-icon name="calendar" class="calendar"></u-icon>
  30. </view>
  31. </view>
  32. <!-- 主图片区域 -->
  33. <view class="main-photo" v-if="currentImg.addr">
  34. <movable-area class="movable-area" :style="{ height: containerHeight }">
  35. <movable-view
  36. class="movable-view"
  37. direction="all"
  38. scale="true"
  39. scale-min="1"
  40. scale-max="5"
  41. >
  42. <view class="image-container">
  43. <!-- 原图 -->
  44. <image
  45. :src="currentImg.addr"
  46. class="main-photo-image"
  47. mode="widthFix"
  48. @load="onImageLoad"
  49. />
  50. <!-- 虫子标记层 -->
  51. <view class="bug-markers" v-if="bugMarkers.length > 0">
  52. <view
  53. v-for="(marker, index) in bugMarkers"
  54. :key="index"
  55. class="bug-marker"
  56. :style="{
  57. left: marker.x + '%',
  58. top: marker.y + '%',
  59. width: marker.width + '%',
  60. height: marker.height + '%',
  61. borderColor: marker.color
  62. }"
  63. >
  64. <view class="bug-label" :style="{ color: marker.color }">
  65. {{ getPestName(marker.id) }}
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </movable-view>
  71. </movable-area>
  72. <view class="photo-timestamp">{{ formatDate(currentImg.addtime) }}</view>
  73. </view>
  74. <!-- 缩略图预览 -->
  75. <view class="thumbnail-preview">
  76. <view class="thumbnail-scroll">
  77. <view
  78. class="thumbnail-item"
  79. v-for="(item, index) in thumbnails"
  80. :key="index"
  81. :class="{ active: img_id == item.ids }"
  82. @click="selectThumbnail(item)"
  83. >
  84. <image
  85. :src="item.addr"
  86. class="thumbnail-image"
  87. />
  88. </view>
  89. </view>
  90. </view>
  91. <!-- 识别结果 -->
  92. <view class="recognition-result" v-if="pestList.length">
  93. <view class="result-title">当前图片识别结果</view>
  94. <!-- 一类害虫 -->
  95. <view class="pest-category" v-for="(pest,index) in pestList" :key="index">
  96. <view class="category-header">
  97. <text class="category-title">{{ pest[0] }}</text>
  98. <text class="category-count">数量</text>
  99. </view>
  100. <view class="pest-item" v-for="(p, i) in pest[1]" :key="i">
  101. <view class="pest-info">
  102. <view class="pest-color" :style="{ backgroundColor: getPestColor(p.pest_name) }"></view>
  103. <text class="pest-name">{{ p.pest_name }}</text>
  104. </view>
  105. <text class="pest-count">{{ p.pest_num }}</text>
  106. </view>
  107. </view>
  108. </view>
  109. <u-empty v-else text="暂无数据"></u-empty>
  110. <u-calendar
  111. v-model="show"
  112. :mode="mode"
  113. @change="handleChange"
  114. range-color="#999"
  115. btn-type="success"
  116. active-bg-color="#0BBC58"
  117. range-bg-color="rgba(11,188,88,0.13)"
  118. :defaultDate="defaultDate"
  119. ></u-calendar>
  120. <u-picker v-model="showPicker" mode="selector" :range="selectorRange" range-key="id" :default-selector="[0]" @confirm="confirmHandler"></u-picker>
  121. </view>
  122. </template>
  123. <script>
  124. export default {
  125. data() {
  126. return {
  127. show: false,
  128. mode: 'date',
  129. maxDate: this.formatTime(new Date()),
  130. minDate: this.formatTime(new Date(new Date().getFullYear(), 0, 1)),
  131. defaultDate: this.formatTime(new Date(new Date().getFullYear(), 0, 1)),
  132. showPicker: false,
  133. selectorRange: [],
  134. title: '查看图片',
  135. currentThumbnail: 2,
  136. pestYype:{},
  137. device_id: '',
  138. time_begin: this.formatTime(new Date(new Date().getFullYear(), 0, 1)),
  139. time_end: this.formatTime(new Date()),
  140. img_id: '',
  141. pest_list:[],
  142. pestList:[],
  143. colors:[
  144. '#FF5951',
  145. '#66EDED',
  146. '#E67B3E',
  147. '#6DE28B',
  148. '#FFC97A',
  149. '#E7EB4B',
  150. '#1561F3',
  151. '#FA73F5',
  152. '#159AFF',
  153. '#FA73F5'
  154. ],
  155. currentYear:'',
  156. pest_list_arr:[],
  157. thumbnails: [],
  158. addtime:'',
  159. currentImg:{},
  160. bugMarkers: [],
  161. imageWidth: 0,
  162. imageHeight: 0,
  163. imgOld_id:'',
  164. containerHeight: '300px',
  165. pestDict: {}, // 虫子字典 {id: name}
  166. pestColorMap: {}, // 害虫颜色映射 {pestName: color}
  167. };
  168. },
  169. async onLoad(options) {
  170. const {id,img_id,currentYear,addtime} = options
  171. this.device_id = id
  172. this.imgOld_id = img_id
  173. this.currentYear = currentYear
  174. this.addtime = this.formatTime(Number(addtime)*1000);
  175. this.time_begin = this.addtime;
  176. this.defaultDate = this.addtime;
  177. this.time_end = this.addtime;
  178. this.selectorRange = [];
  179. const nowYear = new Date().getFullYear();
  180. for(let i = 0;i<50;i++){
  181. const item = {
  182. label: nowYear - i,
  183. id: nowYear - i
  184. }
  185. this.selectorRange.push(item);
  186. }
  187. this.pestList = [];
  188. await this.getPestDict();
  189. this.getPestLevelMap();
  190. this.getPestList();
  191. // this.getDevicePhotoDetails();
  192. },
  193. methods: {
  194. getPestName(id){
  195. return this.pestDict[id] || id;
  196. },
  197. async confirmHandler(e){
  198. this.currentYear = this.selectorRange[e].id;
  199. if(this.currentYear == new Date().getFullYear()){
  200. this.time_begin = this.formatTime(new Date(new Date().getFullYear(), 0, 1));
  201. this.time_end = this.formatTime(new Date());
  202. this.maxDate = this.formatTime(new Date());
  203. this.minDate = this.formatTime(new Date(new Date().getFullYear(), 0, 1));
  204. }else{
  205. this.time_begin = this.formatTime(new Date(this.currentYear, 0, 1));
  206. this.time_end = this.formatTime(new Date(this.currentYear, 11, 31));
  207. this.maxDate = this.formatTime(new Date(this.currentYear, 11, 31));
  208. this.minDate = this.formatTime(new Date(this.currentYear, 0, 1));
  209. this.defaultDate = this.minDate;
  210. }
  211. this.showPicker = false;
  212. this.pestList = [];
  213. this.thumbnails = [];
  214. await this.getPestList();
  215. },
  216. async handleChange(e){
  217. console.log(e,'e')
  218. this.time_begin = e.result;
  219. this.time_end = e.result;
  220. this.pestList = [];
  221. await this.getPestList()
  222. this.currentImg = {};
  223. },
  224. getPestColor(pestName) {
  225. // 如果该害虫已有颜色,直接返回
  226. if (this.pestColorMap[pestName]) {
  227. return this.pestColorMap[pestName];
  228. }
  229. // 为新害虫分配颜色
  230. const usedColors = Object.values(this.pestColorMap);
  231. // 找一个未使用的颜色
  232. let color;
  233. for (const c of this.colors) {
  234. if (!usedColors.includes(c)) {
  235. color = c;
  236. break;
  237. }
  238. }
  239. // 如果所有颜色都用完了,使用哈希值确定颜色
  240. if (!color) {
  241. const hash = pestName.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
  242. color = this.colors[hash % this.colors.length];
  243. }
  244. this.pestColorMap[pestName] = color;
  245. return color;
  246. },
  247. getLevelDisplayName(level) {
  248. const levelMap = {
  249. '-1': '其他害虫',
  250. 1: '一类害虫',
  251. 2: '二类害虫',
  252. 3: '三类害虫',
  253. 4: '四类害虫',
  254. 5: '五类害虫'
  255. };
  256. return levelMap[String(level)] || `${level}`;
  257. },
  258. async getPestList() {
  259. const res = await this.$myRequest({
  260. url: '/api/api_gateway?method=forecast.new_cbd.photo_list',
  261. method: 'POST',
  262. data: {
  263. identify_model:'B',
  264. cmd:'cbd',
  265. time_begin: this.time_begin + ' 00:00:00',
  266. time_end: this.time_end + ' 23:59:59',
  267. identify_model:'B',
  268. device_id: this.device_id,
  269. },
  270. });
  271. this.thumbnails = res?.data || [];
  272. this.currentImg = {};
  273. //如果和旧的id相同,就用旧的id不然就用第一个
  274. if(this.thumbnails.find(item => item.ids == this.imgOld_id)){
  275. this.img_id = this.imgOld_id
  276. }else{
  277. this.img_id = this.thumbnails[0].ids
  278. }
  279. this.getDevicePhotoDetails();
  280. // if(this.img_id){
  281. // this.currentImg = this.thumbnails.find(item => item.ids == this.img_id) || this.thumbnails[0] || {}
  282. // }else{
  283. // this.currentImg = this.thumbnails[0] || {}
  284. // }
  285. },
  286. formatTime(dateString) {
  287. const date = new Date(dateString);
  288. const year = date.getFullYear();
  289. const month = String(date.getMonth() + 1).padStart(2, '0');
  290. const day = String(date.getDate()).padStart(2, '0');
  291. return `${year}-${month}-${day}`;
  292. },
  293. async getPestLevelMap() {
  294. const res = await this.$myRequest({
  295. url: '/api/api_gateway?method=forecast.new_cbd.pest_level_map',
  296. method: 'POST',
  297. });
  298. const pestYype = {}
  299. for(let key in res){
  300. pestYype[this.getLevelDisplayName(key)] = res[key]
  301. }
  302. this.pestYype = pestYype
  303. },
  304. // 获取虫子字典
  305. async getPestDict() {
  306. try {
  307. const res = await this.$myRequest({
  308. url: '/api/api_gateway?method=forecast.pest_info.pest_dict',
  309. method: 'POST',
  310. data:{
  311. type_name: '1'
  312. }
  313. });
  314. this.pestDict = res || {};
  315. } catch (error) {
  316. console.error('获取虫子字典失败:', error);
  317. this.pestDict = {};
  318. }
  319. },
  320. formatDate(dateString) {
  321. const date = new Date(dateString*1000);
  322. const year = date.getFullYear();
  323. const month = String(date.getMonth() + 1).padStart(2, '0');
  324. const day = String(date.getDate()).padStart(2, '0');
  325. const hour = String(date.getHours()).padStart(2, '0');
  326. const minute = String(date.getMinutes()).padStart(2, '0');
  327. const second = String(date.getSeconds()).padStart(2, '0');
  328. return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
  329. },
  330. async getDevicePhotoDetails() {
  331. const res = await this.$myRequest({
  332. url: '/api/api_gateway?method=forecast.forecast_system.device_photo_details',
  333. method: 'POST',
  334. data: {
  335. identify_model:'B',
  336. cmd:'cbd',
  337. img_id: this.img_id,
  338. },
  339. });
  340. this.currentImg = res;
  341. // 处理label参数生成bugMarkers
  342. this.processBugMarkers();
  343. const pest_list = res.pest_list
  344. const pestArr = new Map()
  345. const pesAlltList = []
  346. for(let key in this.pestYype){
  347. for(let j in this.pestYype[key]){
  348. const pestName = this.pestYype[key][j]
  349. pesAlltList.push(pestName)
  350. pest_list.forEach(item => {
  351. if(item.pest_name == pestName){
  352. if(pestArr.has(key)){
  353. pestArr.get(key).push(item)
  354. }else{
  355. pestArr.set(key, [item])
  356. }
  357. }
  358. })
  359. }
  360. }
  361. pest_list.forEach(item => {
  362. if(!pesAlltList.includes(item.pest_name)){
  363. pestArr.get('其他害虫').push(item)
  364. }
  365. })
  366. const pestList = []
  367. for(let key of pestArr){
  368. pestList.push(key)
  369. }
  370. this.pestList = pestList
  371. },
  372. onImageLoad(e) {
  373. this.imageWidth = e.detail.width;
  374. this.imageHeight = e.detail.height;
  375. // 计算容器显示高度(根据屏幕宽度和图片宽高比)
  376. const systemInfo = uni.getSystemInfoSync();
  377. const screenWidth = systemInfo.windowWidth;
  378. const containerWidth = screenWidth - 24; // 减去左右margin (24rpx ≈ 12px)
  379. const displayHeight = (containerWidth / this.imageWidth) * this.imageHeight;
  380. this.containerHeight = displayHeight + 'px';
  381. console.log('图片尺寸:', this.imageWidth, this.imageHeight, '容器高度:', this.containerHeight);
  382. // 图片加载完成后处理bugMarkers
  383. this.processBugMarkers();
  384. },
  385. processBugMarkers() {
  386. console.log('开始处理label参数:', this.currentImg.label);
  387. if (!this.currentImg.label) {
  388. console.log('没有label参数');
  389. this.bugMarkers = [];
  390. return;
  391. }
  392. // 如果没有图片尺寸,先设置默认值
  393. if (!this.imageWidth || !this.imageHeight) {
  394. console.log('没有图片尺寸,使用默认值');
  395. this.imageWidth = 1000;
  396. this.imageHeight = 1000;
  397. }
  398. try {
  399. // 处理label参数,将单引号替换为双引号
  400. let labelStr = this.currentImg.label;
  401. labelStr = labelStr.replace(/'/g, '"');
  402. const label = JSON.parse(labelStr);
  403. const markers = [];
  404. // 根据原图宽度计算缩放比例
  405. let scaleRatio;
  406. if (this.imageWidth >= 5000) {
  407. scaleRatio = 1;
  408. } else if (this.imageWidth >= 4000) {
  409. scaleRatio = 1;
  410. } else {
  411. scaleRatio = 1;
  412. }
  413. console.log('原图宽度:', this.imageWidth, '缩放比例:', scaleRatio);
  414. label.forEach(item => {
  415. for (let key in item) {
  416. const [x1, y1, x2, y2] = item[key];
  417. // 使用缩放比例计算标记位置和尺寸
  418. const x = (x1 * scaleRatio / this.imageWidth) * 100;
  419. const y = (y1 * scaleRatio / this.imageHeight) * 100;
  420. const width = ((x2 - x1) * scaleRatio / this.imageWidth) * 100;
  421. const height = ((y2 - y1) * scaleRatio / this.imageHeight) * 100;
  422. // 从字典中获取虫子名字(尝试字符串和数字两种类型)
  423. const pestName = this.pestDict[key] || this.pestDict[String(key)] || key;
  424. const color = this.getPestColor(pestName);
  425. markers.push({
  426. id: pestName, // 显示虫子名字
  427. x,
  428. y,
  429. width,
  430. height,
  431. color
  432. });
  433. }
  434. });
  435. this.bugMarkers = markers;
  436. } catch (error) {
  437. console.error('处理label参数失败:', error);
  438. this.bugMarkers = [];
  439. }
  440. },
  441. handleBack() {
  442. uni.navigateBack({
  443. delta: 1
  444. });
  445. },
  446. goBack() {
  447. uni.navigateBack();
  448. },
  449. selectThumbnail(item) {
  450. this.img_id = item.ids;
  451. this.getDevicePhotoDetails();
  452. }
  453. }
  454. };
  455. </script>
  456. <style lang="scss" scoped>
  457. ::v-deep .u-calendar__action{
  458. display:flex;
  459. justify-content: space-between;
  460. }
  461. ::v-deep .u-hover-class{
  462. .u-calendar__content__item__inner{
  463. color:#aaa !important;
  464. }
  465. }
  466. .device-photo-page {
  467. background-color: #F5F5F5;
  468. min-height: 100vh;
  469. width: 100%;
  470. padding-top: 112rpx;
  471. background: linear-gradient(180deg, #ffffff00 0%, #F5F6FA 23.64%, #F5F6FA 100%), linear-gradient(102deg, #BFEADD 6.77%, #B8F1E7 40.15%, #B9EEF5 84.02%);
  472. .device-detail__header {
  473. width: 100%;
  474. font-size: 28rpx;
  475. color: #999;
  476. color: #042118;
  477. font-family: 'Source Han Sans CN VF';
  478. font-weight: 700;
  479. position: relative;
  480. text-align: center;
  481. .arrow-left {
  482. position: absolute;
  483. left: 32rpx;
  484. margin-right: 12rpx;
  485. }
  486. }
  487. /* 顶部导航栏 */
  488. .nav-bar {
  489. display: flex;
  490. align-items: center;
  491. justify-content: space-between;
  492. padding: 24rpx;
  493. background-color: #E6F7EF;
  494. .nav-left {
  495. .back-icon {
  496. font-size: 36rpx;
  497. color: #042118;
  498. }
  499. }
  500. .nav-title {
  501. font-size: 32rpx;
  502. font-weight: 700;
  503. color: #042118;
  504. }
  505. .nav-right {
  506. display: flex;
  507. align-items: center;
  508. .more-icon {
  509. font-size: 32rpx;
  510. color: #042118;
  511. margin-right: 24rpx;
  512. }
  513. .eye-icon {
  514. font-size: 32rpx;
  515. }
  516. }
  517. }
  518. .date-container{
  519. padding: 0 20rpx;
  520. display: flex;
  521. align-items: center;
  522. justify-content: center;
  523. .select-year{
  524. width: 150rpx;
  525. height: 80rpx;
  526. display: flex;
  527. align-items: center;
  528. justify-content: space-around;
  529. color: #656565;
  530. font-size: 26rpx;
  531. line-height: 80rpx;
  532. text-align: center;
  533. border-radius: 48rpx;
  534. background-color: #FFFFFF;
  535. margin-right: 10rpx;
  536. padding: 0 26rpx;
  537. .select-year-item{
  538. width: 100%;
  539. display: flex;
  540. align-items: center;
  541. justify-content: space-around;
  542. }
  543. }
  544. }
  545. /* 日期选择器 */
  546. .date-picker {
  547. display: flex;
  548. align-items: center;
  549. padding: 20rpx 24rpx;
  550. background-color: #FFFFFF;
  551. margin-bottom: 24rpx;
  552. width: 100%;
  553. margin:20rpx auto;
  554. border-radius: 48rpx;
  555. position: relative;
  556. .date-input {
  557. display: flex;
  558. flex-direction: column;
  559. width: 100%;
  560. text-align: center;
  561. .date-label {
  562. font-size: 24rpx;
  563. color: #999999;
  564. margin-bottom: 8rpx;
  565. }
  566. .date-value {
  567. font-size: 28rpx;
  568. color: #042118;
  569. font-weight: 500;
  570. }
  571. }
  572. .calendar {
  573. position: absolute;
  574. right: 24rpx;
  575. top: 50%;
  576. transform: translateY(-50%);
  577. font-size: 32rpx;
  578. color: #999999;
  579. }
  580. .date-separator {
  581. margin: 0 24rpx;
  582. font-size: 28rpx;
  583. color: #999999;
  584. }
  585. }
  586. /* 主图片区域 */
  587. .main-photo {
  588. position: relative;
  589. margin: 0 24rpx 24rpx;
  590. background-color: #FFFFFF;
  591. border-radius: 16rpx;
  592. padding: 0;
  593. overflow: hidden;
  594. .movable-area {
  595. width: 100%;
  596. overflow: hidden;
  597. }
  598. .movable-view {
  599. width: 100%;
  600. }
  601. .image-container {
  602. position: relative;
  603. width: 100%;
  604. }
  605. .main-photo-image {
  606. width: 100%;
  607. display: block;
  608. }
  609. /* 虫子标记层 */
  610. .bug-markers {
  611. position: absolute;
  612. top: 0;
  613. left: 0;
  614. width: 100%;
  615. height: 100%;
  616. pointer-events: none;
  617. }
  618. /* 虫子标记 */
  619. .bug-marker {
  620. position: absolute;
  621. border: 2rpx solid;
  622. border-radius: 4rpx;
  623. }
  624. /* 虫子标记标签 */
  625. .bug-label {
  626. position: absolute;
  627. top: -24rpx;
  628. left: 0;
  629. padding: 2rpx 6rpx;
  630. border-radius: 4rpx;
  631. font-size: 20rpx;
  632. color: white;
  633. white-space: nowrap;
  634. }
  635. /* 虫子标记层 */
  636. .bug-markers {
  637. position: absolute;
  638. top: 0;
  639. left: 0;
  640. width: 100%;
  641. height: 100%;
  642. pointer-events: none;
  643. }
  644. /* 虫子标记 */
  645. .bug-marker {
  646. position: absolute;
  647. border: 2rpx solid;
  648. border-radius: 4rpx;
  649. pointer-events: auto;
  650. }
  651. /* 虫子标记标签 */
  652. .bug-label {
  653. position: absolute;
  654. top: -30rpx;
  655. left: 0;
  656. padding: 4rpx 8rpx;
  657. border-radius: 4rpx;
  658. font-size: 20rpx;
  659. font-weight: bold;
  660. }
  661. .photo-timestamp {
  662. position: absolute;
  663. bottom: 0rpx;
  664. left: 0rpx;
  665. width:100%;
  666. background-color: rgba(0, 0, 0, 0.6);
  667. color: #FFFFFF;
  668. padding: 8rpx 16rpx;
  669. border-radius: 8rpx;
  670. font-size: 24rpx;
  671. }
  672. }
  673. /* 缩略图预览 */
  674. .thumbnail-preview {
  675. margin: 0 24rpx 24rpx;
  676. .thumbnail-scroll {
  677. gap: 16rpx;
  678. padding-bottom: 16rpx;
  679. box-sizing: border-box;
  680. white-space: nowrap;
  681. overflow-x: auto;
  682. overflow-y: hidden;
  683. width: 100%;
  684. // 隐藏滚动条
  685. -ms-overflow-style: none;
  686. scrollbar-width: none;
  687. .thumbnail-item {
  688. width: 120rpx;
  689. height: 120rpx;
  690. border-radius: 8rpx;
  691. overflow: hidden;
  692. border: 2rpx solid transparent;
  693. display: inline-block;
  694. box-sizing: border-box;
  695. margin-right: 10rpx;
  696. &.active {
  697. border-color: #0BBC58;
  698. }
  699. .thumbnail-image {
  700. width: 100%;
  701. height: 100%;
  702. object-fit: cover;
  703. }
  704. }
  705. }
  706. }
  707. /* 识别结果 */
  708. .recognition-result {
  709. margin: 0 24rpx 24rpx;
  710. background-color: #FFFFFF;
  711. border-radius: 16rpx;
  712. padding: 24rpx;
  713. .result-title {
  714. font-size: 28rpx;
  715. font-weight: 700;
  716. color: #042118;
  717. margin-bottom: 24rpx;
  718. }
  719. /* 害虫类别 */
  720. .pest-category {
  721. margin-bottom: 32rpx;
  722. border: 1px solid #E4E7ED;
  723. border-radius: 16rpx;
  724. &:last-child {
  725. margin-bottom: 0;
  726. }
  727. .category-header {
  728. display: flex;
  729. justify-content: space-between;
  730. margin-bottom: 16rpx;
  731. background: #F6F8FC;
  732. padding: 18rpx 24rpx;
  733. .category-title {
  734. font-size: 24rpx;
  735. font-weight: 500;
  736. color: #042118;
  737. }
  738. .category-count {
  739. font-size: 24rpx;
  740. color: #999999;
  741. }
  742. }
  743. .pest-item {
  744. display: flex;
  745. justify-content: space-between;
  746. align-items: center;
  747. margin-bottom: 12rpx;
  748. padding: 6rpx 24rpx;
  749. &:last-child {
  750. margin-bottom: 0;
  751. }
  752. .pest-info {
  753. display: flex;
  754. align-items: center;
  755. .pest-color {
  756. width: 16rpx;
  757. height: 16rpx;
  758. border-radius: 50%;
  759. margin-right: 12rpx;
  760. }
  761. .pest-name {
  762. font-size: 24rpx;
  763. color: #042118;
  764. }
  765. }
  766. .pest-count {
  767. font-size: 24rpx;
  768. color: #042118;
  769. }
  770. }
  771. }
  772. }
  773. }
  774. </style>