devicePhoto.vue 22 KB

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