This commit is contained in:
Sliverber 2024-07-05 14:08:02 +08:00
commit 099e437e42
3 changed files with 70 additions and 71 deletions

View File

@ -84,7 +84,7 @@
</u-checkbox-group>
</view>
<view class="btn_box">
<view class="btns">
<view class="btns" @click="btncz">
重置
</view>
<view class="btn1" @click="btnbc">
@ -159,6 +159,25 @@
},
methods: {
btncz(){
this.miteInterval = ''
this.minPower = ''
this.minHeat = ''
this.maxHeat = ''
this.maxFan = ''
this.minCo2 = ''
this.maxCo2 = ''
this.list.forEach(item => {
if (item.checked) {
item.checked = false;
}
})
this.lists.forEach(item => {
if (item.checked) {
item.checked = false;
}
})
},
checkboxChange(e) {
let index = this.value.indexOf(e)
if (index > -1) {

View File

@ -151,10 +151,10 @@
电子围栏Km
</view>
<view class="cont">
最大距离 <view class="ipt"><input type="text" class="ips" v-model="code" placeholder=" "
最大距离 <view class="ipt"><input type="text" class="ips" v-model="dzcode" placeholder=" "
placeholder-class="my-placeholder" /></view>
</view>
<view class="btn">
<view class="btn" @click="btnqued">
确定
</view>
</view>
@ -181,18 +181,8 @@
latitude: '',
longitude: '',
isMap: false,
zoomSize: 15,
markers: [{
id: 1,
latitude: 39.90469,
longitude: 116.40717,
title: 'Marker1'
}, {
id: 2,
latitude: 39.90969,
longitude: 116.41217,
title: 'Marker2'
}],
zoomSize: 13,
markers: [],
showtq: false,
showwl: false,
apiaryId: '',
@ -204,6 +194,7 @@
chartData8: [],
daytime: '',
covers: [],
dzcode:'',
polygons: [{
//
points: [],
@ -242,8 +233,8 @@
id: Number(item.storeId),
latitude: item.lat,
longitude: item.lng,
width: 25,
height: 30,
width: 20,
height: 20,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/ukbyhyrDcp3VzgyeJo2G',
})
})
@ -255,7 +246,31 @@
}
});
},
//
btnqued(){
let data = {
apiaryId:this.apiaryId,
radius:this.dzcode
}
this.$u.put(`farm/apiary`,data).then(res =>{
if(res.code == 200){
uni.showToast({
title: '修改成功',
icon: 'none',
duration: 2000
})
this.showwl = false
this.getfcxq()
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
},
btnedfc() {
uni.navigateTo({
@ -273,7 +288,6 @@
})
},
gettq() {
console.log(this.latitude, this.longitude);
this.$u.get(`weather/7d?location=${this.longitude},${this.latitude}`).then(res => {
if (res.code == 200) {
this.daily = res.data.daily
@ -314,8 +328,6 @@
let circlePoints = this.calculateCirclePoints(centerLat, centerLon, radius)
this.polygons[0].points = circlePoints
console.log(this.polygons[0].points, '圆形电子围栏点')
this.gettq()
this.getmy()
this.getfz()
@ -330,28 +342,28 @@
},
//
calculateCirclePoints(lat, lon, radiusInKm, numPoints = 36) {
let earthRadiusKm = 6371; //
let radius = radiusInKm / earthRadiusKm; //
let earthRadiusKm = 6371
let radius = radiusInKm / earthRadiusKm
let points = [];
for (let i = 0; i < numPoints; i++) {
let angle = (i / (numPoints - 1)) * 2 * Math.PI; // 02π
let latRad = lat * Math.PI / 180; //
let lonRad = lon * Math.PI / 180; //
let angle = (i / (numPoints - 1)) * 2 * Math.PI
let latRad = lat * Math.PI / 180
let lonRad = lon * Math.PI / 180
let newLatRad = Math.asin(Math.sin(latRad) * Math.cos(radius) +
Math.cos(latRad) * Math.sin(radius) * Math.cos(angle));
Math.cos(latRad) * Math.sin(radius) * Math.cos(angle))
let newLonRad = lonRad + Math.atan2(
Math.sin(angle) * Math.sin(radius) * Math.cos(latRad),
Math.cos(radius) - Math.sin(latRad) * Math.sin(newLatRad)
);
let newLat = newLatRad * 180 / Math.PI;
let newLon = (newLonRad + 3 * Math.PI) % (2 * Math.PI) - Math.PI; // -180180
let newLon = (newLonRad + 3 * Math.PI) % (2 * Math.PI) - Math.PI
newLon = newLon * 180 / Math.PI;
points.push({
latitude: newLat,
longitude: newLon
longitude: newLon
});
}
return points;
return points
},
getmy() {
this.$u.get(`/common/getDictByType?dictType=apiary_honey_type`).then(res => {

View File

@ -4,7 +4,7 @@
title-size='36' :title-bold='true' height='45' id="navbar">
</u-navbar>
<map class="map" id="map" ref="map" :scale="zoomSize" :latitude="latitude" :longitude="longitude"
:show-location='true' :markers="covers"></map>
:show-location='true' :markers="covers" @markertap="handleMarkerClick"></map>
<view class="fxtongji">
<view class="one">
@ -36,42 +36,7 @@
longitude: '',
isMap: false,
zoomSize: 15,
markers: [{
id: 1,
latitude: 39.90469,
longitude: 116.40717,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uYrX2QTRLdVVDTB3E5cp',
width: 39,
height: 46,
callout: {
content: '福鼎蜂场福建省宁德市福鼎市太姥山镇秦屿大道二号\n', //
color: '#000', //
fontSize: 14, //
borderRadius: 10, //
bgColor: '#FFFFFF', //
padding: 10, //
display: 'ALWAYS', //
textAlign: 'center', //
}
}, {
id: 2,
latitude: 39.90969,
longitude: 116.41217,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uYrX2QTRLdVVDTB3E5cp',
width: 39,
height: 46,
callout: {
content: '未上架', //
color: '#ffffff', //
fontSize: 14, //
borderRadius: 10, //
bgColor: '#000000', //
padding: 6, //
display: 'ALWAYS', //
}
}],
markers: [],
jinweidu:'',
covers: [],
mapContext: null,
@ -98,6 +63,11 @@
}
},
methods: {
//
handleMarkerClick(e) {
console.log(e.markerId);
},
getMyLocations() {
uni.getLocation({
type: 'wgs84',
@ -106,14 +76,13 @@
this.latitude = Number(res.latitude.toFixed(5)) - 0.004
this.longitude = Number(res.longitude.toFixed(5)) + 0.004
// this.setMapScale()
//
this.$u.get("/farm/beehive/listNearBy?center=" + this.jinweidu + '&radius=' + 1000).then(
res => {
if (res.code == 200) {
this.listmaps = res.data
res.data.forEach(item => {
this.covers.push({
id: parseFloat(item.storeId),
id: parseFloat(item.beehiveId),
latitude: item.lat,
longitude: item.lng,
width: 25,
@ -146,7 +115,6 @@
textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white',
borderColor:'#fff',
borderRadius:5,
// bgColor: 'rgba(255, 255, 255, 0.7)'
}
})
// this.covers.push(shopCover)
@ -173,7 +141,7 @@
this.listmap = res.data
res.data.forEach(item => {
this.covers.push({
id: parseFloat(item.storeId),
id: parseFloat(item.apiaryId),
latitude: item.lat,
longitude: item.lng,
width: 25,