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