diff --git a/page_user/user_set.vue b/page_user/user_set.vue index 6317f3c..05934a2 100644 --- a/page_user/user_set.vue +++ b/page_user/user_set.vue @@ -84,7 +84,7 @@ - + 重置 @@ -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) { diff --git a/pages/Apiary/Apiary_detail.vue b/pages/Apiary/Apiary_detail.vue index 66f447e..6386f13 100644 --- a/pages/Apiary/Apiary_detail.vue +++ b/pages/Apiary/Apiary_detail.vue @@ -151,10 +151,10 @@ 电子围栏(Km) - 最大距离 - + 确定 @@ -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; // 角度从0到2π - 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; // 转换到-180到180的范围 + 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 => { diff --git a/pages/map.vue b/pages/map.vue index 6b310a3..dda2b67 100644 --- a/pages/map.vue +++ b/pages/map.vue @@ -4,7 +4,7 @@ title-size='36' :title-bold='true' height='45' id="navbar"> + :show-location='true' :markers="covers" @markertap="handleMarkerClick"> @@ -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,