diff --git a/components/tab-bar/tab-bar.vue b/components/tab-bar/tab-bar.vue index 4dbc302..3aa3b1f 100644 --- a/components/tab-bar/tab-bar.vue +++ b/components/tab-bar/tab-bar.vue @@ -134,7 +134,8 @@ export default { <style lang="scss" scoped> .cont { position: fixed; - left: 60rpx; + left: 50%; + transform: translateX(-50%); bottom: 78rpx; width: 664rpx; height: 122rpx; diff --git a/page_Beehive/Beehive_detail.vue b/page_Beehive/Beehive_detail.vue index 9b4f084..4597a4f 100644 --- a/page_Beehive/Beehive_detail.vue +++ b/page_Beehive/Beehive_detail.vue @@ -6,9 +6,9 @@ <view class="mapbox"> <map class="map" id="map" ref="map" :scale="zoomSize" :latitude="latitude" :longitude="longitude" :show-location='true' :markers="covers"> </map> - <view class="fxmask" v-if="dtflag"> - 未找到位置信息 - </view> + <view class="fxmask" v-if="dtflag"> + 未找到位置信息 + </view> <!-- <view class="btn" @click="showwl = true"> <image src="https://api.ccttiot.com/smartmeter/img/static/uAJBChYkLJO66dYUkJ8M" mode=""></image> @@ -17,13 +17,15 @@ <view class="tit"> {{obj.name == undefined ? '--' : obj.name}}-{{obj.sn == undefined ? '--' : obj.sn}} <view class="sets"> - <image @click="btnmenu" src="https://api.ccttiot.com/smartmeter/img/static/ulHBKvkXDfe9OIveIJKZ" mode=""></image> + <!-- <image @click="btnmenu" src="https://api.ccttiot.com/smartmeter/img/static/ulHBKvkXDfe9OIveIJKZ" mode=""></image> --> + <image @click="btnedit" src="https://api.ccttiot.com/smartmeter/img/static/ulHBKvkXDfe9OIveIJKZ" + mode=""></image> <view class="menu" v-if="menuflag"> <view class="menu_li" @click="btnedit"> <image src="https://api.ccttiot.com/smartmeter/img/static/uE84FLJ6hKTfgt6gxYMw" mode=""></image> 编辑信息 </view> - <!-- <view class="menu_li"> + <!-- <view class="menu_li"> <image src="https://api.ccttiot.com/smartmeter/img/static/uBfAFsDIhqFTFKxL0PVP" mode=""></image> 投放认养 </view> @@ -41,10 +43,12 @@ <view class="weather"> <view class="weather_left"> <view class="txt"> - 多云 {{daily[0].tempMin == undefined ? '--' : daily[0].tempMin}}℃ ~ {{daily[0].tempMax == undefined ? '--' : daily[0].tempMax}}℃ + 多云 {{daily[0].tempMin == undefined ? '--' : daily[0].tempMin}}℃ ~ + {{daily[0].tempMax == undefined ? '--' : daily[0].tempMax}}℃ </view> <view class="txt" style="margin-left: 40rpx;"> - {{daily[0].windDirDay == undefined ? '--' : daily[0].windDirDay }} {{daily[0].windSpeedDay == undefined ? '--' : daily[0].windSpeedDay}}级 + {{daily[0].windDirDay == undefined ? '--' : daily[0].windDirDay }} + {{daily[0].windSpeedDay == undefined ? '--' : daily[0].windSpeedDay}}级 </view> </view> <view class="weather_right" @click="btngd"> @@ -113,7 +117,7 @@ {{obj.surplusPower}}% </view> </view> - <view class="echarts_box"> + <view class="echarts_box" @click="btnec(1)"> <view class="echarts_top"> <view class="top_left"> 温度 @@ -138,7 +142,7 @@ </uni-ec-canvas> </view> </view> - <view class="echarts_box"> + <view class="echarts_box" @click="btnec(2)"> <view class="echarts_top"> <view class="top_left"> 湿度 @@ -163,7 +167,7 @@ </uni-ec-canvas> </view> </view> - <view class="echarts_box"> + <view class="echarts_box" @click="btnec(3)"> <view class="echarts_top"> <view class="top_left"> 重量 @@ -174,12 +178,12 @@ </view> <view class="top_right"> <view style="width: 1rpx;"> - + </view> <view class="txt"> 历史走势<view class="iconfont icon-xiangyou1"></view> </view> - + </view> </view> <view class="echarts"> @@ -188,7 +192,7 @@ </uni-ec-canvas> </view> </view> - <view class="echarts_box"> + <view class="echarts_box" @click="btnec(4)"> <view class="echarts_top"> <view class="top_left"> 进出量 @@ -199,12 +203,12 @@ </view> <view class="top_right"> <view style="width: 1rpx;"> - + </view> <view class="txt"> 历史走势<view class="iconfont icon-xiangyou1"></view> </view> - + </view> </view> <view class="echarts"> @@ -213,7 +217,7 @@ </uni-ec-canvas> </view> </view> - <view class="echarts_box"> + <view class="echarts_box" @click="btnec(5)"> <view class="echarts_top"> <view class="top_left"> 频率 @@ -224,12 +228,12 @@ </view> <view class="top_right"> <view style="width: 1rpx;"> - + </view> <view class="txt"> 历史走势<view class="iconfont icon-xiangyou1"></view> </view> - + </view> </view> <view class="echarts"> @@ -238,7 +242,7 @@ </uni-ec-canvas> </view> </view> - <view class="echarts_box"> + <view class="echarts_box" @click="btnec(6)"> <view class="echarts_top"> <view class="top_left"> 二氧化碳 @@ -249,12 +253,12 @@ </view> <view class="top_right"> <view style="width: 1rpx;"> - + </view> <view class="txt"> 历史走势<view class="iconfont icon-xiangyou1"></view> </view> - + </view> </view> <view class="echarts"> @@ -268,7 +272,8 @@ <view class="weather_info_tit"> 未来7日天气预知 </view> - <image src="https://api.ccttiot.com/smartmeter/img/static/uQK4q99a1Qb7LFD6O3Hw" mode="" @click="showtq = false"></image> + <image src="https://api.ccttiot.com/smartmeter/img/static/uQK4q99a1Qb7LFD6O3Hw" mode="" + @click="showtq = false"></image> </view> <view class="top" style="margin-top: 14rpx;"> <view class="weather_add"> @@ -295,7 +300,8 @@ </view> </view> <view class="echarts_box"> - <uni-ec-canvas class="uni-ec-canvas" id="uni-ec-canvas" ref="canvas7" canvas-id="uni-ec-canvas" :ec="ec"> + <uni-ec-canvas class="uni-ec-canvas" id="uni-ec-canvas" ref="canvas7" canvas-id="uni-ec-canvas" + :ec="ec"> </uni-ec-canvas> </view> </view> @@ -327,7 +333,7 @@ }, data() { return { - menuflag:false, + menuflag: false, ec: { lazyLoad: true }, @@ -352,37 +358,37 @@ }], chartday: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'], chartData: [120, 200, 150, 80, 70, 110, 130], - showtq:true, - beehiveId:'', - obj:{}, - daily:[], - fskx:'关', - jrkg:'关', - chartData1:[], - chartData2:[], - chartData3:[], - chartData4:[], - chartData5:[], - chartData6:[], - chartData7:[], - chartData8:[], + showtq: true, + beehiveId: '', + obj: {}, + daily: [], + fskx: '关', + jrkg: '关', + chartData1: [], + chartData2: [], + chartData3: [], + chartData4: [], + chartData5: [], + chartData6: [], + chartData7: [], + chartData8: [], yeartime: { year: '', month: '', - day:'' + day: '' }, yeartimes: { year: '', month: '', - day:'' + day: '' }, - daytime:'', + daytime: '', covers: [], - dtflag:false - } + dtflag: false + } }, onLoad(option) { - this.beehiveId = option.beehiveId + this.beehiveId = option.beehiveId }, onShow() { setTimeout(() => { @@ -400,8 +406,8 @@ this.yeartime.year = now.getFullYear() this.yeartime.month = String(previousDay.getMonth() + 1).padStart(2, '0') this.yeartime.day = String(now.getDate()).padStart(2, '0') - - + + previousDay.setDate(now.getDate() - 7) this.yeartimes.year = previousDay.getFullYear() this.yeartimes.month = String(previousDay.getMonth() + 1).padStart(2, '0') @@ -414,110 +420,117 @@ this.getchartData6() }, methods: { - btnvideo(){ + // 跳转图标详情 + btnec(num) { uni.navigateTo({ - url:'/page_Beehive/Beehive_log?apiaryId=' + this.obj.apiaryId + ' &name=' + this.obj.apiaryName + url: '/page_Beehive/Beehive_ec?num=' + num + '&beehiveId=' + this.beehiveId }) }, - btngd(){ + btnvideo() { + uni.navigateTo({ + url: '/page_Beehive/Beehive_log?apiaryId=' + this.obj.apiaryId + ' &name=' + this.obj.apiaryName + }) + }, + btngd() { + // this.gettq() this.showtq = true - this.gettq() }, - btnyj(){ + btnyj() { uni.navigateTo({ - url:'/page_Beehive/Beehive_woring?apiaryId=' + this.beehiveId + '&tit=' + '蜂箱预警记录' + url: '/page_Beehive/Beehive_woring?apiaryId=' + this.beehiveId + '&tit=' + '蜂箱预警记录' }) }, - btnedit(){ + btnedit() { this.menuflag = false uni.navigateTo({ - url:'/page_Beehive/add_Beehive?tit=' + '修改蜂箱' + '&beehiveId=' + this.beehiveId + url: '/page_Beehive/add_Beehive?tit=' + '修改蜂箱' + '&beehiveId=' + this.beehiveId }) }, - btnfx(){ + btnfx() { this.menuflag = false uni.navigateTo({ - url:'/page_Beehive/share_Beehive' + url: '/page_Beehive/share_Beehive' }) }, - btnmenu(){ - if(this.menuflag == true){ + btnmenu() { + if (this.menuflag == true) { this.menuflag = false - }else{ + } else { this.menuflag = true } }, // 温度图表 - getchartData1(){ - let time = this.yeartime.year +'-' + this.yeartime.month + '-' + this.yeartime.day + getchartData1() { + let time = this.yeartime.year + '-' + this.yeartime.month + '-' + this.yeartime.day let times = this.yeartimes.year + '-' + this.yeartimes.month + '-' + this.yeartimes.day this.$u.get(`/farmer/report/tempN?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then(res => { - if(res.code == 200){ + if (res.code == 200) { this.chartData1 = res.data.map(item => item.value) } }) }, // 湿度图表 - getchartData2(){ - let time = this.yeartime.year +'-' + this.yeartime.month + '-' + this.yeartime.day + getchartData2() { + let time = this.yeartime.year + '-' + this.yeartime.month + '-' + this.yeartime.day let times = this.yeartimes.year + '-' + this.yeartimes.month + '-' + this.yeartimes.day this.$u.get(`/farmer/report/hpN?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then(res => { - if(res.code == 200){ + if (res.code == 200) { this.chartData2 = res.data.map(item => item.value) } }) }, // 重量图表 - getchartData3(){ - let time = this.yeartime.year +'-' + this.yeartime.month + '-' + this.yeartime.day + getchartData3() { + let time = this.yeartime.year + '-' + this.yeartime.month + '-' + this.yeartime.day let times = this.yeartimes.year + '-' + this.yeartimes.month + '-' + this.yeartimes.day - this.$u.get(`/farmer/report/weightDay?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then(res => { - if(res.code == 200){ + this.$u.get(`/farmer/report/weightDay?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then( + res => { + if (res.code == 200) { this.chartData3 = res.data.map(item => item.value) } }) }, // 进出量图表 - getchartData4(){ - let time = this.yeartime.year +'-' + this.yeartime.month + '-' + this.yeartime.day + getchartData4() { + let time = this.yeartime.year + '-' + this.yeartime.month + '-' + this.yeartime.day let times = this.yeartimes.year + '-' + this.yeartimes.month + '-' + this.yeartimes.day this.$u.get(`/farmer/report/ioCount?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then(res => { - if(res.code == 200){ + if (res.code == 200) { this.chartData4 = res.data.map(item => item.value) } }) }, // 频率图表 - getchartData5(){ - let time = this.yeartime.year +'-' + this.yeartime.month + '-' + this.yeartime.day + getchartData5() { + let time = this.yeartime.year + '-' + this.yeartime.month + '-' + this.yeartime.day let times = this.yeartimes.year + '-' + this.yeartimes.month + '-' + this.yeartimes.day this.$u.get(`/farmer/report/mic?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then(res => { - if(res.code == 200){ + if (res.code == 200) { this.chartData5 = res.data.map(item => item.value) } }) }, // 二氧化碳图表 - getchartData6(){ - let time = this.yeartime.year +'-' + this.yeartime.month + '-' + this.yeartime.day + getchartData6() { + let time = this.yeartime.year + '-' + this.yeartime.month + '-' + this.yeartime.day let times = this.yeartimes.year + '-' + this.yeartimes.month + '-' + this.yeartimes.day this.$u.get(`/farmer/report/co2?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then(res => { - if(res.code == 200){ + if (res.code == 200) { this.chartData6 = res.data.map(item => item.value) } }) }, - - btndow(num){ - if(num == 1){ + + btndow(num) { + if (num == 1) { this.$u.put(`farm/beehive/iot/${this.beehiveId}/clearWeight`).then(res => { - if(res.code == 200){ + if (res.code == 200) { uni.showToast({ title: '去皮成功', icon: 'success', duration: 2000 }) - }else{ + } else { uni.showToast({ title: res.msg, icon: 'none', @@ -525,15 +538,15 @@ }) } }) - }else if(num == 2){ + } else if (num == 2) { this.$u.put(`farm/beehive/iot/${this.beehiveId}/buzzer`).then(res => { - if(res.code == 200){ + if (res.code == 200) { uni.showToast({ title: '响铃成功', icon: 'success', duration: 2000 }) - }else{ + } else { uni.showToast({ title: res.msg, icon: 'none', @@ -541,13 +554,13 @@ }) } }) - }else if(num == 3){ - if(this.fskx == '关'){ + } else if (num == 3) { + if (this.fskx == '关') { this.$u.put(`farm/beehive/iot/${this.beehiveId}/fan?open=true`).then(res => { - if(res.code == 200){ - if(this.fskx == '关'){ + if (res.code == 200) { + if (this.fskx == '关') { this.fskx = '开' - }else{ + } else { this.fskx = '关' } uni.showToast({ @@ -555,7 +568,7 @@ icon: 'success', duration: 2000 }) - }else{ + } else { uni.showToast({ title: res.msg, icon: 'none', @@ -563,12 +576,12 @@ }) } }) - }else{ + } else { this.$u.put(`farm/beehive/iot/${this.beehiveId}/fan?open=false`).then(res => { - if(res.code == 200){ - if(this.fskx == '关'){ + if (res.code == 200) { + if (this.fskx == '关') { this.fskx = '开' - }else{ + } else { this.fskx = '关' } uni.showToast({ @@ -576,7 +589,7 @@ icon: 'success', duration: 2000 }) - }else{ + } else { uni.showToast({ title: res.msg, icon: 'none', @@ -585,13 +598,13 @@ } }) } - }else if(num == 4){ - if(this.jrkg == '关'){ + } else if (num == 4) { + if (this.jrkg == '关') { this.$u.put(`farm/beehive/iot/${this.beehiveId}/heat?open=true`).then(res => { - if(res.code == 200){ - if(this.jrkg == '关'){ + if (res.code == 200) { + if (this.jrkg == '关') { this.jrkg = '开' - }else{ + } else { this.jrkg = '关' } uni.showToast({ @@ -599,7 +612,7 @@ icon: 'success', duration: 2000 }) - }else{ + } else { uni.showToast({ title: res.msg, icon: 'none', @@ -607,12 +620,12 @@ }) } }) - }else{ + } else { this.$u.put(`farm/beehive/iot/${this.beehiveId}/heat?open=false`).then(res => { - if(res.code == 200){ - if(this.jrkg == '关'){ + if (res.code == 200) { + if (this.jrkg == '关') { this.jrkg = '开' - }else{ + } else { this.jrkg = '关' } uni.showToast({ @@ -620,7 +633,7 @@ icon: 'success', duration: 2000 }) - }else{ + } else { uni.showToast({ title: res.msg, icon: 'none', @@ -631,27 +644,27 @@ } } }, - getobj(){ + getobj() { this.$u.get(`/farm/beehive/${this.beehiveId}`).then(res => { - if(res.code == 200){ + if (res.code == 200) { this.obj = res.data this.latitude = res.data.lat this.longitude = res.data.lng - if(res.data.enableFan == false){ + if (res.data.enableFan == false) { this.fskx = '关' - }else{ + } else { this.fskx = '开' } - if(res.data.enableHeat == false){ + if (res.data.enableHeat == false) { this.jrkg = '关' - }else{ + } else { this.jrkg = '开' } - if(res.data.lat == 0 && res.data.lng == 0){ + if (res.data.lat == 0 && res.data.lng == 0) { console.log('未找到位置信息'); this.zoomSize = 5 this.dtflag = true - }else{ + } else { this.dtflag = false this.covers.push({ id: parseFloat(res.data.beehiveId), @@ -662,9 +675,9 @@ iconPath: 'https://api.ccttiot.com/smartmeter/img/static/ukbyhyrDcp3VzgyeJo2G', }) } - + this.gettq() - }else{ + } else { uni.showToast({ title: res.msg, icon: 'none', @@ -673,30 +686,30 @@ } }) }, - gettq(){ + gettq() { this.$u.get(`weather/7d?location=${this.longitude},${this.latitude}`).then(res => { - if(res.code == 200){ + if (res.code == 200) { this.daily = res.data.daily this.chartData7 = res.data.daily.map(item => item.tempMin) this.chartData8 = res.data.daily.map(item => item.tempMax) this.daytime = res.data.updateTime - let date = new Date(this.daytime); + let date = new Date(this.daytime); let formattedDate = this.formatDate(date) this.daytime = formattedDate } }) }, - formatDate(date) { - let year = date.getFullYear() - let month = String(date.getMonth() + 1).padStart(2, '0') - let day = String(date.getDate()).padStart(2, '0') - let hours = String(date.getHours()).padStart(2, '0') - let minutes = String(date.getMinutes()).padStart(2, '0') - return `${year}-${month}-${day} ${hours}:${minutes}` + formatDate(date) { + let year = date.getFullYear() + let month = String(date.getMonth() + 1).padStart(2, '0') + let day = String(date.getDate()).padStart(2, '0') + let hours = String(date.getHours()).padStart(2, '0') + let minutes = String(date.getMinutes()).padStart(2, '0') + return `${year}-${month}-${day} ${hours}:${minutes}` }, - - - + + + // 温度 initChart(canvas, width, height, canvasDpr) { let that = this @@ -808,7 +821,7 @@ // 湿度 initChart2(canvas, width, height, canvasDpr) { let that = this - + const option = { grid: { left: '4%', @@ -908,8 +921,8 @@ height: height, devicePixelRatio: canvasDpr }) - - option.series[0].data = that.chartData2 + + option.series[0].data = that.chartData2 canvas.setChart(chart) chart.setOption(option) return chart @@ -917,7 +930,7 @@ //重量 initChart3(canvas, width, height, canvasDpr) { let that = this - + const option = { grid: { left: '4%', @@ -1017,8 +1030,8 @@ height: height, devicePixelRatio: canvasDpr }) - - option.series[0].data = that.chartData3 + + option.series[0].data = that.chartData3 canvas.setChart(chart) chart.setOption(option) return chart @@ -1026,7 +1039,7 @@ // 进出量 initChart4(canvas, width, height, canvasDpr) { let that = this - + const option = { grid: { left: '4%', @@ -1126,8 +1139,8 @@ height: height, devicePixelRatio: canvasDpr }) - - option.series[0].data = that.chartData4 + + option.series[0].data = that.chartData4 canvas.setChart(chart) chart.setOption(option) return chart @@ -1135,7 +1148,7 @@ // 频率 initChart5(canvas, width, height, canvasDpr) { let that = this - + const option = { grid: { left: '4%', @@ -1235,8 +1248,8 @@ height: height, devicePixelRatio: canvasDpr }) - - option.series[0].data = that.chartData5 + + option.series[0].data = that.chartData5 canvas.setChart(chart) chart.setOption(option) return chart @@ -1244,7 +1257,7 @@ // 二氧化碳 initChart6(canvas, width, height, canvasDpr) { let that = this - + const option = { grid: { left: '4%', @@ -1344,156 +1357,156 @@ height: height, devicePixelRatio: canvasDpr }) - - option.series[0].data = that.chartData6 + + option.series[0].data = that.chartData6 canvas.setChart(chart) chart.setOption(option) return chart }, initChart7(canvas, width, height, canvasDpr) { - let that = this - - const option = { - grid: { - left: '4%', - right: '4%', - bottom: '3%', - top:'0%', - containLabel: true + let that = this + + const option = { + grid: { + left: '4%', + right: '4%', + bottom: '3%', + top: '0%', + containLabel: true + }, + tooltip: { + trigger: 'axis' + }, + xAxis: { + type: 'category', + boundaryGap: false, + data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + axisLine: { + show: false // 隐藏X轴线 }, - tooltip: { - trigger: 'axis' + axisTick: { + show: false // 隐藏X轴刻度 }, - xAxis: { - type: 'category', - boundaryGap: false, - data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], - axisLine: { - show: false // 隐藏X轴线 - }, - axisTick: { - show: false // 隐藏X轴刻度 - }, - axisLabel: { - show: false // 隐藏X轴标签 - }, - splitLine: { - show: true, // 显示X轴网格线 - lineStyle: { - type: 'dashed', // 设置网格线为虚线 - color: '#ccc', // 可以设置虚线的颜色 - width: 1 // 可以设置虚线的宽度 - } - } + axisLabel: { + show: false // 隐藏X轴标签 }, - yAxis: { - type: 'value', - max: 40, // 设置Y轴的最大值为40 - axisLabel: { - show: false // 隐藏Y轴标签 - }, - axisLine: { - show: false // 隐藏Y轴线 - }, - axisTick: { - show: false // 隐藏Y轴刻度 - }, - splitLine: { - show: false // 隐藏Y轴背景网格线 + splitLine: { + show: true, // 显示X轴网格线 + lineStyle: { + type: 'dashed', // 设置网格线为虚线 + color: '#ccc', // 可以设置虚线的颜色 + width: 1 // 可以设置虚线的宽度 } + } + }, + yAxis: { + type: 'value', + max: 40, // 设置Y轴的最大值为40 + axisLabel: { + show: false // 隐藏Y轴标签 }, - dataZoom: [ - { - show: true, - type: 'inside', - filterMode: 'none', - xAxisIndex: [0], - startValue: -20, - endValue: 20 - }, - { - show: true, - type: 'inside', - filterMode: 'none', - yAxisIndex: [0], - startValue: -20, - endValue: 20 - } - ], - series: [{ - name: '最高温度', - type: 'line', - data: this.chartData8, - smooth: true, - symbol: 'circle', - symbolSize: 8, - lineStyle: { - width: 3 - }, - itemStyle: { - color: '#42A5F5' - }, - label: { - show: true, - position: 'top', - formatter: '{c}°', - color: '#42A5F5' - }, - markLine: { - silent: true, // 不响应鼠标事件 - symbol: ['none', 'none'], // 不显示标记 - lineStyle: { - color: 'red', // 使虚线更明显 - type: 'dashed' - }, - // data: [ - // { yAxis: 'min' }, - // { yAxis: 'max' } - // ] - }, + axisLine: { + show: false // 隐藏Y轴线 + }, + axisTick: { + show: false // 隐藏Y轴刻度 + }, + splitLine: { + show: false // 隐藏Y轴背景网格线 + } + }, + dataZoom: [{ + show: true, + type: 'inside', + filterMode: 'none', + xAxisIndex: [0], + startValue: -20, + endValue: 20 }, { - name: '最低温蒂', - type: 'line', - data: this.chartData7, - smooth: true, - symbol: 'circle', - symbolSize: 8, - lineStyle: { - width: 3 - }, - itemStyle: { - color: '#42A5F5' - }, - label: { - show: true, - position: 'bottom', - formatter: '{c}°', - color: '#42A5F5' - }, - }] - }; - - chart = echarts.init(canvas, null, { - width: width, - height: height, - devicePixelRatio: canvasDpr - }) - - // option.series[0].data = that.chartData7 - canvas.setChart(chart) - chart.setOption(option) - return chart - }, - - + show: true, + type: 'inside', + filterMode: 'none', + yAxisIndex: [0], + startValue: -20, + endValue: 20 + } + ], + series: [{ + name: '最高温度', + type: 'line', + data: this.chartData8, + smooth: true, + symbol: 'circle', + symbolSize: 8, + lineStyle: { + width: 3 + }, + itemStyle: { + color: '#42A5F5' + }, + label: { + show: true, + position: 'top', + formatter: '{c}°', + color: '#42A5F5' + }, + markLine: { + silent: true, // 不响应鼠标事件 + symbol: ['none', 'none'], // 不显示标记 + lineStyle: { + color: 'red', // 使虚线更明显 + type: 'dashed' + }, + // data: [ + // { yAxis: 'min' }, + // { yAxis: 'max' } + // ] + }, + }, + { + name: '最低温蒂', + type: 'line', + data: this.chartData7, + smooth: true, + symbol: 'circle', + symbolSize: 8, + lineStyle: { + width: 3 + }, + itemStyle: { + color: '#42A5F5' + }, + label: { + show: true, + position: 'bottom', + formatter: '{c}°', + color: '#42A5F5' + }, + } + ] + }; + + chart = echarts.init(canvas, null, { + width: width, + height: height, + devicePixelRatio: canvasDpr + }) + + // option.series[0].data = that.chartData7 + canvas.setChart(chart) + chart.setOption(option) + return chart + }, + + } } </script> <style lang="scss"> - .mask{ + .mask { width: 100%; height: 100vh; position: fixed; @@ -1502,16 +1515,18 @@ background-color: #3D3D3D; opacity: .6; } + page { background-color: #FAFDFD; } .page { // position: relative; - + padding: 38rpx; padding-bottom: 200rpx; width: 750rpx; + .weather_info { position: fixed; padding: 30rpx 50rpx; @@ -1521,18 +1536,18 @@ height: 820rpx; background: #FFFFFF; z-index: 999 !important; - + border-radius: 20rpx 20rpx 0rpx 0rpx; - + .echarts_box { - + margin-top: 24rpx; // width: 100%; // height: 80%; width: 646rpx; height: 344rpx; } - + .weather_cont { margin-top: 42rpx; width: 100%; @@ -1540,7 +1555,7 @@ flex-wrap: nowrap; align-items: center; justify-content: space-between; - + .weather_li { .data { text-align: center; @@ -1549,7 +1564,7 @@ font-size: 24rpx; color: #50565A; } - + .week { margin-top: 4rpx; text-align: center; @@ -1558,7 +1573,7 @@ font-size: 36rpx; color: #50565A; } - + .week_weather { margin-top: 14rpx; text-align: center; @@ -1567,47 +1582,47 @@ font-size: 28rpx; color: #50565A; } - + .week_weather_img { margin-top: 4rpx; display: flex; align-items: center; justify-content: center; width: 72rpx; - + image { width: 48rpx; height: 48rpx; } } } - + } - + .top { display: flex; flex-wrap: nowrap; - + justify-content: space-between; align-items: center; - + .weather_info_tit { font-weight: 600; font-size: 36rpx; color: #3D3D3D; } - + image { width: 42rpx; height: 42rpx; } - + .weather_add { font-weight: 600; font-size: 32rpx; color: #50565A; } - + .up_time { font-weight: 400; font-size: 32rpx; @@ -1615,8 +1630,8 @@ } } } - - + + .echarts_box { margin-top: 26rpx; padding: 18rpx 24rpx; @@ -1884,25 +1899,29 @@ .sets { position: relative; - .menu{ + + .menu { padding: 20rpx; position: absolute; right: 20rpx; width: 218rpx; height: 234rpx; background: #FFFFFF; - box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.15); + box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15); border-radius: 20rpx 20rpx 20rpx 20rpx; z-index: 10; - .menu_li:first-child{ + + .menu_li:first-child { margin-top: 10rpx; } - .menu_li{ - image{ + + .menu_li { + image { margin-right: 14rpx; width: 38rpx; height: 38rpx; } + font-weight: 400; font-size: 32rpx; color: #3D3D3D; @@ -1912,6 +1931,7 @@ align-items: center; } } + image { width: 36rpx; height: 36rpx; @@ -1927,7 +1947,8 @@ height: 372rpx; border-radius: 20rpx; overflow: hidden; - .fxmask{ + + .fxmask { position: absolute; top: 0; left: 0; @@ -1943,6 +1964,7 @@ box-sizing: border-box; font-weight: 600; } + .num { width: 180rpx; position: absolute; diff --git a/page_Beehive/Beehive_log.vue b/page_Beehive/Beehive_log.vue index 4363478..f58c3c5 100644 --- a/page_Beehive/Beehive_log.vue +++ b/page_Beehive/Beehive_log.vue @@ -140,7 +140,7 @@ type: 3 }, { - title: '加牌', + title: '加脾', type: 4 }, { @@ -391,13 +391,25 @@ width: 750rpx; .no_cont { - margin: 152rpx auto 0; - width: 432rpx; - + // margin: 152rpx auto 0; + // width: 432rpx; + padding: 16rpx; + margin-left: -10rpx; + width: 100%; + height: 82vh; + background: #fff; + padding-left: 50rpx; + padding-top: 200rpx; + // overflow: scroll; + padding-bottom: 200rpx; + box-sizing: border-box; + .img { + padding-left: 50rpx; + box-sizing: border-box; image { - width: 432rpx; - height: 432rpx; + width: 350rpx; + height: 350rpx; } } diff --git a/page_Beehive/Beehive_woring.vue b/page_Beehive/Beehive_woring.vue index b9d7da5..3b315e0 100644 --- a/page_Beehive/Beehive_woring.vue +++ b/page_Beehive/Beehive_woring.vue @@ -20,8 +20,7 @@ <view class="left_cont" :class="[ index=== currentIndex? 'act1' : '', index + 1 === currentIndex? 'act2' : '', - index- 1 === currentIndex? 'act3' : '' - ]"> + index- 1 === currentIndex? 'act3' : '']"> {{item.title}} </view> </view> @@ -177,7 +176,7 @@ this.pageNum = 1 this.rzlist = [] if (this.title == '蜂箱预警记录') { - this.yjtxt = '该蜂场其他蜂箱' + this.yjtxt = '其他蜂箱' this.getfx() this.getyuj() } else { @@ -401,13 +400,23 @@ width: 750rpx; .no_cont { - margin: 152rpx auto 0; - width: 432rpx; + padding: 16rpx; + margin-left: -10rpx; + width: 100%; + height: 82vh; + background: #fff; + padding-left: 50rpx; + padding-top: 200rpx; + // overflow: scroll; + padding-bottom: 200rpx; + box-sizing: border-box; .img { + padding-left: 50rpx; + box-sizing: border-box; image { - width: 432rpx; - height: 432rpx; + width: 350rpx; + height: 350rpx; } } diff --git a/pages.json b/pages.json index a6d98bb..cd18b23 100644 --- a/pages.json +++ b/pages.json @@ -30,6 +30,7 @@ "navigationStyle": "custom" } }, + // 蜂场 { "path": "pages/Apiary", @@ -202,6 +203,14 @@ "enablePullDownRefresh": false, "navigationStyle": "custom" } + }, { + "path" : "Beehive_ec", + "style" : + { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } }, { "path" : "share_Beehive", diff --git a/pages/Apiary.vue b/pages/Apiary.vue index f087cde..74b73ca 100644 --- a/pages/Apiary.vue +++ b/pages/Apiary.vue @@ -27,7 +27,7 @@ <view class="Apiary_card" v-for="(item,index) in list" :key="index" @click="btnapiaryxq(item.apiaryId)"> <image :src="item.picture" mode=""></image> <view class="weather"> - <image src="https://api.ccttiot.com/smartmeter/img/static/u6wWpgZOuId6JSX8LGmz" mode=""></image> + <image src="https://api.ccttiot.com/smartmeter/img/static/u6wWpgZOuId6JSX8LGmz" mode="scaleToFill"></image> <view class="txt1"> 多云 </view> @@ -66,11 +66,11 @@ total: '', pagesize: 10, logoflag: false, - code: '' + code: '', } }, onLoad() { - + }, onShow() { this.pagesum = 1 @@ -170,7 +170,7 @@ background: #FFFFFF; box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15); border-radius: 20rpx 20rpx 20rpx 20rpx; - + background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8), transparent); image { width: 674rpx; height: 360rpx; @@ -221,7 +221,6 @@ width: 674rpx; height: 70rpx; - background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8), transparent); image { width: 44rpx; @@ -250,7 +249,7 @@ display: flex; flex-wrap: nowrap; width: 664rpx; - + align-items: center; .search { display: flex; diff --git a/pages/Apiary/AddApiary.vue b/pages/Apiary/AddApiary.vue index 0a59e55..e1eb879 100644 --- a/pages/Apiary/AddApiary.vue +++ b/pages/Apiary/AddApiary.vue @@ -43,7 +43,7 @@ <view class=""> </view> - <image src="https://api.ccttiot.com/smartmeter/img/static/uLpiGDDDvBwk7hOhOtVp" mode="" v-if=""></image> + <image src="https://api.ccttiot.com/smartmeter/img/static/uLpiGDDDvBwk7hOhOtVp" mode="scaleToFill" v-if=""></image> </view> <view class="imgbox" v-else> diff --git a/pages/Apiary/Apiary_detail.vue b/pages/Apiary/Apiary_detail.vue index 739fd21..0e5eb8e 100644 --- a/pages/Apiary/Apiary_detail.vue +++ b/pages/Apiary/Apiary_detail.vue @@ -302,7 +302,7 @@ }, btnpage() { uni.switchTab({ - url: '/pages/Beehive' + url: '/pages/Beehive?apiaryId=' + this.apiaryId }) }, gettq() { diff --git a/pages/Apiary/addrizhi.vue b/pages/Apiary/addrizhi.vue index 9272b32..fe8a1e4 100644 --- a/pages/Apiary/addrizhi.vue +++ b/pages/Apiary/addrizhi.vue @@ -88,7 +88,7 @@ type: 3 }, { - title: '加牌', + title: '加脾', type: 4 }, { @@ -118,7 +118,7 @@ token: '', checked: false, id: '', - arrimg:[] + arrimg: [] } }, onLoad(option) { @@ -131,7 +131,7 @@ this.getfc() }, onShow() { - + this.imglist = [] }, methods: { // 编辑 @@ -144,71 +144,34 @@ this.apiaryName = res.data.beehiveName this.textValue = res.data.content this.checked = res.data.apiaryLog - if(res.data.picture.length > 0){ + if (res.data.picture.length > 0) { this.imglist = res.data.picture.split(',') - }else{ + } else { this.imglist = [] } } }) }, - imgdel(indexToRemove){ - this.imglist = this.imglist.filter((item, index) => index !== indexToRemove) + imgdel(indexToRemove) { + this.imglist = this.imglist.filter((item, index) => index !== indexToRemove) }, - btnedit(){ + btnedit() { if (this.imglist) { let validUrls = this.imglist.filter(item => typeof item === 'string') this.arrimg = validUrls.join(',') } let data = { - id:this.id, + id: this.id, beehiveId: this.apiaryId, type: this.type, content: this.textValue, picture: this.arrimg, apiaryLog: this.checked } - this.$u.put(`/farm/beehive/log`,data).then(res => { - if(res.code == 200){ - uni.showToast({ - title: '编辑成功', - icon: 'success', - duration: 1000 - }) - setTimeout(() => { - uni.navigateBack() - }, 1500) - }else{ - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }) - } - }) - }, - - - - checkboxChange(e) { - this.checked = e - }, - btnadd() { - if (this.imglist) { - let validUrls = this.imglist.filter(item => typeof item === 'string') - this.imglist = validUrls.join(',') - } - let data = { - beehiveId: this.apiaryId, - type: this.type, - content: this.textValue, - picture: this.imglist, - apiaryLog: this.checked - } - this.$u.post(`/farm/beehive/log`, data).then(res => { + this.$u.put(`/farm/beehive/log`, data).then(res => { if (res.code == 200) { uni.showToast({ - title: '创建成功', + title: '编辑成功', icon: 'success', duration: 1000 }) @@ -225,6 +188,54 @@ }) }, + + + checkboxChange(e) { + this.checked = e + }, + btnadd() { + if (this.apiaryId == '') { + uni.showToast({ + title: '请选择蜂箱', + icon: 'none', + duration: 1000 + }) + } else { + if (this.imglist.length > 80) { + let validUrls = this.imglist.filter(item => typeof item == 'string') + this.imglist = validUrls.join(',') + console.log(this.imglist.length); + }else{ + this.imglist = this.imglist[0] + } + let data = { + beehiveId: this.apiaryId, + type: this.type, + content: this.textValue, + picture: this.imglist, + apiaryLog: this.checked + } + this.$u.post(`/farm/beehive/log`, data).then(res => { + if (res.code == 200) { + uni.showToast({ + title: '创建成功', + icon: 'success', + duration: 1000 + }) + setTimeout(() => { + uni.navigateBack() + }, 1500) + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + } + }, + confirmmy(e) { this.apiaryId = e[0].value this.apiaryName = e[0].label @@ -463,8 +474,9 @@ width: 33%; padding-right: 10rpx; box-sizing: border-box; - position: relative; - .xx{ + position: relative; + + .xx { width: 40rpx; height: 40rpx; border-radius: 50%; @@ -477,6 +489,7 @@ top: -8rpx; right: 0; } + image { height: 212rpx; border-radius: 20rpx; diff --git a/pages/Beehive.vue b/pages/Beehive.vue index 6d7976a..9090f05 100644 --- a/pages/Beehive.vue +++ b/pages/Beehive.vue @@ -17,8 +17,9 @@ </view> </view> <view class="tabbar"> - <view class="cont" :id="indextab == index ? 'active' : ''" v-for="(item,index) in miyuancolumns" :key="index" @click="btntab(index,item)"> - {{item.label}} + <view class="cont" v-for="(item,index) in miyuancolumns" :key="index" @click="btntab(index,item)"> + {{item.label}} <text v-if="item.count != '-1'">({{item.count}})</text> + <view class="gl" :id="indextab == index ? 'active' : ''"></view> </view> </view> </view> @@ -191,7 +192,7 @@ code: '', swiperHeight:554, curtitidx:0, - miyuancolumns: [{label:'全部'}], + miyuancolumns: [{label:'全部',count:'a'}], pagesum: 1, pagesize: 99, pagesizes: 5, @@ -203,9 +204,10 @@ } }, onLoad() { - // this.apiaryId = this.miyuancolumns[0].value + }, onShow() { + this.indextab = 0 this.pagesum = 1 // this.fxlist = [] this.getmiyuancolumns() @@ -251,23 +253,21 @@ this.logoflag = true }else{ this.logoflag = false - // let uniqueIds = new Set(this.fxlist.map(item => item.sn)) - // let uniqueRows = res.rows.filter(row => !uniqueIds.has(row.sn)) - // uniqueRows.forEach(row => uniqueIds.add(row.sn)) - // this.fxlist = this.fxlist.concat(uniqueRows) let oldSnSet = new Set(this.fxlist.map(item => item.sn)); let result = []; + res.rows.forEach(row => { if (oldSnSet.has(row.sn)) { - result.push(row) - oldSnSet.delete(row.sn); + result.push(row) + oldSnSet.delete(row.sn) } else { - result.push(row); + result.push(row) } - }) - this.fxlist = this.fxlist.filter(item => oldSnSet.has(item.sn)); - this.fxlist = result; - this.pagesum++ + }); + result.sort((a, b) => b.onlineStatus - a.onlineStatus) // 1 在前,0 在后 + this.fxlist = result.filter(row => oldSnSet.has(row.sn)) + this.fxlist = result; + this.pagesum++; } }else{ // uni.showToast({ @@ -298,9 +298,10 @@ if (res.code === 200) { this.miyuancolumns = res.rows.map(item => ({ value: item.apiaryId, - label: item.name + label: item.name, + count:item.beehiveCount })) - this.miyuancolumns.unshift({ label: '全部',value:''}) + this.miyuancolumns.unshift({ label: '全部',value:'',count:'-1'}) this.apiaryId = this.miyuancolumns[0].value this.logoflag = false this.getlist() @@ -334,6 +335,7 @@ border-bottom: 3px solid #FFC107; font-weight: 600; font-size: 40rpx; + display: block !important; } #status{ background-color: #808080; @@ -477,6 +479,18 @@ font-weight: 400; font-size: 36rpx; color: #3D3D3D; + position: relative; + .gl{ + width: 46rpx; + height: 46rpx; + background: #FFC107; + border-radius: 50%; + position: absolute; + top: 2rpx; + right: -10rpx; + opacity: .7; + display: none; + } } } @@ -487,7 +501,7 @@ display: flex; flex-wrap: nowrap; width: 664rpx; - + align-items: center; .search { display: flex; diff --git a/pages/index/index.vue b/pages/index/index.vue index 344516d..643e1ef 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -52,7 +52,7 @@ </view> <view class="txt"> - <view class="iconfont icon-xiangyou1"></view> + <!-- <view class="iconfont icon-xiangyou1"></view> --> </view> </view> @@ -89,7 +89,7 @@ </view> <view class="txt"> - <view class="iconfont icon-xiangyou1"></view> + <!-- <view class="iconfont icon-xiangyou1"></view> --> </view> </view> diff --git a/pages/map.vue b/pages/map.vue index 0d7628f..52a4676 100644 --- a/pages/map.vue +++ b/pages/map.vue @@ -25,7 +25,7 @@ <view class="fclt"> <image src="https://api.ccttiot.com/smartmeter/img/static/ukbyhyrDcp3VzgyeJo2G" mode=""></image> <view class="fctit">{{fxobj.name == undefined ? '--' : fxobj.name}}</view> - <view class="fcry">已认养</view> + <!-- <view class="fcry">已认养</view> --> </view> <view class="fcrt" @click="fxslag = false"> x @@ -80,7 +80,7 @@ <view class="fclt"> <image src="https://api.ccttiot.com/smartmeter/img/static/uB2k1NNeN2QUuSZIAf5r" mode=""></image> <view class="fctit">{{fcobj.name == undefined ? '--' : fcobj.name}}</view> - <view class="fcry">已认养</view> + <!-- <view class="fcry">已认养</view> --> </view> <view class="fcrt" @click="fcflag = false"> x @@ -112,7 +112,7 @@ <view class="">当前湿度:{{nowtqobj.humidity == undefined ? '--' : nowtqobj.humidity}}%</view> </view> <view class="fcli"> - <view class="">在线数:{{fcobj.beehiveCount == undefined ? '--' : fcobj.beehiveCount}}箱</view> + <view class="">总蜂箱数:{{fcobj.beehiveCount == undefined ? '--' : fcobj.beehiveCount}}箱</view> </view> </view> <view class="btncha" @click="btnpage(2)"> @@ -162,9 +162,7 @@ }, onShow() { this.getMyLocation() - this.getMyLocations() - - + this.getMyLocations() }, onReady() { this.mapContext = uni.createMapContext('map', this)