| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045 |
- <template>
- <view class="device-photo-page">
- <!-- 顶部导航栏 -->
- <view class="device-detail__header">
- <u-icon
- size="36"
- class="arrow-left"
- name="arrow-left"
- @click="handleBack"
- ></u-icon>
- {{ title }}
- </view>
- <!-- 日期选择器 -->
- <view class="date-container">
- <view class="date-picker" @click="show = true">
- <view class="date-input">
- <text class="date-label">{{ time_begin || '-' }}</text>
- </view>
- <u-icon name="calendar" class="calendar"></u-icon>
- </view>
- <view class="tags-swiper">
- <view :class="{'tag-icon-active-left': is_jpg == 1}" class="tag-icon-active">
- <image :src="is_jpg == 1 ? imageActiveIcon : imageIcon" class="tag-icon" @click="changeVideo(1)"/>
- </view>
- <view :class="{'tag-icon-active-right': is_jpg == 0}" class="tag-icon-active">
- <image :src="is_jpg == 0 ? videoActiveIcon : videoIcon" class="tag-icon" @click="changeVideo(2)"/>
- </view>
- </view>
- </view>
- <view class="fileList-preview">
- <view class="fileList-scroll">
- <view
- class="file-item"
- v-for="(item, index) in fileList"
- :key="index"
- :class="{ fileActive: fileIndex == index }"
- @click="selectFile(index)"
- >
- {{ item.event_id }}
- </view>
- </view>
- </view>
- <!-- 主图片区域 -->
- <view class="main-photo" v-if="currentImg.addr">
- <movable-area class="movable-area" :style="{ height: containerHeight }">
- <movable-view
- class="movable-view"
- direction="all"
- scale="true"
- scale-min="1"
- scale-max="5"
- >
- <view class="image-container">
- <!-- 原图 -->
- <image
- v-if="is_jpg == 1"
- :src="currentImg.addr"
- class="main-photo-image"
- mode="widthFix"
- @load="onImageLoad"
- />
- <!-- 视频 -->
- <video
- v-if="is_jpg == 0"
- :src="currentImg.addr"
- class="main-photo-image"
- mode="widthFix"
- @load="onImageLoad"
- controls
- />
-
- <!-- 虫子标记层 -->
- <view class="bug-markers" v-if="bugMarkers.length > 0">
- <view
- v-for="(marker, index) in bugMarkers"
- :key="index"
- class="bug-marker"
- :style="{
- left: marker.x + '%',
- top: marker.y + '%',
- width: marker.width + '%',
- height: marker.height + '%',
- borderColor: marker.color
- }"
- >
- <view class="bug-label" :style="{ color: marker.color }">
- {{ getPestName(marker.id) }}
- </view>
- </view>
- </view>
- </view>
- </movable-view>
- </movable-area>
- <view class="photo-timestamp">{{ formatDate(currentImg.addtime) }}</view>
- </view>
- <!-- 缩略图预览 -->
- <view class="thumbnail-preview">
- <view class="thumbnail-scroll">
- <view
- class="thumbnail-item"
- v-for="(item, index) in thumbnails"
- :key="index"
- :class="{ active: img_id == item.id }"
- @click="selectThumbnail(item)"
- >
- <image
- v-if="is_jpg == 1"
- :src="item.addr"
- class="thumbnail-image"
- />
- <!-- 视频 -->
- <video
- v-if="is_jpg == 0"
- :src="item.addr"
- class="thumbnail-image"
- mode="widthFix"
- controls
- />
- </view>
- </view>
- </view>
- <!-- 识别结果 -->
- <view class="recognition-result" v-if="pestList.length">
- <view class="result-title">当前图片识别结果</view>
- <!-- 一类害虫 -->
- <view>
- <view class="pest-category" v-for="(pest,index) in pestList" :key="index">
- <!-- <view class="category-header">
- <text class="category-title">{{ pest[0] }}</text>
- <text class="category-count">数量</text>
- </view> -->
- <view class="pest-item">
- <view class="pest-info">
- <view class="pest-color" :style="{ backgroundColor: getPestColor(pest.pest_name) }"></view>
- <text class="pest-name">{{ pest.pest_name }}</text>
- </view>
- <text class="pest-count">{{ pest.pest_num }}</text>
- </view>
- </view>
- </view>
- <!-- <view v-else>
- <view class="pest-category" v-for="(pest,index) in pestList" :key="index">
- <view class="pest-item">
- <view class="pest-info">
- <view class="pest-color" :style="{ backgroundColor: getPestColor(pest[1].text) }"></view>
- <text class="pest-name">{{ pest[1].text }}</text>
- </view>
- <text class="pest-count">{{ pest[1].value }}</text>
- </view>
- </view>
- </view> -->
- </view>
- <u-empty v-else text="暂无数据"></u-empty>
- <u-calendar
- v-model="show"
- :mode="mode"
- @change="handleChange"
- range-color="#999"
- btn-type="success"
- active-bg-color="#0BBC58"
- range-bg-color="rgba(11,188,88,0.13)"
- :defaultDate="defaultDate"
- ></u-calendar>
- <u-picker v-model="showPicker" mode="selector" :range="selectorRange" range-key="id" :default-selector="[0]" @confirm="confirmHandler"></u-picker>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- show: false,
- mode: 'date',
- maxDate: this.formatTime(new Date()),
- minDate: this.formatTime(new Date(new Date().getFullYear(), 0, 1)),
- defaultDate: this.formatTime(new Date(new Date().getFullYear(), 0, 1)),
- showPicker: false,
- selectorRange: [],
- title: '查看图片',
- currentThumbnail: 2,
- videoActiveIcon: 'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/svg/videoIconActive.svg',
- imageActiveIcon: 'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/svg/imageIconActive.svg',
- imageIcon: 'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/svg/imageIcon.svg',
- videoIcon: 'https://s3.hnyfwlw.com/webstaticimg/bigdata_app/svg/videoIcon.svg',
- pestYype:{},
- fileList:[],
- fileTotle:0,
- fileIndex:0,
- is_mark:0,
- device_id: '',
- time_begin: this.formatTime(new Date(new Date().getFullYear(), 0, 1)),
- time_end: this.formatTime(new Date()),
- img_id: '',
- pest_list:[],
- pestList:[],
- colors:[
- '#FF5951',
- '#66EDED',
- '#E67B3E',
- '#6DE28B',
- '#FFC97A',
- '#E7EB4B',
- '#1561F3',
- '#FA73F5',
- '#159AFF',
- '#FA73F5'
- ],
- currentYear:'',
- event_id:'',
- event_page:1,
- event_page_size:100,
- pest_list_arr:[],
- thumbnails: [],
- addtime:'',
- currentImg:{},
- bugMarkers: [],
- imageWidth: 0,
- imageHeight: 0,
- camera_id:'',
- is_jpg:1,
- imgOld_id:'',
- containerHeight: '300px',
- pestDict: {}, // 虫子字典 {id: name}
- pestColorMap: {}, // 害虫颜色映射 {pestName: color}
- };
- },
- async onLoad(options) {
- const {id,img_id,event_id,currentYear,addtime} = options
- this.device_id = id
- this.imgOld_id = img_id
- this.event_id = event_id || ''
- this.currentYear = currentYear
- this.addtime = this.formatTime(Number(addtime)*1000);
- this.time_begin = this.addtime;
- this.defaultDate = this.addtime;
- this.time_end = this.addtime;
- this.camera_id = '';
- this.is_jpg = 1;
- this.selectorRange = [];
- const nowYear = new Date().getFullYear();
- for(let i = 0;i<50;i++){
- const item = {
- label: nowYear - i,
- id: nowYear - i
- }
- this.selectorRange.push(item);
- }
- this.pestList = [];
- await this.getEventList();
- // 定位到跳转时携带的 event_id,找不到就默认第一个
- const fileIndex = this.fileList.findIndex(file => file.event_id == this.event_id);
- this.fileIndex = fileIndex > -1 ? fileIndex : 0;
- const curFile = this.fileList[this.fileIndex];
- if (curFile) {
- this.event_id = curFile.event_id;
- this.camera_id = curFile.device_id;
- }
- await this.getPestDict();
- await this.getPestLevelMap();
- await this.getPestList();
- // this.getDevicePhotoDetails();
- },
- methods: {
- selectFile(index){
- this.fileIndex = index;
- const file = this.fileList[index];
- this.event_id = file.event_id;
- this.camera_id = file.device_id;
- this.thumbnails = [];
- this.getPestList();
- },
- changeVideo(type){
- this.is_jpg = type == 1 ? 1 : 0;
- this.getPestList();
- },
- getPestName(id){
- if(this.is_mark == 0){
- return this.pestDict[id] || id;
- }
- return id;
- },
- async confirmHandler(e){
- this.currentYear = this.selectorRange[e].id;
- if(this.currentYear == new Date().getFullYear()){
- this.time_begin = this.formatTime(new Date(new Date().getFullYear(), 0, 1));
- this.time_end = this.formatTime(new Date());
- this.maxDate = this.formatTime(new Date());
- this.minDate = this.formatTime(new Date(new Date().getFullYear(), 0, 1));
- }else{
- this.time_begin = this.formatTime(new Date(this.currentYear, 0, 1));
- this.time_end = this.formatTime(new Date(this.currentYear, 11, 31));
- this.maxDate = this.formatTime(new Date(this.currentYear, 11, 31));
- this.minDate = this.formatTime(new Date(this.currentYear, 0, 1));
- this.defaultDate = this.minDate;
- }
- this.showPicker = false;
- this.pestList = [];
- this.thumbnails = [];
- await this.getPestList();
- },
- async handleChange(e){
- this.time_begin = e.result;
- this.time_end = e.result;
- this.pestList = [];
- await this.getPestList()
- this.currentImg = {};
- },
- getPestColor(pestName) {
- // 如果该害虫已有颜色,直接返回
- if (this.pestColorMap[pestName]) {
- return this.pestColorMap[pestName];
- }
- // 为新害虫分配颜色
- const usedColors = Object.values(this.pestColorMap);
- // 找一个未使用的颜色
- let color;
- for (const c of this.colors) {
- if (!usedColors.includes(c)) {
- color = c;
- break;
- }
- }
- // 如果所有颜色都用完了,使用哈希值确定颜色
- if (!color) {
- const hash = pestName.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
- color = this.colors[hash % this.colors.length];
- }
- this.pestColorMap[pestName] = color;
- return color;
- },
- getLevelDisplayName(level) {
- const levelMap = {
- '-1': '其他害虫',
- 1: '一类害虫',
- 2: '二类害虫',
- 3: '三类害虫',
- 4: '四类害虫',
- 5: '五类害虫'
- };
- return levelMap[String(level)] || `${level}`;
- },
- async getEventList(){
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.shuhai.shuhai_two_camera_event_list',
- method: 'POST',
- data: {
- page:this.event_page,
- page_size:this.event_page_size,
- device_id: this.device_id,
- time_begin: new Date(this.time_begin + ' 00:00:00').getTime()/1000,//换成秒级时间戳
- time_end: new Date(this.time_end + ' 23:59:59').getTime()/1000,//换成秒级时间戳
- },
- });
- const resList = res?.data || [];
- this.fileList = resList;
- this.fileTotle = res?.total || 0;
- },
- async getPestList() {
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.shuhai.shuhai_two_camera_photo_list',
- method: 'POST',
- data: {
- camera_id: this.camera_id,
- is_jpg:this.is_jpg,
- page:1,
- event_id: this.event_id,
- page_size:500,
- time_begin: new Date(this.time_begin + ' 00:00:00').getTime()/1000,
- time_end: new Date(this.time_end + ' 23:59:59').getTime()/1000,
- device_id: this.device_id,
- },
- });
- this.thumbnails = res?.data || [];
- this.currentImg = {};
- //如果和旧的id相同,就用旧的id不然就用第一个
- const oldImg = this.thumbnails.find(item => item.id == this.imgOld_id);
- this.img_id = oldImg?.id || this.thumbnails[0]?.id || ''
- this.getDevicePhotoDetails();
- },
- formatTime(dateString) {
- const date = new Date(dateString);
- const year = date.getFullYear();
- const month = String(date.getMonth() + 1).padStart(2, '0');
- const day = String(date.getDate()).padStart(2, '0');
- return `${year}-${month}-${day}`;
- },
- async getPestLevelMap() {
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.new_cbd.pest_level_map',
- method: 'POST',
- });
- const pestYype = {}
- for(let key in res){
- pestYype[this.getLevelDisplayName(key)] = res[key]
- }
- this.pestYype = pestYype
- },
- // 获取虫子字典
- async getPestDict() {
- try {
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.pest_info.pest_dict',
- method: 'POST',
- data:{
- type_name: '1'
- }
- });
- this.pestDict = res || {};
- } catch (error) {
- this.pestDict = {};
- }
- },
- formatDate(dateString) {
- const date = new Date(dateString*1000);
- const year = date.getFullYear();
- const month = String(date.getMonth() + 1).padStart(2, '0');
- const day = String(date.getDate()).padStart(2, '0');
- const hour = String(date.getHours()).padStart(2, '0');
- const minute = String(date.getMinutes()).padStart(2, '0');
- const second = String(date.getSeconds()).padStart(2, '0');
- return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
- },
- async getDevicePhotoDetails() {
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.shuhai.shuhai_two_camera_photo_details',
- method: 'POST',
- data: {
- img_id: this.img_id,
- },
- });
- this.currentImg = res?.photo || {};
- // 处理label参数生成bugMarkers
- this.processBugMarkers();
- // const pest_list = res.pest_list
- const pestArr = new Map()
- // const pesAlltList = []
- // for(let key in this.pestYype){
- // for(let j in this.pestYype[key]){
- // const pestName = this.pestYype[key][j]
- // pesAlltList?.push(pestName)
- // pest_list?.forEach(item => {
- // if(item.pest_name == pestName){
- // if(pestArr.has(key)){
- // pestArr.get(key).push(item)
- // }else{
- // pestArr.set(key, [item])
- // }
- // }
- // })
- // }
- // }
- // pest_list?.forEach(item => {
- // if(!pesAlltList.includes(item.pest_name)){
- // if(pestArr.has('其他害虫')){
- // pestArr.get('其他害虫').push(item)
- // }else{
- // pestArr.set('其他害虫', [item])
- // }
- // }
- // })
- const pestList = []
- // for(let key of pestArr){
- // pestList.push(key)
- // }
- if (this.currentImg.is_mark != 0) {
- this.processBugMarkers();
- for(let i = 0;i< this.currentImg.mark.length;i++){
- const key = this.currentImg.mark[i].text
- if(pestArr.has(key)){
- pestArr.get(key).pest_num++
- pestArr.set(key, pestArr.get(key))
- }else{
- pestArr.set(key, {
- pest_num: 1,
- })
- }
- }
- for(let key of pestArr){
- pestList.push({
- pest_name: key[0],
- pest_num: key[1].pest_num,
- })
- }
- }
- this.pestList = pestList
- },
- onImageLoad(e) {
- this.imageWidth = e.detail.width;
- this.imageHeight = e.detail.height;
- // 计算容器显示高度(根据屏幕宽度和图片宽高比)
- const systemInfo = uni.getSystemInfoSync();
- const screenWidth = systemInfo.windowWidth;
- const containerWidth = screenWidth - 24; // 减去左右margin (24rpx ≈ 12px)
- const displayHeight = (containerWidth / this.imageWidth) * this.imageHeight;
- this.containerHeight = displayHeight + 'px';
- // 图片加载完成后处理bugMarkers
- this.processBugMarkers();
- },
-
- processBugMarkers() {
- if (this.currentImg.is_mark === 0) {
- if (!this.currentImg.label) {
- this.bugMarkers = [];
- return;
- }
- // 如果没有图片尺寸,先设置默认值
- if (!this.imageWidth || !this.imageHeight) {
- this.imageWidth = 1000;
- this.imageHeight = 1000;
- }
- try {
- // 根据原图宽度计算缩放比例
- let scaleRatio;
- if (this.imageWidth >= 5000) {
- scaleRatio = 1;
- } else if (this.imageWidth >= 4000) {
- scaleRatio = 1;
- } else {
- scaleRatio = 1;
- }
- // 处理label参数,将单引号替换为双引号
- let labelStr = this.currentImg.label;
- labelStr = labelStr.replace(/'/g, '"');
- const label = JSON.parse(labelStr);
- const markers = [];
- label.forEach(item => {
- for (let key in item) {
- const [x1, y1, x2, y2] = item[key];
- // 使用缩放比例计算标记位置和尺寸
- const x = (x1 * scaleRatio / this.imageWidth) * 100;
- const y = (y1 * scaleRatio / this.imageHeight) * 100;
- const width = ((x2 - x1) * scaleRatio / this.imageWidth) * 100;
- const height = ((y2 - y1) * scaleRatio / this.imageHeight) * 100;
- // 从字典中获取虫子名字(尝试字符串和数字两种类型)
- const pestName = this.pestDict[key] || this.pestDict[String(key)] || key;
- const color = this.getPestColor(pestName);
- markers.push({
- id: pestName, // 显示虫子名字
- x,
- y,
- width,
- height,
- color
- });
- }
- });
- this.bugMarkers = markers;
- } catch (error) {
- this.bugMarkers = [];
- }
- } else {
- // this.pestList = [];
- const markers = [];
- // 根据原图宽度计算缩放比例
- let scaleRatio = 2.4;
- // if (this.imageWidth >= 5000) {
- // scaleRatio = 4;
- // } else if (this.imageWidth >= 4000) {
- // scaleRatio = 1;
- // } else {
- // scaleRatio = 2.5;
- // }
- // const pestArr = new Map()
- this.currentImg?.mark?.map((item, index) => {
- // if(pestArr.has(item.text)){
- // pestArr.set(item.text,{
- // value: pestArr.get(item.text).value+=1,
- // text: item.text
- // })
- // }else{
- // pestArr.set(item.text, {
- // value: 1,
- // text: item.text
- // })
- // }
- // const pestList = []
- // for(let key of pestArr){
- // pestList.push(key)
- // }
- // this.pestList = pestList
- this.is_mark = 1
- const { startX, startY,text } = item;
- // 使用缩放比例计算标记位置和尺寸
- const x = item.width > 0 ? (startX * scaleRatio / this.imageWidth) * 105 : ((startX + item.width) * scaleRatio / this.imageWidth) * 105;
- const y = item.height > 0 ? (startY * scaleRatio / this.imageHeight) * 105 : ((startY + item.height) * scaleRatio / this.imageHeight) * 105;
- const width = (item.width > 0 ? item.width : -item.width) * scaleRatio / this.imageWidth * 100;
- const height = (item.height > 0 ? item.height : -item.height) * scaleRatio / this.imageHeight * 100;
- // 从字典中获取虫子名字(尝试字符串和数字两种类型)
- const pestName = text;
- const color = this.getPestColor(text);
- markers.push({
- id: pestName, // 显示虫子名字
- x,
- y,
- width,
- height,
- color
- });
- });
- this.bugMarkers = markers;
- }
- },
- handleBack() {
- uni.navigateBack({
- delta: 1
- });
- },
- goBack() {
- uni.navigateBack();
- },
- selectThumbnail(item) {
- this.img_id = item.id;
- this.getDevicePhotoDetails();
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep .u-calendar__action{
- display:flex;
- justify-content: space-between;
- }
- ::v-deep .u-hover-class{
- .u-calendar__content__item__inner{
- color:#aaa !important;
- }
- }
- .device-photo-page {
- background-color: #F5F5F5;
- min-height: 100vh;
- width: 100%;
- padding-top: 112rpx;
- background: linear-gradient(180deg, #ffffff00 0%, #F5F6FA 23.64%, #F5F6FA 100%), linear-gradient(102deg, #BFEADD 6.77%, #B8F1E7 40.15%, #B9EEF5 84.02%);
- .device-detail__header {
- width: 100%;
- font-size: 28rpx;
- color: #999;
- color: #042118;
- font-family: 'Source Han Sans CN VF';
- font-weight: 700;
- position: relative;
- text-align: center;
- .arrow-left {
- position: absolute;
- left: 32rpx;
- margin-right: 12rpx;
- }
- }
- /* 顶部导航栏 */
- .nav-bar {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 24rpx;
- background-color: #E6F7EF;
- .nav-left {
- .back-icon {
- font-size: 36rpx;
- color: #042118;
- }
- }
- .nav-title {
- font-size: 32rpx;
- font-weight: 700;
- color: #042118;
- }
- .nav-right {
- display: flex;
- align-items: center;
- .more-icon {
- font-size: 32rpx;
- color: #042118;
- margin-right: 24rpx;
- }
- .eye-icon {
- font-size: 32rpx;
- }
- }
- }
- .date-container{
- padding: 0 20rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- .select-year{
- width: 150rpx;
- height: 80rpx;
- display: flex;
- align-items: center;
- justify-content: space-around;
- color: #656565;
- font-size: 26rpx;
- line-height: 80rpx;
- text-align: center;
- border-radius: 48rpx;
- background-color: #FFFFFF;
- margin-right: 10rpx;
- padding: 0 26rpx;
- .select-year-item{
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-around;
- }
- }
- }
- /* 日期选择器 */
- .date-picker {
- flex:2;
- display: flex;
- align-items: center;
- padding: 20rpx 24rpx;
- background-color: #FFFFFF;
- margin-bottom: 24rpx;
- width: 100%;
- margin:20rpx auto;
- border-radius: 48rpx;
- position: relative;
- .date-input {
- display: flex;
- flex-direction: column;
- width: 100%;
- text-align: center;
- .date-label {
- font-size: 24rpx;
- color: #999999;
- margin-bottom: 8rpx;
- }
- .date-value {
- font-size: 28rpx;
- color: #042118;
- font-weight: 500;
- }
- }
- .calendar {
- position: absolute;
- right: 24rpx;
- top: 50%;
- transform: translateY(-50%);
- font-size: 32rpx;
- color: #999999;
- }
- .date-separator {
- margin: 0 24rpx;
- font-size: 28rpx;
- color: #999999;
- }
- }
- .tags-swiper{
- flex:1;
- background-color: #FFFFFF;
- border-radius: 48rpx;
- padding: 0rpx 0rpx;
- margin-left: 20rpx;
- height: 80rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- z-index:10000;
- .tag-icon{
- flex:1;
- width: 40rpx;
- height: 40rpx;
- }
- .tag-icon-active{
- flex:1;
- height: 80rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .tag-icon-active-left{
- border-radius: 36rpx 0rpx 0rpx 36rpx;
- background-color: #0BBC58;
- }
- .tag-icon-active-right{
- border-radius: 0rpx 36rpx 36rpx 0rpx;
- background-color: #0BBC58;
- }
- }
- /* 主图片区域 */
- .main-photo {
- position: relative;
- margin: 0 24rpx 24rpx;
- background-color: #FFFFFF;
- border-radius: 16rpx;
- padding: 0;
- overflow: hidden;
- .movable-area {
- width: 100%;
- overflow: hidden;
- }
- .movable-view {
- width: 100%;
- }
- .image-container {
- position: relative;
- width: 100%;
- }
- .main-photo-image {
- width: 100%;
- display: block;
- }
- /* 虫子标记层 */
- .bug-markers {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- pointer-events: none;
- }
- /* 虫子标记 */
- .bug-marker {
- position: absolute;
- border: 2rpx solid;
- border-radius: 4rpx;
- }
- /* 虫子标记标签 */
- .bug-label {
- position: absolute;
- top: -24rpx;
- left: 0;
- padding: 2rpx 6rpx;
- border-radius: 4rpx;
- font-size: 20rpx;
- color: white;
- white-space: nowrap;
- }
- /* 虫子标记层 */
- .bug-markers {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- pointer-events: none;
- }
- /* 虫子标记 */
- .bug-marker {
- position: absolute;
- border: 2rpx solid;
- border-radius: 4rpx;
- pointer-events: auto;
- }
- /* 虫子标记标签 */
- .bug-label {
- position: absolute;
- top: -30rpx;
- left: 0;
- padding: 4rpx 8rpx;
- border-radius: 4rpx;
- font-size: 20rpx;
- font-weight: bold;
- }
- .photo-timestamp {
- position: absolute;
- bottom: 0rpx;
- left: 0rpx;
- width:100%;
- background-color: rgba(0, 0, 0, 0.6);
- color: #FFFFFF;
- padding: 8rpx 16rpx;
- border-radius: 8rpx;
- font-size: 24rpx;
- }
- }
- .fileList-preview{
- margin: 0 24rpx 24rpx;
- .fileList-scroll{
- gap: 16rpx;
- box-sizing: border-box;
- white-space: nowrap;
- overflow-x: auto;
- overflow-y: hidden;
- width: 100%;
- // 隐藏滚动条
- -ms-overflow-style: none;
- scrollbar-width: none;
- .file-item {
- width: 240rpx;
- height: 40rpx;
- line-height: 40rpx;
- text-align: center;
- font-size: 24rpx;
- color: #042118;
- font-weight: 500;
- border: 2rpx solid transparent;
- display: inline-block;
- box-sizing: border-box;
- margin-right: 10rpx;
- border-radius: 8rpx;
- &.fileActive {
- border-color: #0BBC58;
- }
- }
- }
- }
- /* 缩略图预览 */
- .thumbnail-preview {
- margin: 0 24rpx 24rpx;
- .thumbnail-scroll {
- gap: 16rpx;
- padding-bottom: 16rpx;
- box-sizing: border-box;
- white-space: nowrap;
- overflow-x: auto;
- overflow-y: hidden;
- width: 100%;
- // 隐藏滚动条
- -ms-overflow-style: none;
- scrollbar-width: none;
- .thumbnail-item {
- width: 120rpx;
- height: 120rpx;
- border-radius: 8rpx;
- overflow: hidden;
- border: 2rpx solid transparent;
- display: inline-block;
- box-sizing: border-box;
- margin-right: 10rpx;
- &.active {
- border-color: #0BBC58;
- }
- .thumbnail-image {
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- }
- }
- }
- /* 识别结果 */
- .recognition-result {
- margin: 0 24rpx 24rpx;
- background-color: #FFFFFF;
- border-radius: 16rpx;
- padding: 24rpx;
- .result-title {
- font-size: 28rpx;
- font-weight: 700;
- color: #042118;
- margin-bottom: 24rpx;
- }
- /* 害虫类别 */
- .pest-category {
- margin-bottom: 32rpx;
- border: 1px solid #E4E7ED;
- border-radius: 16rpx;
- &:last-child {
- margin-bottom: 0;
- }
- .category-header {
- display: flex;
- justify-content: space-between;
- margin-bottom: 16rpx;
- background: #F6F8FC;
- padding: 18rpx 24rpx;
- .category-title {
- font-size: 24rpx;
- font-weight: 500;
- color: #042118;
- }
- .category-count {
- font-size: 24rpx;
- color: #999999;
- }
- }
- .pest-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 12rpx;
- padding: 6rpx 24rpx;
- &:last-child {
- margin-bottom: 0;
- }
- .pest-info {
- display: flex;
- align-items: center;
- .pest-color {
- width: 16rpx;
- height: 16rpx;
- border-radius: 50%;
- margin-right: 12rpx;
- }
- .pest-name {
- font-size: 24rpx;
- color: #042118;
- }
- }
- .pest-count {
- font-size: 24rpx;
- color: #042118;
- }
- }
- }
- }
- }
- </style>
|