devicePhoto.vue 25 KB

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