样式更新

This commit is contained in:
978184212@qq.com 2025-11-27 18:25:23 +08:00
parent e4c8f8c24d
commit d57f761001
3 changed files with 412 additions and 199 deletions

View File

@ -23,11 +23,11 @@
@scrolltolower="lower" @scrolltolower="lower"
v-if="List.length != 0"> v-if="List.length != 0">
<view class="itembox" v-for="(item,index) in List" :key="index"> <view class="itembox" v-for="(item,index) in List" :key="index">
<view class="itembox_top" v-if="item.stationName"> <view class="itembox_top" v-if="item.fullDeviceName">
<view class="itembox_lef"> <view class="itembox_lef">
<image src="../../static/fz.png" mode=""></image> <image src="../../static/fz.png" mode=""></image>
<view class="title"> <view class="title">
{{item.stationName}} {{item.fullDeviceName}}
</view> </view>
</view> </view>
<view class="itembox_right"> <view class="itembox_right">
@ -41,18 +41,18 @@
{{it}} {{it}}
</view> </view>
</view> </view>
<view class="lists_item" v-for="(Item,Index) in item.alertContent" :key="Index"> <view class="lists_item" >
<view class="jczbs" v-if="Item.name"> <view class="jczbs">
{{Item.name}} {{item.itemName?item.itemName:''}}
</view> </view>
<view class="zbz" v-if="Item.val"> <view class="zbz" >
{{Item.val}} {{item.survValue?item.survValue:''}}
</view> </view>
<view class="sbsj" v-if="Item.valHeight" style="color: #FF4242;"> <view class="sbsj" style="color: #FF4242;">
{{Item.valLow}}~{{Item.valHeight}} {{item.normalValue?item.normalValue:''}}
</view> </view>
<view class="szqss" v-if="Item.unit"> <view class="szqss" >
{{Item.unit}} {{item.survUnit?item.survUnit:''}}
</view> </view>
</view> </view>
</block> </block>
@ -117,7 +117,7 @@
return { return {
List: [], List: [],
baseUrl: configService.apiUrl, baseUrl: configService.apiUrl,
tabList: ['监测指标名称', '监测指标值', '阈值范围', '单位'], tabList: ['监测项', '监测值', '阈值范围', '单位'],
array: [], array: [],
index: '', index: '',
sampTime: '', sampTime: '',
@ -320,7 +320,6 @@
} else { } else {
this.List = this.List.concat(data); this.List = this.List.concat(data);
} }
// //
const total = res.data.data.total || 0; const total = res.data.data.total || 0;
if (total > 0) { if (total > 0) {
@ -615,10 +614,12 @@
background-color: white; background-color: white;
padding: 10rpx 30rpx; padding: 10rpx 30rpx;
margin-top: 20rpx; margin-top: 20rpx;
border-bottom: 20rpx solid #f3f3f3;
} }
.itembox:first-child { .itembox:first-child {
margin-top: 0; margin-top: 0;
border-top: 20rpx solid #f3f3f3;
} }
.itembox_top { .itembox_top {
@ -736,6 +737,7 @@
font-family: Source Han Sans SC; font-family: Source Han Sans SC;
font-weight: 400; font-weight: 400;
color: #667482; color: #667482;
text-align: center;
} }
.zbz { .zbz {
@ -784,10 +786,12 @@
color: #2F3841; color: #2F3841;
display: inline-block; display: inline-block;
padding-bottom: 8rpx; padding-bottom: 8rpx;
text-align: center;
} }
.tabitem:first-child { .tabitem:first-child {
width: 31%; width: 32%;
text-align: center;
} }
.tabitem:nth-child(2) { .tabitem:nth-child(2) {

View File

@ -1,194 +1,355 @@
<template> <template>
<view class="container"> <view class="container">
<!-- <image src="../../static/zddt.jpg" mode="" class="bgimg" @click="todetail()"></image> --> <map id="map" ref="map" style="width: 100%; height:2000rpx;" scale="13" :markers="markers" longitude="111.436625"
<map latitude="36.771975" show-location @markertap="markertap" @callouttap="callouttap">
id="map" </map>
style="width: 100%; height:2000rpx;" <view class="zdxq">
scale="13" <view class="zdxqitem" @click="switch2Change('团柏河')">
:markers="markers"
longitude="110.628279"
latitude="35.546105"
show-location
@markertap="markertap"
@callouttap="callouttap">
<cover-view slot="callout">
<cover-view v-for="(item,index) in markers" :key="index" class="customCallout" :marker-id="item.id">
<cover-image class="imgs" src="@/static/zhandian_icon_xuqin_title.png" v-if="item.stationType == 'livestock'"></cover-image>
<cover-image class="imgs" src="@/static/zhandian_icon_nongtian_title.png" v-if="item.stationType == 'orient'"></cover-image>
<cover-view class="content" v-if="item.stationType == 'livestock' || item.stationType == 'orient'">
{{item.stationName}}
</cover-view>
</cover-view>
</cover-view>
</map>
<view class="zdxq">
<view class="zdxqitem">
<image src="../../static/zhandian_sahchong_dingwei.png" mode=""></image>
<view class="textss">
联网式太阳能杀虫灯
</view>
</view>
<view class="zdxqitem">
<image src="../../static/zhandian_xuqin_dingwei.png" mode=""></image>
<view class="textss">
畜禽养殖污染监测站
</view>
</view>
<view class="zdxqitem">
<image src="../../static/zhandian_nongtian_dingwei.png" mode=""></image> <image src="../../static/zhandian_nongtian_dingwei.png" mode=""></image>
<view class="textss"> <view class="textss">
农田面源污染监测站 团柏河典型小流域监测站
</view>
<!-- <view class="crildon" :style="!issscd?'background:#00ff37':'background: #ccc;'"></view> -->
</view>
<view class="zdxqitem" @click="switch2Change('对竹河')">
<image src="../../static/zhandian_xuqin_dingwei.png" mode=""></image>
<view class="textss">
对竹河典型小流域监测站
</view>
<!-- <view class="crildon" :style="!isssscd?'background:#00ff37':'background: #ccc;'"></view> -->
</view>
<view class="zdxqitem" @click="switch2Change('土壤')">
<image src="../../static/iconsheturangzs.png" mode=""></image>
<view class="textss">
土壤监测
</view> </view>
</view> </view>
</view> </view>
<view class="switchs">
<selectSwitch @change="switch1Change" :defaultSwitch="isscd" checked_bj_color="#13ce66"/>
<!-- <switch style="margin-right: 10rpx;" :checked="isscd" @change="switch1Change" /> -->
<!-- 显示/隐藏杀虫灯 -->
</view>
</view> </view>
</template> </template>
<script> <script>
import api from '@/api/api' import api from '@/api/api'
import selectSwitch from "@/components/xuan-switch/xuan-switch.vue"; import configService from '@/common/service/config.service.js';
export default { export default {
components: {
selectSwitch
},
data() { data() {
return { return {
baseUrl:configService.staticDomainURL,
markers: [], markers: [],
list:[], list: [],
pointers:[], issscd: false, // (false)
imgurl1:'@/static/zhandian_icon_nongtian_title.png', isssscd: false, // (false)
imgurl2:'@/static/zhandian_icon_xuqin_title.png', stationInfo: [],
isscd:true, cusLocation: [],
stationlist: [],
stationTwolist:[],
mapCtx: null //
}; };
}, },
onLoad() { onLoad() {
// this.isscd = true this.$nextTick(() => {
// this.getList()
},
onShow() {
this.isscd = true
this.$nextTick(()=>{
this.getList() this.getList()
}) })
}, },
onReady() {
// onReady
this.mapCtx = uni.createMapContext('map', this);
},
onShow() {
if (!uni.getStorageSync('third_session')) {
uni.reLaunch({
url: '/pages/loginindex'
})
}
},
methods: { methods: {
getList(){ getList() {
this.markers = [] this.markers = []
this.pointers = []
this.list = [] this.list = []
this.stationInfo = []
this.cusLocation = []
this.stationlist = []
this.stationTwolist = []
uni.showLoading({ uni.showLoading({
title: '加载中' title: '加载中'
}); });
this.$http.get('/applet/survStationInfo/stationMap').then(res =>{
if(this.isscd == true){ this.$http.get('/applet/survStationInfo/stationMap').then(res => {
this.list = [] // stationInfo deviceList
}else if(this.isscd == false){ const combinedList = [...res.data.data.stationInfo, ...res.data.data.deviceList];
this.list = res.data.data.pestlight this.stationlist = combinedList;
} this.stationTwolist = [...res.data.data.stationInfo];
var stationlist = res.data.data.stationInfo
if(this.list.length!=0){ console.log("合并后的stationlist+++++", this.stationlist);
for(var i=0;i<this.list.length;i++){
this.list[i].stationType = this.list[i].inType //
this.stationlist.forEach((item, index) => {
item.id = index;
// deviceList stationInfo
const markerItem = {
id: item.id,
latitude: Number(item.latitude || item.stationLatitude),
longitude: Number(item.longitude || item.stationLongitude),
stationType: item.stationType || 'device', // deviceList stationType 'device'
sortNo: item.sortNo || index,
stationName: item.name || item.stationName,
stationCode: item.ids || item.stationCode || item.id,
//
groupName: item.groupName || '',
//
deviceType: item.type || null
};
this.list.push(markerItem);
//
if (item.stationType === 'cusLocaltion') {
this.cusLocation.push(item);
} }
} if (item.stationType === 'orient' || item.stationType === 'livestock') {
if(stationlist){ this.stationInfo.push(item);
for(var k=0;k<stationlist.length;k++){
this.list.push({
latitude:stationlist[k].stationLatitude,
longitude:stationlist[k].stationLongitude,
stationType:stationlist[k].stationType,
sortNo:stationlist[k].sortNo,
stationName:stationlist[k].stationName,
stationCode:stationlist[k].stationCode
})
} }
} });
console.log(this.list,'数组')
// return this.issscd = false
if(this.list.length != 0){ this.isssscd = false
for(var i=0;i<this.list.length;i++){ this.qiyeChange()
if(this.list[i].stationType == 'pestlight'){ this.list1query()
this.list[i].iconPath = '/static/zhandian_sahchong_dingwei.png' this.addDeviceMarkers() //
this.list[i].latitude = Number(this.list[i].latitude)
this.list[i].longitude = Number(this.list[i].longitude) //
this.list[i].width = 15 setTimeout(() => {
this.list[i].height = 20 this.adjustMapToFitAllMarkers();
}else if(this.list[i].stationType == 'orient'){ }, 500);
this.list[i].iconPath = '/static/zhandian_nongtian_dingwei.png'
this.list[i].latitude = Number(this.list[i].latitude)
this.list[i].longitude = Number(this.list[i].longitude)
this.list[i].width = 35
this.list[i].height = 52
}else if(this.list[i].stationType == 'livestock'){
this.list[i].iconPath = '/static/zhandian_xuqin_dingwei.png'
this.list[i].latitude = Number(this.list[i].latitude)
this.list[i].longitude = Number(this.list[i].longitude)
this.list[i].width = 35
this.list[i].height = 52
}
this.pointers.push({
id:i,
iconPath:this.list[i].iconPath,
latitude:this.list[i].latitude,
longitude:this.list[i].longitude,
width:this.list[i].width,
height:this.list[i].height,
customCallout: {
anchorY: 0, // Y
anchorX: 0, // X
display: 'ALWAYS' ,//
},
stationType:this.list[i].stationType,
stationName:this.list[i].stationName,
stationCode:this.list[i].stationCode,
})
}
}
this.markers = this.pointers
console.log(this.markers,1523)
uni.hideLoading(); uni.hideLoading();
}) })
}, },
markertap(e){
console.log(e,'点击') //
var index = e.detail.markerId addDeviceMarkers() {
if(this.list[index].stationType == 'orient' || this.list[index].stationType == 'livestock'){ this.stationlist.forEach((item, index) => {
uni.navigateTo({ // deviceList type stationType
url:'/packDetail/pages/Site/detail?item='+ encodeURIComponent(JSON.stringify(this.list[index])) if (item.type && !item.stationType) {
}) let iconPath = '';
let width = 35;
let height = 35;
//
switch(item.type) {
case 'soil':
iconPath = this.baseUrl + '/icon/device/soil.png';
width = 40;
height = 40;
break;
case 'camera':
iconPath = this.baseUrl + '/icon/device/cam.png';
width = 45;
height = 45;
break;
default:
iconPath = this.baseUrl + '/icon/device/default.png';
}
const markerItem = {
id: item.id,
iconPath: iconPath,
latitude: Number(item.latitude),
longitude: Number(item.longitude),
width: width,
height: height,
customCallout: {
anchorY: 0,
anchorX: 0,
display: 'ALWAYS'
},
stationType: 'device',
stationName: item.name,
stationCode: item.ids,
deviceType: item.type,
joinCluster: true
};
this.markers.push(markerItem);
}
});
},
//
adjustMapToFitAllMarkers() {
if (this.mapCtx && this.list.length > 0) {
this.mapCtx.includePoints({
points: this.list.map(item => ({
latitude: item.latitude,
longitude: item.longitude
})),
padding: [40, 40, 40, 40] //
});
} }
}, },
callouttap(e){
console.log(e,'点击111') //
var index = e.detail.markerId adjustMapToRegion(regionName) {
if(this.list[index].stationType == 'orient' || this.list[index].stationType == 'livestock'){ let points = [];
uni.navigateTo({
url:'/packDetail/pages/Site/detail?item='+ encodeURIComponent(JSON.stringify(this.list[index])) if (regionName === '团柏河') {
}) //
points = this.stationTwolist
.filter(item => item.groupName === '团柏河')
.map(item => ({
latitude: Number(item.stationLatitude),
longitude: Number(item.stationLongitude)
}));
} else if (regionName === '对竹河') {
//
points = this.stationTwolist
.filter(item => item.groupName === '对竹河')
.map(item => ({
latitude: Number(item.stationLatitude),
longitude: Number(item.stationLongitude)
}));
}
if (points.length > 0 && this.mapCtx) {
this.mapCtx.includePoints({
points: points,
padding: [60, 60, 60, 60] //
});
} }
}, },
todetails(item){
console.log(item,'还是个然后') markertap(e) {
const index = e.detail.markerId
const marker = this.markers.find(m => m.id === index);
if (marker) {
if (['orient', 'livestock'].includes(marker.stationType)) {
uni.navigateTo({
url: `/packDetail/pages/Site/detail?item=${encodeURIComponent(JSON.stringify(marker))}`
})
} else if (marker.stationType === 'device') {
//
uni.showToast({
title: `设备: ${marker.stationName}`,
icon: 'none'
});
//
}
}
},
callouttap(e) {
const index = e.detail.markerId
const marker = this.markers.find(m => m.id === index);
if (marker) {
if (['orient', 'livestock'].includes(marker.stationType)) {
uni.navigateTo({
url: `/packDetail/pages/Site/detail?item=${encodeURIComponent(JSON.stringify(marker))}`
})
} else if (marker.stationType === 'device') {
//
uni.showToast({
title: `设备: ${marker.stationName}`,
icon: 'none'
});
}
}
},
qiyeChange() {
for (let i = 0; i < this.cusLocation.length; i++) {
const item = this.cusLocation[i];
item.iconPath = '/static/qiyeIcon.png';
item.latitude = Number(item.stationLatitude);
item.longitude = Number(item.stationLongitude);
item.width = 35;
item.height = 52;
const markerItem = {
id: item.id,
iconPath: item.iconPath,
latitude: item.latitude,
longitude: item.longitude,
width: item.width,
height: item.height,
customCallout: {
anchorY: 0,
anchorX: 0,
display: 'ALWAYS'
},
stationType: item.stationType,
stationName: item.stationName,
stationCode: item.stationCode,
joinCluster: true
};
this.markers.push(markerItem);
}
},
switch2Change(name) {
if (name === "团柏河") {
this.issscd = !this.issscd;
} else {
this.isssscd = !this.isssscd;
}
//
if ((name === "团柏河" && !this.issscd) || (name === "对竹河" && !this.isssscd)) {
// 绿
setTimeout(() => {
this.adjustMapToRegion(name);
}, 300);
} else {
//
setTimeout(() => {
this.adjustMapToFitAllMarkers();
}, 300);
}
},
list1query() {
// orient
this.markers = this.markers.filter(item => item.stationType !== 'orient');
if (!this.issscd) {
for (let i = 0; i < this.stationlist.length; i++) {
const item = this.stationlist[i];
if (item.stationType === 'orient') {
item.iconPath = this.baseUrl +'/'+ item.stationIcon;
item.latitude = Number(item.stationLatitude);
item.longitude = Number(item.stationLongitude);
item.width = 172;
item.height = 148;
const markerItem = {
id: item.id,
iconPath: item.iconPath,
latitude: item.latitude,
longitude: item.longitude,
width: item.width,
height: item.height,
customCallout: {
anchorY: 0,
anchorX: 0,
display: 'ALWAYS'
},
stationType: item.stationType,
stationName: item.stationName,
stationCode: item.stationCode,
joinCluster: true
};
this.markers.push(markerItem);
}
}
}
}, },
switch1Change(e){
console.log(e,'gwgweg')
this.isscd = e
// this.isscd = e.detail.value
this.$nextTick(()=>{
this.getList()
})
}
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.bgimg{ /* 样式保持不变 */
.bgimg {
position: fixed; position: fixed;
// z-index: -99; // z-index: -99;
top: 0; top: 0;
@ -196,7 +357,8 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.customCallout{
.customCallout {
width: 349rpx; width: 349rpx;
height: 49rpx; height: 49rpx;
color: #fff; color: #fff;
@ -210,7 +372,8 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.customCallout1{
.customCallout1 {
width: 349rpx; width: 349rpx;
height: 49rpx; height: 49rpx;
color: #fff; color: #fff;
@ -224,12 +387,14 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.zdxq{
.zdxq {
position: fixed; position: fixed;
left: 33rpx; left: 33rpx;
bottom: 36rpx; bottom: 36rpx;
} }
.zdxqitem{
.zdxqitem {
padding: 8rpx 0 7rpx 17rpx; padding: 8rpx 0 7rpx 17rpx;
display: flex; display: flex;
align-items: center; align-items: center;
@ -238,42 +403,55 @@
font-family: Source Han Sans SC; font-family: Source Han Sans SC;
font-weight: 500; font-weight: 500;
color: #FFFFFF; color: #FFFFFF;
text-shadow: 0rpx 1rpx 0rpx rgba(4,49,52,0.55); text-shadow: 0rpx 1rpx 0rpx rgba(4, 49, 52, 0.55);
width: 299rpx; width: 359rpx;
background: rgba(0,0,0,0.52); background: rgba(0, 0, 0, 0.52);
border: 1px solid #4B677C; border: 1px solid #4B677C;
border-radius: 6rpx; border-radius: 6rpx;
margin-bottom: 10rpx; margin-bottom: 10rpx;
position: relative; position: relative;
} }
.zdxqitem:last-child{
.crildon {
width: 10rpx;
height: 10rpx;
border-radius: 50%;
margin-right: 15rpx;
}
.zdxqitem:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
.zdxqitem image{
.zdxqitem image {
width: 33rpx; width: 33rpx;
height: 50rpx; height: 50rpx;
margin-right: 15rpx; margin-right: 15rpx;
} }
.zdxqitem:first-child image{
.zdxqitem:first-child image {
width: 30rpx; width: 30rpx;
height: 40rpx; height: 40rpx;
margin-right: 15rpx; margin-right: 15rpx;
} }
.textss{
.textss {
flex: 1; flex: 1;
text-align: left; text-align: left;
} }
.imgs{
.imgs {
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: -9; z-index: -9;
} }
.switchs{
.switchs {
position: fixed; position: fixed;
top:36rpx; top: 36rpx;
right: 40rpx; right: 40rpx;
display: flex; display: flex;
align-items: center; align-items: center;
} }
</style> </style>

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="container"> <view class="container">
<map id="map" ref="map" style="width: 100%; height:2000rpx;" scale="13" :markers="markers" longitude="111.436625" <map id="map" ref="map" style="width: 100%; height: calc(100vh + 50rpx);" scale="13" :markers="markers" longitude="111.436625"
latitude="36.771975" show-location @markertap="markertap" @callouttap="callouttap"> latitude="36.771975" show-location @markertap="markertap" @callouttap="callouttap">
</map> </map>
<view class="zdxq"> <view class="zdxq">
@ -9,14 +9,18 @@
<view class="textss"> <view class="textss">
团柏河典型小流域监测站 团柏河典型小流域监测站
</view> </view>
<view class="crildon" :style="!issscd?'background:#00ff37':'background: #ccc;'"></view>
</view> </view>
<view class="zdxqitem" @click="switch2Change('对竹河')"> <view class="zdxqitem" @click="switch2Change('对竹河')">
<image src="../../static/zhandian_xuqin_dingwei.png" mode=""></image> <image src="../../static/zhandian_xuqin_dingwei.png" mode=""></image>
<view class="textss"> <view class="textss">
对竹河典型小流域监测站 对竹河典型小流域监测站
</view> </view>
<view class="crildon" :style="!isssscd?'background:#00ff37':'background: #ccc;'"></view> </view>
<view class="zdxqitem" @click="switch2Change('土壤')">
<image src="../../static/iconsheturangzs.png" mode=""></image>
<view class="textss">
土壤监测
</view>
</view> </view>
</view> </view>
</view> </view>
@ -33,6 +37,7 @@
list: [], list: [],
issscd: false, // (false) issscd: false, // (false)
isssscd: false, // (false) isssscd: false, // (false)
isSoilShow: false, // (false)
stationInfo: [], stationInfo: [],
cusLocation: [], cusLocation: [],
stationlist: [], stationlist: [],
@ -109,6 +114,7 @@
this.issscd = false this.issscd = false
this.isssscd = false this.isssscd = false
this.isSoilShow = false
this.qiyeChange() this.qiyeChange()
this.list1query() this.list1query()
this.addDeviceMarkers() // this.addDeviceMarkers() //
@ -203,6 +209,14 @@
latitude: Number(item.stationLatitude), latitude: Number(item.stationLatitude),
longitude: Number(item.stationLongitude) longitude: Number(item.stationLongitude)
})); }));
} else if (regionName === '土壤') {
//
points = this.stationlist
.filter(item => item.type === 'soil' || item.deviceType === 'soil')
.map(item => ({
latitude: Number(item.latitude || item.stationLatitude),
longitude: Number(item.longitude || item.stationLongitude)
}));
} }
if (points.length > 0 && this.mapCtx) { if (points.length > 0 && this.mapCtx) {
@ -210,6 +224,12 @@
points: points, points: points,
padding: [60, 60, 60, 60] // padding: [60, 60, 60, 60] //
}); });
} else if (points.length === 0) {
//
uni.showToast({
title: `未找到${regionName}相关的监测点`,
icon: 'none'
});
} }
}, },
@ -281,24 +301,35 @@
}, },
switch2Change(name) { switch2Change(name) {
if (name === "团柏河") { //
this.issscd = !this.issscd; const stateMap = {
} else { '团柏河': 'issscd',
this.isssscd = !this.isssscd; '对竹河': 'isssscd',
} '土壤': 'isSoilShow'
};
//
if ((name === "团柏河" && !this.issscd) || (name === "对竹河" && !this.isssscd)) { if (stateMap[name]) {
// 绿 this[stateMap[name]] = !this[stateMap[name]];
setTimeout(() => { }
this.adjustMapToRegion(name);
}, 300); //
} else { const shouldFocus = {
// '团柏河': !this.issscd,
setTimeout(() => { '对竹河': !this.isssscd,
this.adjustMapToFitAllMarkers(); '土壤': !this.isSoilShow
}, 300); };
}
if (shouldFocus[name]) {
//
setTimeout(() => {
this.adjustMapToRegion(name);
}, 300);
} else {
//
setTimeout(() => {
this.adjustMapToFitAllMarkers();
}, 300);
}
}, },
list1query() { list1query() {