| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019 |
- <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>
- <!-- 孢子仪2.1:文件夹列表,点击切换文件夹 -->
- <view class="tabs-fold" v-if="sporeTwo && folderList.length">
- <view
- class="tabs-fold-item"
- :class="{ active: folderId == item.id }"
- v-for="(item, index) in folderList"
- :key="index"
- @click="handleFolderClick(item)"
- >
- <image src="https://s3.hnyfwlw.com/webstaticimg/bigdata_app/image/file.png" class="tabs-fold-icon" />
- <view>{{ formatFold(item.file_fold) }}</view>
- </view>
- </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> -->
- <!-- 主图片区域 -->
- <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
- :src="currentImg.addr"
- class="main-photo-image"
- mode="widthFix"
- @load="onImageLoad"
- />
- <!-- 虫子标记层 -->
- <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">{{ sporeTwo ? formatItemTime(currentImg) : 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: sporeTwo ? currentIndex == index : img_id == item.ids }"
- @click="onThumbnailClick(item, index)"
- >
- <image
- :src="item.addr"
- class="thumbnail-image"
- />
- </view>
- </view>
- </view>
- <!-- 识别结果 -->
- <view class="recognition-result" v-if="pestList.length">
- <view class="result-title">当前图片识别结果</view>
- <!-- 一类害虫 -->
- <view class="pest-category">
- <view class="category-header">
- <text class="category-title">孢子名称</text>
- <text class="category-count">数量</text>
- </view>
- <view class="pest-item" v-for="(pest,index) in pestList" :key="index">
- <view class="pest-info">
- <view class="pest-color"></view>
- <text class="pest-name">{{ pest.text }}</text>
- </view>
- <text class="pest-count">{{ pest.count }}</text>
- </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,
- pestYype:{},
- 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:'',
- pest_list_arr:[],
- thumbnails: [],
- addtime:'',
- currentImg:{},
- bugMarkers: [],
- imageWidth: 0,
- imageHeight: 0,
- imgOld_id:'',
- containerHeight: '300px',
- pestDict: {}, // 虫子字典 {id: name}
- pestColorMap: {}, // 害虫颜色映射 {pestName: color}
- // 孢子仪2.1(device_code=1):本地渲染整组图片
- sporeTwo: false,
- currentIndex: 0,
- folderList: [],
- folderId: '',
- };
- },
- async onLoad(options) {
- const {id,img_id,currentYear,addtime} = options
- this.device_id = id
- this.imgOld_id = img_id
- this.img_id = img_id
- this.currentYear = currentYear
- // 孢子仪2.1:图片列表从 storage 读取,不走接口
- this.sporeTwo = options.spore_two == 1;
- if (this.sporeTwo) {
- this.folderId = options.fold_id || '';
- this.initSporePhotos();
- this.fetchSporeFolders();
- return;
- }
- this.addtime = this.formatTime(Number(addtime)*1000);
- this.time_begin = this.addtime;
- this.defaultDate = this.addtime;
- this.time_end = this.addtime;
- 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.getPestDict();
- // this.getPestLevelMap();
- this.getDevicePhotoDetails();
- // this.getDevicePhotoDetails();
- },
- methods: {
- // 孢子仪2.1:读取列表页带过来的整组图片,定位到点击的那张
- initSporePhotos() {
- try {
- this.thumbnails = JSON.parse(uni.getStorageSync('bzy_two_folder_imgs') || '[]');
- } catch (error) {
- this.thumbnails = [];
- }
- uni.removeStorageSync('bzy_two_folder_imgs');
- this.thumbnails = (this.thumbnails || []).filter(img => img && img.addr);
- const idx = this.thumbnails.findIndex(img => String(img.id) === String(this.img_id));
- this.currentIndex = idx > -1 ? idx : 0;
- this.currentImg = this.thumbnails[this.currentIndex] || {};
- this.getPestDict();
- },
- // 优先取文件名里的拍摄时间(20260905110150z0x0_sharp_1.jpg),孢子仪2.1所有图的addtime都是文件夹时间
- formatItemTime(item) {
- const match = String(item.addr || '').match(/(\d{14})/);
- if (match) {
- const s = match[1];
- return `${s.slice(0, 4)}-${s.slice(4, 6)}-${s.slice(6, 8)} ${s.slice(8, 10)}:${s.slice(10, 12)}:${s.slice(12, 14)}`;
- }
- return this.formatDate(item.addtime);
- },
- // 孢子仪2.1:拉取文件夹列表
- async fetchSporeFolders() {
- try {
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.bzy.bzy_file_fold',
- method: 'POST',
- data: {
- device_id: this.device_id,
- page: 1,
- size: 999,
- },
- });
- this.folderList = res?.data || [];
- } catch (error) {
- this.folderList = [];
- }
- },
- // 孢子仪2.1:切换文件夹,重新加载该文件夹的图片
- async handleFolderClick(item) {
- if (!item || !item.id || item.id == this.folderId) return;
- this.folderId = item.id;
- uni.showLoading({ title: '加载中' });
- try {
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.bzy.bzy_two_percent_one_photo',
- method: 'POST',
- data: {
- id: item.id,
- page: 1,
- size: 32,
- },
- });
- this.thumbnails = (res?.data || []).filter(img => img && img.addr);
- this.currentIndex = 0;
- this.currentImg = this.thumbnails[0] || {};
- // 重置图片尺寸,等新图加载后重算识别框
- this.imageWidth = 0;
- this.imageHeight = 0;
- this.processSporePhoto();
- } catch (error) {
- this.thumbnails = [];
- } finally {
- uni.hideLoading();
- }
- },
- // 20260905110035 → 2026-09-05 11:00
- formatFold(str) {
- const s = String(str || '');
- if (s.length < 12) return s;
- return `${s.slice(0, 4)}${s.slice(4, 6)}${s.slice(6, 8)}_${s.slice(8, 10)}${s.slice(10, 12)}`;
- },
- // 孢子仪2.1:缩略图点击切换当前图片
- onThumbnailClick(item, index) {
- if (this.sporeTwo) {
- if (index === this.currentIndex) return;
- this.currentIndex = index;
- this.currentImg = this.thumbnails[index] || {};
- this.processSporePhoto();
- return;
- }
- this.selectThumbnail(item);
- },
- // 孢子仪2.1:根据 label 里的识别框生成标记层和识别结果(label: [{"类目id": [x1,y1,x2,y2,置信度]}])
- processSporePhoto() {
- const img = this.currentImg || {};
- let label = img.label || [];
- if (typeof label === 'string') {
- try {
- label = JSON.parse(label.replace(/'/g, '"'));
- } catch (error) {
- label = [];
- }
- }
- if (!Array.isArray(label)) label = [];
- // 图片未加载完成时先给默认值,加载完成后 onImageLoad 会重算
- if (!this.imageWidth || !this.imageHeight) {
- this.imageWidth = 1000;
- this.imageHeight = 1000;
- }
- const markers = [];
- const counts = new Map();
- label.forEach(item => {
- for (let key in item) {
- const box = item[key] || [];
- const [x1, y1, x2, y2] = box;
- const name = this.pestDict[key] || this.pestDict[String(key)] || key;
- counts.set(name, (counts.get(name) || 0) + 1);
- if (x1 === undefined || !this.imageWidth) continue;
- markers.push({
- id: name,
- x: (x1 / this.imageWidth) * 100,
- y: (y1 / this.imageHeight) * 100,
- width: ((x2 - x1) / this.imageWidth) * 100,
- height: ((y2 - y1) / this.imageHeight) * 100,
- color: this.getPestColor(name),
- text: name
- });
- }
- });
- this.bugMarkers = markers;
- this.pestList = [...counts.entries()].map(([text, count]) => ({ text, count }));
- },
- getPestName(id){
- return this.pestDict[id] || 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.getDevicePhotoDetails();
- },
- async handleChange(e){
- console.log(e,'e')
- this.time_begin = e.result;
- this.time_end = e.result;
- this.pestList = [];
- await this.getDevicePhotoDetails()
- },
- 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}`;
- },
- 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) {
- console.error('获取虫子字典失败:', 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.forecast_system.bzy_photo_detail',
- method: 'POST',
- data: {
- cmd:'bzy',
- img_id: this.img_id,
- },
- });
- this.currentImg = res;
- console.log(this.currentImg,'thiscurrentImg')
- // 处理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])
- }
- }
- })
- }
- }
- },
- 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';
- console.log('图片尺寸:', this.imageWidth, this.imageHeight, '容器高度:', this.containerHeight);
- // 图片加载完成后处理bugMarkers
- if (this.sporeTwo) {
- this.processSporePhoto();
- return;
- }
- this.processBugMarkers();
- },
-
- processBugMarkers() {
- console.log('22222', this.currentImg);
- if(this.currentImg.is_mark){
- if(!this.currentImg.mark){
- this.bugMarkers = [];
- return;
- }
- }else{
- if(!this.currentImg.label){
- this.bugMarkers = [];
- return;
- }
- }
- // 如果没有图片尺寸,先设置默认值
- if (!this.imageWidth || !this.imageHeight) {
- console.log('没有图片尺寸,使用默认值');
- this.imageWidth = 1000;
- this.imageHeight = 1000;
- }
- try {
- // 处理label参数,将单引号替换为双引号
- // let labelStr = this.currentImg.label;
- // let label
- // if(labelStr){
- // labelStr = labelStr?.replace(/'/g, '"');
- // console.log(labelStr,'labelStrlabelStr')
- // label = JSON.parse(labelStr);
- // }
- const markers = [];
- // 根据原图宽度计算缩放比例
-
- let scaleRatio = 3.1;
- if (this.imageWidth >= 5000) {
- scaleRatio = 4;
- } else if (this.imageWidth >= 4000) {
- scaleRatio = 1;
- } else {
- scaleRatio = 2.39;
- }
- console.log('原图宽度:', this.imageWidth, '缩放比例:', scaleRatio);
- const mark = this.currentImg.mark || []
- if(this.currentImg.is_mark){
- mark.forEach(item=>{
- 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;
- markers.push({
- id: item.text, // 显示虫子名字
- x,
- y,
- width,
- height,
- text:item.text,
- color:this.getPestColor(item.text)
- });
- })
- }else{
- 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,
- text:pestName,
- });
- }
- });
- }
- console.log(markers,'markersmarkers')
- this.bugMarkers = markers;
- // 改成按照text合并,并把数量也合并
- const pestArr = new Map()
- markers.forEach(item=>{
- if(!pestArr.has(item.text)){
- pestArr.set(item.text, 1)
- }else{
- pestArr.set(item.text, pestArr.get(item.text) + 1)
- }
- })
- console.log(pestArr,'pestArr')
- const arr = []
- for(let [key, value] of pestArr){
- arr.push({
- text:key,
- count:value
- })
- }
-
- this.pestList = [...arr];
- } catch (error) {
- console.error('处理label参数失败:', error);
- this.bugMarkers = [];
- }
- },
- handleBack() {
- uni.navigateBack({
- delta: 1
- });
- },
- goBack() {
- uni.navigateBack();
- },
- selectThumbnail(item) {
- this.img_id = item.ids;
- 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;
- }
- }
- // 孢子仪2.1:文件夹列表
- .tabs-fold {
- display: flex;
- align-items: center;
- text-align: center;
- // 可左右滚动
- overflow-x: auto;
- white-space: nowrap;
- padding-bottom: 24rpx;
- margin-top: 48rpx;
- // 隐藏滚动条
- -ms-overflow-style: none;
- scrollbar-width: none;
- .tabs-fold-item {
- display: flex;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- flex-shrink: 0; // 不压缩子项,超出容器宽度才能横向滚动
- background: #FFFFFF;
- border-radius: 24rpx;
- border: 4rpx solid transparent;
- box-sizing: border-box;
- width: 180rpx;
- padding: 16rpx 0;
- margin: 0 12rpx;
- text-align: center;
- font-size: 24rpx;
- font-weight: 400;
- color: #656565;
- font-family: 'Source Han Sans CN VF';
- &.active {
- border-color: #0BBC58;
- }
- .tabs-fold-icon {
- width: 48rpx;
- height: 48rpx;
- margin-bottom: 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 {
- 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;
- }
- }
- /* 主图片区域 */
- .main-photo {
- position: relative;
- margin: 24rpx 24rpx 24rpx;
- background-color: #FFFFFF;
- border-radius: 16rpx;
- 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;
- }
- }
- /* 缩略图预览 */
- .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>
|