This commit is contained in:
3321822538@qq.com 2024-07-01 18:03:05 +08:00
parent 44e9dae6e8
commit e40f4ad0f4
7 changed files with 679 additions and 153 deletions

View File

@ -20,7 +20,7 @@ const install = (Vue, vm) => {
// },
// });
Vue.prototype.$u.http.setConfig({
baseUrl: 'http://192.168.2.10:3202',
baseUrl: 'http://192.168.2.17:3202',
// baseUrl: '192.168.2.10:3202/app',
loadingText: '努力加载中~',
loadingTime: 800,

View File

@ -20,8 +20,8 @@
</view>
</view>
<view class="tit">
福鼎蜂场-001
<view class="sets">
{{obj.name}}-{{obj.sn}}
<view class="sets" v-if="false">
<image src="https://api.ccttiot.com/smartmeter/img/static/ulHBKvkXDfe9OIveIJKZ" mode=""></image>
<view class="menu">
<view class="menu_li">
@ -41,15 +41,15 @@
</view>
<view class="address">
<image src="https://api.ccttiot.com/smartmeter/img/static/uMOucOG04nN4PrLJfqj6" mode=""></image>
福建省宁德市福鼎市太姥山镇秦屿大道2号
{{obj.apiaryAddress}}
</view>
<view class="weather">
<view class="weather_left">
<view class="txt">
多云 15 ~ 25
多云 {{daily[0].tempMin}} ~ {{daily[0].tempMax}}
</view>
<view class="txt" style="margin-left: 40rpx;">
西南风2
{{daily[0].windDirDay}} {{daily[0].windSpeedDay}}
</view>
</view>
<view class="weather_right">
@ -60,15 +60,15 @@
<view class="weather_left">
<view class="txt">
<image src="https://api.ccttiot.com/smartmeter/img/static/uZqKuAjf2idHAtkknKEU" mode=""></image>
44%
{{obj.outerHumidity}}%
</view>
<view class="txt" style="margin-left: 26rpx;">
<image src="https://api.ccttiot.com/smartmeter/img/static/uJmWnkVE9UeIhNYdPexV" mode=""></image>
23
{{obj.outerTemperature}}
</view>
</view>
<view class="weather_right" style="font-weight: 400;font-size: 24rpx;color: #808080;">
更新于 2024-05-15 15:22:36
更新于 {{obj.lastOnlineTime}}
</view>
</view>
<view class="setbox">
@ -108,14 +108,14 @@
</view>
<view class="card_top">
<view class="name">
福鼎蜂场-001
{{obj.name}}-{{obj.sn}}
</view>
<view class="time">
05-20 16:31:13
{{obj.lastOnlineTime}}
</view>
<view class="ele">
<image src="https://api.ccttiot.com/smartmeter/img/static/uWDVO6wzl5tRe8X3rmhT" mode=""></image>
90%
{{obj.surplusPower}}%
</view>
</view>
<view class="echarts_box">
@ -125,7 +125,7 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/utoKXhZBoejfRZwNUMP9" mode=""></image>
</view>
<view class="top_cont">
当前 40
当前 {{obj.innerTemperature}}
</view>
<view class="top_right">
<view style="width: 1rpx;">
@ -150,7 +150,7 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/una6Kbd2gdBZ9gG6lg44" mode=""></image>
</view>
<view class="top_cont">
当前 38%
当前 {{obj.innerHumidity}}%
</view>
<view class="top_right">
<view style="width: 1rpx;">
@ -175,7 +175,7 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/uk7CvwzeU0ukxvS9cBtD" mode=""></image>
</view>
<view class="top_cont">
当前 55Kg
当前 {{obj.totalWeight == 999999 ? '--' : obj.totalWeight}}Kg
</view>
<view class="top_right">
<view style="width: 1rpx;">
@ -200,7 +200,7 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/uhsU6Y1K35jxA4aRauzy" mode=""></image>
</view>
<view class="top_cont">
当前 552
当前 {{obj.ioCount}}
</view>
<view class="top_right">
<view style="width: 1rpx;">
@ -225,7 +225,7 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/up9IaGzSg1RKhIZz3V7a" mode=""></image>
</view>
<view class="top_cont">
当前 55Hz
当前 {{obj.volume}}
</view>
<view class="top_right">
<view style="width: 1rpx;">
@ -250,7 +250,7 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/um4lfl5q2O7FNM1EQc2L" mode=""></image>
</view>
<view class="top_cont">
当前 3%
当前 {{obj.innerCo2}}ppm
</view>
<view class="top_right">
<view style="width: 1rpx;">
@ -277,22 +277,22 @@
</view>
<view class="top" style="margin-top: 14rpx;">
<view class="weather_add">
蜂场位置<span style="color: #42A5F5;">福鼎市</span>
蜂场位置<span style="color: #42A5F5;">{{obj.apiaryCounty}}</span>
</view>
<view class="up_time">
1小时前更新
</view>
</view>
<view class="weather_cont">
<view class="weather_li" v-for="imte in 7 " :key="item">
<view class="weather_li" v-for="(item,index) in daily" :key="index">
<view class="data">
5/16
{{item.fxDate.slice(5)}}
</view>
<view class="week">
今天
{{item.textDay}}
</view>
<view class="week_weather">
多云
{{item.windDirDay}}
</view>
<view class="week_weather_img">
<image src="https://api.ccttiot.com/smartmeter/img/static/u6wWpgZOuId6JSX8LGmz" mode=""></image>
@ -305,17 +305,17 @@
</view>
</view>
<view class="bottom_box">
<view class="type_li">
<view class="type_li" @click="btndow(1)">
去皮
</view>
<view class="type_li">
<view class="type_li" @click="btndow(2)">
蜂鸣寻箱
</view>
<view class="type_li">
风扇
<view class="type_li" @click="btndow(3)">
风扇{{fskx}}
</view>
<view class="type_li">
加热
<view class="type_li" @click="btndow(4)">
加热{{jrkg}}
</view>
</view>
</view>
@ -355,15 +355,36 @@
}],
chartday: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
chartData: [120, 200, 150, 80, 70, 110, 130],
showtq:true
showtq:true,
beehiveId:'',
obj:{},
daily:[],
fskx:'关',
jrkg:'关',
chartData1:[],
chartData2:[],
chartData3:[],
chartData4:[],
chartData5:[],
chartData6:[],
yeartime: {
year: '',
month: '',
day:''
},
yeartimes: {
year: '',
month: '',
day:''
},
}
},
onLoad() {
onLoad(option) {
this.beehiveId = option.beehiveId
this.getobj()
},
onShow() {
setTimeout(() => {
this.$refs.canvas1.init(this.initChart)
this.$refs.canvas2.init(this.initChart2)
this.$refs.canvas3.init(this.initChart3)
@ -371,9 +392,254 @@
this.$refs.canvas5.init(this.initChart5)
this.$refs.canvas6.init(this.initChart6)
this.$refs.canvas7.init(this.initChart7)
}, 200);
}, 1000)
const now = new Date();
const previousDay = new Date(now)
this.yeartime.year = now.getFullYear()
this.yeartime.month = String(previousDay.getMonth() + 1).padStart(2, '0')
this.yeartime.day = String(now.getDate()).padStart(2, '0')
// const now = new Date();
// Date
previousDay.setDate(now.getDate() - 7)
this.yeartimes.year = previousDay.getFullYear()
this.yeartimes.month = String(previousDay.getMonth() + 1).padStart(2, '0')
this.yeartimes.day = String(previousDay.getDate()).padStart(2, '0')
this.getchartData1()
this.getchartData2()
this.getchartData3()
this.getchartData4()
this.getchartData5()
this.getchartData6()
},
methods: {
//
getchartData1(){
let time = this.yeartime.year +'-' + this.yeartime.month + '-' + this.yeartime.day
let times = this.yeartimes.year + '-' + this.yeartimes.month + '-' + this.yeartimes.day
console.log(this.yeartime,this.yeartimes);
this.$u.get(`/farmer/report/tempN?dateRange=${times},${time}&beehiveId=${this.beehiveId}`).then(res => {
if(res.code == 200){
this.chartData1 = res.data.map(item => item.value)
}
})
},
// 湿
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){
this.chartData2 = res.data.map(item => item.value)
}
})
},
//
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.chartData3 = res.data.map(item => item.value)
}
})
},
//
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){
this.chartData4 = res.data.map(item => item.value)
}
})
},
//
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){
this.chartData5 = res.data.map(item => item.value)
}
})
},
//
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){
this.chartData6 = res.data.map(item => item.value)
}
})
},
btndow(num){
if(num == 1){
this.$u.put(`farm/beehive/iot/${this.beehiveId}/clearWeight`).then(res => {
if(res.code == 200){
uni.showToast({
title: '去皮成功',
icon: 'success',
duration: 2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}else if(num == 2){
this.$u.put(`farm/beehive/iot/${this.beehiveId}/buzzer`).then(res => {
if(res.code == 200){
uni.showToast({
title: '响铃成功',
icon: 'success',
duration: 2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}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 == '关'){
this.fskx = '开'
}else{
this.fskx = '关'
}
uni.showToast({
title: '风扇开启成功',
icon: 'success',
duration: 2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}else{
this.$u.put(`farm/beehive/iot/${this.beehiveId}/fan?open=false`).then(res => {
if(res.code == 200){
if(this.fskx == '关'){
this.fskx = '开'
}else{
this.fskx = '关'
}
uni.showToast({
title: '风扇关闭成功',
icon: 'success',
duration: 2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}
}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 == '关'){
this.jrkg = '开'
}else{
this.jrkg = '关'
}
uni.showToast({
title: '加热开启成功',
icon: 'success',
duration: 2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}else{
this.$u.put(`farm/beehive/iot/${this.beehiveId}/heat?open=false`).then(res => {
if(res.code == 200){
if(this.jrkg == '关'){
this.jrkg = '开'
}else{
this.jrkg = '关'
}
uni.showToast({
title: '加热关闭成功',
icon: 'success',
duration: 2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}
}
},
getobj(){
this.$u.get(`/farm/beehive/${this.beehiveId}`).then(res => {
if(res.code == 200){
this.obj = res.data
this.latitude = res.data.apiaryLat
this.longitude = res.data.apiaryLng
if(res.data.enableFan == false){
this.fskx = '关'
}else{
this.fskx = '开'
}
if(res.data.enableHeat == false){
this.jrkg = '关'
}else{
this.jrkg = '开'
}
this.gettq()
if(this.latitude == 0 && this.longitude == 0){
this.zoomSize = 2
}
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
},
gettq(){
this.$u.get(`weather/7d?location=${this.longitude},${this.latitude}`).then(res => {
if(res.code == 200){
this.daily = res.data.daily
}
})
},
//
initChart(canvas, width, height, canvasDpr) {
let that = this
@ -469,7 +735,7 @@
}, ]),
},
},
data: that.chartData,
data: that.chartData1,
}],
};
chart = echarts.init(canvas, null, {
@ -477,8 +743,7 @@
height: height,
devicePixelRatio: canvasDpr
})
option.series[0].data = that.chartData1
canvas.setChart(chart)
chart.setOption(option)
return chart
@ -578,7 +843,7 @@
}, ]),
},
},
data: that.chartData,
data: that.chartData2,
}],
};
chart = echarts.init(canvas, null, {
@ -587,7 +852,7 @@
devicePixelRatio: canvasDpr
})
option.series[0].data = that.chartData2
canvas.setChart(chart)
chart.setOption(option)
return chart
@ -687,7 +952,7 @@
}, ]),
},
},
data: that.chartData,
data: that.chartData3,
}],
};
chart = echarts.init(canvas, null, {
@ -696,7 +961,7 @@
devicePixelRatio: canvasDpr
})
option.series[0].data = that.chartData3
canvas.setChart(chart)
chart.setOption(option)
return chart
@ -796,7 +1061,7 @@
}, ]),
},
},
data: that.chartData,
data: that.chartData4,
}],
};
chart = echarts.init(canvas, null, {
@ -805,7 +1070,7 @@
devicePixelRatio: canvasDpr
})
option.series[0].data = that.chartData4
canvas.setChart(chart)
chart.setOption(option)
return chart
@ -905,7 +1170,7 @@
}, ]),
},
},
data: that.chartData,
data: that.chartData5,
}],
};
chart = echarts.init(canvas, null, {
@ -914,7 +1179,7 @@
devicePixelRatio: canvasDpr
})
option.series[0].data = that.chartData5
canvas.setChart(chart)
chart.setOption(option)
return chart
@ -1014,7 +1279,7 @@
}, ]),
},
},
data: that.chartData,
data: that.chartData6,
}],
};
chart = echarts.init(canvas, null, {
@ -1023,7 +1288,7 @@
devicePixelRatio: canvasDpr
})
option.series[0].data = that.chartData6
canvas.setChart(chart)
chart.setOption(option)
return chart
@ -1189,7 +1454,7 @@
width: 750rpx;
height: 820rpx;
background: #FFFFFF;
z-index: 200;
z-index: 999 !important;
border-radius: 20rpx 20rpx 0rpx 0rpx;
@ -1231,7 +1496,7 @@
.week_weather {
margin-top: 14rpx;
text-align: center;
width: 72rpx;
width: 82rpx;
font-weight: 500;
font-size: 28rpx;
color: #50565A;

View File

@ -7,26 +7,26 @@
扫描二维码
</view>
<view class="iptbox">
<view class="qrcode">
<view class="qrcode" @click="btnqrcode">
<image src="https://api.ccttiot.com/smartmeter/img/static/uy7BNwAMIKwvstqFnRhs" mode=""></image>
</view>
<input type="text" class="ips" v-model="code" placeholder="请扫描蜂箱上的二维码" style="margin-left: 32rpx;"
<input type="text" class="ips" v-model="sn" placeholder="请扫描蜂箱上的二维码" style="margin-left: 32rpx;"
placeholder-class="my-placeholder" />
</view>
<view class="tit">
自定义蜂箱名称
</view>
<view class="iptbox">
<input type="text" class="ips" v-model="code" placeholder="请输入蜂箱的自定义名称"
<input type="text" class="ips" v-model="name" placeholder="请输入蜂箱的自定义名称"
placeholder-class="my-placeholder" />
</view>
<view class="tit">
所属蜂场
</view>
<view class="iptbox" >
<input type="text" class="ips" v-model="form.address" placeholder="请选择蜂场具体位置" placeholder-class="my-placeholder"
<view class="iptbox" @click="showmiyuan = true">
<input type="text" class="ips" v-model="fc" placeholder="请选择所属蜂场" placeholder-class="my-placeholder"
disabled />
<image src="https://api.ccttiot.com/smartmeter/img/static/ugAdKZm5ZHZ4to1cDsNI" mode=""></image>
</view>
@ -35,12 +35,14 @@
</view>
<view class="iptbox">
<input type="text" class="ips" v-model="code" placeholder="请输入设备ID或视频流地址"
placeholder-class="my-placeholder" />
placeholder-class="my-placeholder"/>
</view>
<view class="btn">
<view class="btn" @click="btnadd">
确认添加
</view>
<!-- 选择蜂场 -->
<u-select v-model="showmiyuan" :list="miyuancolumns" title='选择蜂场' @confirm="confirmmy"></u-select>
</view>
</template>
@ -52,21 +54,95 @@
backgroundColor: " #F4FAF8",
},
title: "添加蜂箱",
sn: '',
name: '',
videoStream: '',
fc: '',
fcid:'',
showmiyuan: false,
miyuancolumns: [],
pagesum: 1,
pagesize: 99
}
},
onLoad() {
this.getmiyuancolumns()
},
onShow() {
},
methods: {
addApiary(){
uni.navigateTo({
url:'/pages/Apiary/AddApiary'
btnqrcode(){
uni.scanCode({
onlyFromCamera: true,
scanType: ['qrCode'],
success: res => {
this.sn = res.result
},
fail: err => {
console.error('扫描失败:', err)
uni.showToast({
title: '扫描失败',
icon: 'none'
})
}
})
},
confirmmy(e){
this.fc = e[0].label
this.fcid = e[0].value
},
getmiyuancolumns() {
let data = {
pageNum: this.pagesum,
pageSize: this.pagesize
};
this.$u.get('/farm/apiary/list', data).then((res) => {
if (res.code === 200) {
this.miyuancolumns = res.rows.map(item => ({
value: item.apiaryId,
label: item.name
}))
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
},
btnadd() {
let data = {
sn:this.sn,
name:this.name,
apiaryId:this.fcid,
videoStream:this.videoStream
}
this.$u.put('farm/beehive/bind', data).then(res => {
if (res.code == 200) {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 1000
})
setTimeout(()=>{
uni.navigateBack()
},1500)
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}
// addApiary(){
// uni.navigateTo({
// url:'/pages/Apiary/AddApiary'
// })
// }
}
}
@ -80,6 +156,7 @@
.page {
// position: relative;
width: 750rpx;
.tit {
margin-top: 40rpx;
margin-left: 50rpx;
@ -87,15 +164,18 @@
font-size: 32rpx;
color: #3D3D3D;
}
.imgbox{
.imgbox {
margin-top: 28rpx;
margin-left: 46rpx;
image{
image {
width: 412rpx;
height: 222rpx;
}
}
.btn{
.btn {
margin: 160rpx auto;
// position: fixed;
display: flex;
@ -107,11 +187,12 @@
height: 88rpx;
background: #FFCC25;
border-radius: 20rpx 20rpx 20rpx 20rpx;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
}
.iptbox {
display: flex;
align-items: center;
@ -123,31 +204,34 @@
background: #FFFFFF;
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
border-radius: 20rpx 20rpx 20rpx 20rpx;
.qrcode{
.qrcode {
padding-right: 20rpx;
border-right: 2rpx solid #D8D8D8;
image{
image {
width: 54rpx;
height: 54rpx;
}
}
.ips {
width: 630rpx;
}
image {
width: 18rpx;
height: 32rpx;
}
.my-placeholder {
font-weight: 400;
font-size: 32rpx;
color: #808080;
}
}
}

View File

@ -23,9 +23,9 @@
当前还没有添加蜂场哦
</view>
</view>
<view class="Apiary_box">
<view class="Apiary_card">
<image src="https://api.ccttiot.com/smartmeter/img/static/ug4ZIzZSC0XAiRelaIfp" mode=""></image>
<scroll-view class="Apiary_box" scroll-y="true" @scrolltolower="loadMore">
<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>
<view class="txt1">
@ -37,17 +37,17 @@
</view>
<view class="info">
<view class="left">
福鼎蜂场
{{item.name}}
</view>
<view class="right">
8
{{item.beehiveCount}}
</view>
</view>
<view class="address">
福建省宁德市福鼎市太姥山镇秦屿大道2号 福建省宁德市福鼎市太姥山镇秦屿大道2号
{{item.address}}
</view>
</view>
</view>
</scroll-view>
<tab-bar :indexs='1' style=""></tab-bar>
@ -61,21 +61,63 @@
bgc: {
backgroundColor: " #FAFDFD",
},
pagesum: 1,
list: [],
total: '',
pagesize:10
}
},
onLoad() {
},
onShow() {
this.pagesum = 1
this.list = []
this.ishave()
},
methods: {
addApiary(){
//
btnapiaryxq(id){
},
loadMore() {
if (this.list.length < this.total) {
this.ishave();
} else {
uni.showToast({
title: '没有更多蜂场了',
icon: 'none',
duration: 1000
});
}
},
addApiary() {
uni.navigateTo({
url:'/pages/Apiary/AddApiary'
url: '/pages/Apiary/AddApiary'
})
}
},
ishave() {
let data = {
pageNum: this.pagesum,
pageSize: this.pagesize
};
this.$u.get('/farm/apiary/list', data).then((res) => {
if (res.code === 200) {
this.total = res.total
let uniqueIds = new Set(this.list.map(item => item.apiaryId))
let uniqueRows = res.rows.filter(row => !uniqueIds.has(row.apiaryId))
uniqueRows.forEach(row => uniqueIds.add(row.apiaryId))
this.list = this.list.concat(uniqueRows)
this.pagesum++
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
},
}
}
@ -91,10 +133,14 @@
width: 750rpx;
.Apiary_box {
display: flex;
justify-content: center;
padding-left: 40rpx;
box-sizing: border-box;
padding-bottom: 300rpx;
overflow-y: auto;
height: 100vh;
.Apiary_card {
margin-top: 20rpx;
position: relative;
width: 674rpx;
height: 512rpx;
@ -106,7 +152,8 @@
width: 674rpx;
height: 360rpx;
}
.address{
.address {
margin-top: 18rpx;
padding: 0 24rpx;
font-weight: 500;
@ -118,24 +165,28 @@
/* 超出部分隐藏 */
text-overflow: ellipsis;
}
.info{
.info {
margin-top: 18rpx;
padding: 0 24rpx;
display: flex;
align-items: center;
flex-wrap: nowrap;
justify-content: space-between;
.left{
.left {
font-weight: 600;
font-size: 36rpx;
color: #3D3D3D;
}
.right{
.right {
font-weight: 600;
font-size: 32rpx;
color: #50565A;
}
}
.weather {
padding: 20rpx 24rpx;
position: absolute;
@ -146,19 +197,22 @@
top: 0;
width: 674rpx;
height: 70rpx;
background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8), transparent);
image{
image {
width: 44rpx;
height: 44rpx;
}
.txt1{
.txt1 {
margin-left: 16rpx;
font-weight: 600;
font-size: 32rpx;
color: #3D3D3D;
}
.txt2{
.txt2 {
margin-left: 28rpx;
font-weight: 600;
font-size: 28rpx;

View File

@ -24,14 +24,14 @@
养殖蜂种
</view>
<view class="iptbox" @click="showfengzhong = true">
<input type="text" class="ips" v-model="code" placeholder="请选择养殖蜂种" placeholder-class="my-placeholder" disabled/>
<input type="text" class="ips" v-model="fengzhong" placeholder="请选择养殖蜂种" placeholder-class="my-placeholder" disabled/>
<image src="https://api.ccttiot.com/smartmeter/img/static/ugAdKZm5ZHZ4to1cDsNI" mode=""></image>
</view>
<view class="tit">
采集蜜源
</view>
<view class="iptbox" @click="showmiyuan = true">
<input type="text" class="ips" v-model="code" placeholder="请选择采集蜜源" placeholder-class="my-placeholder" disabled/>
<input type="text" class="ips" v-model="miyuan" placeholder="请选择采集蜜源" placeholder-class="my-placeholder" disabled/>
<image src="https://api.ccttiot.com/smartmeter/img/static/ugAdKZm5ZHZ4to1cDsNI" mode=""></image>
</view>
<view class="tit">
@ -48,9 +48,9 @@
<image :src="userImgs" mode="" v-if=""></image>
</view>
<u-select v-model="showfengzhong" :list="fengzhongcolumns" title='选择蜂种' @confirm="confirm"></u-select>
<u-select v-model="showmiyuan" :list="miyuancolumns" title='选择蜜源' @confirm="confirm"></u-select>
<view class="btn">
<u-select v-model="showfengzhong" :list="fengzhongcolumns" title='选择蜂种' @confirm="confirmfz"></u-select>
<u-select v-model="showmiyuan" :list="miyuancolumns" title='选择蜜源' @confirm="confirmmy"></u-select>
<view class="btn" @click="btnadd">
确认添加
</view>
<!-- <u-picker @cancel="showmiyuan=false" @confirm="confirmmiyuan" :show="showmiyuan"
@ -66,33 +66,13 @@
backgroundColor: " #FAFDFD",
},
code: '',
fengzhong:'',
miyuan:'',
fengzhongcolumns: [
],
miyuancolumns: [
{
label: '百花蜜',
value: 1
}, {
label: '油菜蜜',
value: 2
},
{
label: '荆条蜜',
value: 3
},
{
label: '荔枝蜜',
value: 4
},
{
label: '枣花蜜',
value: 5
},
{
label: '椴树蜜',
value: 6
},
],
showfengzhong:false,
@ -101,6 +81,11 @@
lat: 0,
lng: 0,
address: '',
province:'',
city:'',
county:'',
beeType:'',
honeyType:''
},
userImgs: '',
@ -118,6 +103,48 @@
this.getmiyuancolumns()
},
methods: {
confirmfz(e){
this.form.beeType = e[0].value
this.fengzhong = e[0].label
},
confirmmy(e){
this.form.honeyType = e[0].value
this.miyuan = e[0].label
},
btnadd(){
let data = {
name:this.code,
picture:this.userImgs,
address:this.form.address,
province:this.form.province,
city:this.form.city,
county:this.form.county,
lng:this.form.lng,
lat:this.form.lat,
beeType:this.form.beeType,
honeyType:this.form.honeyType
}
console.log(data);
this.$u.post("farm/apiary",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
});
}
})
},
getQiniuToken() {
this.$u.get("/common/qiniu/uploadInfo").then((res) => {
if (res.code == 200) {
@ -161,8 +188,6 @@
}
});
},
addApiary(){
let data ={
@ -241,6 +266,19 @@
uni.chooseLocation({
success: (res) => {
console.log(res);
let address = res.address;
let regex = /^([\u4e00-\u9fa5]+省)([\u4e00-\u9fa5]+市)([\u4e00-\u9fa5]+市|[\u4e00-\u9fa5]+区)(.*)/;
let match = address.match(regex);
if (match && match.length > 3) {
let province = match[1];
let city = match[2];
let district = match[3];
this.form.province = province
this.form.city = city
this.form.county = district
} else {
console.log('地址格式不匹配或无法提取省市区信息');
}
this.form.lng = res.longitude
this.form.lat = res.latitude
this.form.address = res.address

View File

@ -17,8 +17,8 @@
</view>
</view>
<view class="tabbar">
<view class="cont" v-for="item in 6 " :key="item">
福鼎蜂场10
<view class="cont" :id="indextab == index ? 'active' : ''" v-for="(item,index) in miyuancolumns" :key="index" @click="btntab(index,item)">
{{item.label}}
</view>
</view>
</view>
@ -26,35 +26,36 @@
<swiper class="swiper" :style="{ height: swiperHeight + 'rpx' }" :current='curtitidx'
@change="swiperchange">
<swiper-item >
<view class="swiper-item ">
<view class="card_box" @click="todetail(item.deviceId)">
<scroll-view class="swiper-item" scroll-y="true" @scrolltolower="loadMore">
<view v-if="total == 0" style="width: 100%;margin: auto;margin-top: 200rpx;text-align: center;color: #ccc;">该蜂场没有蜂箱...</view>
<view v-else class="card_box" v-for="(item,index) in fxlist" :key="index" @click="todetail(item.beehiveId)">
<view class="card">
<view class="card_top">
<view class="name">
福鼎蜂场-001
{{item.name}}
</view>
<view class="online">
离线
{{item.onlineStatus == 0 ? '离线' : '在线'}}
</view>
<view class="type">
已认养
</view>
<view class="ele">
<image src="https://api.ccttiot.com/smartmeter/img/static/uWDVO6wzl5tRe8X3rmhT" mode=""></image>
90%
{{item.surplusPower}}%
</view>
</view>
<view class="card_top" style="margin-top: 20rpx;">
<view class="txt">
21111145
{{item.sn}}
</view>
<view class="line"></view>
<view class="txt">
福鼎蜂场
{{item.apiaryName}}
</view>
<view class="line"></view>
<view class="txt">
2024-05-15 09:09:33
{{item.lastOnlineTime}}
</view>
</view>
<view class="info_cont">
@ -62,7 +63,7 @@
<view class="li_top">
<image src="https://api.ccttiot.com/smartmeter/img/static/uk7CvwzeU0ukxvS9cBtD" mode=""></image>
<view class="li_txt">
0.0
{{item.totalWeight}}
<span>kg</span>
</view>
</view>
@ -74,7 +75,7 @@
<view class="li_top">
<image src="https://api.ccttiot.com/smartmeter/img/static/uhsU6Y1K35jxA4aRauzy" mode=""></image>
<view class="li_txt">
0
{{item.ioCount}}
<span></span>
</view>
</view>
@ -86,7 +87,7 @@
<view class="li_top">
<image src="https://api.ccttiot.com/smartmeter/img/static/una6Kbd2gdBZ9gG6lg44" mode=""></image>
<view class="li_txt">
0.0
{{item.innerHumidity}}
<span>%</span>
</view>
</view>
@ -98,19 +99,19 @@
<view class="li_top">
<image src="https://api.ccttiot.com/smartmeter/img/static/utoKXhZBoejfRZwNUMP9" mode=""></image>
<view class="li_txt">
0.0
{{item.outerHumidity}}
<span></span>
</view>
</view>
<view class="li_bot">
温度
温度
</view>
</view>
<view class="info_li">
<view class="li_top">
<image src="https://api.ccttiot.com/smartmeter/img/static/um4lfl5q2O7FNM1EQc2L" mode=""></image>
<view class="li_txt">
0.0
{{item.innerCo2}}
<span>&</span>
</view>
</view>
@ -122,7 +123,7 @@
<view class="li_top">
<image src="https://api.ccttiot.com/smartmeter/img/static/up9IaGzSg1RKhIZz3V7a" mode=""></image>
<view class="li_txt">
0.0
{{item.volume}}
<span>Hz</span>
</view>
</view>
@ -134,19 +135,19 @@
<view class="li_top">
<image src="https://api.ccttiot.com/smartmeter/img/static/ujmGWuQ8Xibi5qoOqN0B" mode=""></image>
<view class="li_txt">
0.0
{{item.innerHumidity}}
<span>&</span>
</view>
</view>
<view class="li_bot">
湿度
湿度
</view>
</view>
<view class="info_li">
<view class="li_top">
<image src="https://api.ccttiot.com/smartmeter/img/static/uWjV9HEHrP5g0B5AHD1j" mode=""></image>
<view class="li_txt">
0.0
{{item.outerHumidity}}
<span></span>
</view>
</view>
@ -158,7 +159,7 @@
</view>
</view>
</view>
</scroll-view>
</swiper-item>
</swiper>
@ -188,17 +189,95 @@
},
code: '',
swiperHeight:554,
curtitidx:0
curtitidx:0,
miyuancolumns: [],
pagesum: 1,
pagesize: 99,
pagesizes: 5,
fxlist:[],
total: '',
apiaryId:'',
indextab:0
}
},
onLoad() {
// this.apiaryId = this.miyuancolumns[0].value
},
onShow() {
this.pagesum = 1
// this.fxlist = []
this.getmiyuancolumns()
},
methods: {
todetail(beehiveId){
uni.navigateTo({
url:'/page_Beehive/Beehive_detail?beehiveId=' + beehiveId
})
},
btntab(index,item){
this.indextab = index
this.pagesum = 1
this.apiaryId = item.value
this.fxlist = []
this.getlist()
},
getlist(){
let data = {
pageNum:this.pagesum,
pageSize:this.pagesizes,
apiaryId:this.apiaryId
}
this.$u.get('/farm/beehive/list', data).then(res => {
if(res.code == 200){
this.total = res.total
let uniqueIds = new Set(this.fxlist.map(item => item.apiaryId))
let uniqueRows = res.rows.filter(row => !uniqueIds.has(row.apiaryId))
uniqueRows.forEach(row => uniqueIds.add(row.apiaryId))
this.fxlist = this.fxlist.concat(uniqueRows)
this.pagesum++
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
},
loadMore() {
if (this.fxlist.length < this.total) {
this.getlist()
} else {
uni.showToast({
title: '没有更多蜂场了',
icon: 'none',
duration: 1000
});
}
},
getmiyuancolumns() {
let data = {
pageNum: this.pagesum,
pageSize: this.pagesize
};
this.$u.get('/farm/apiary/list', data).then((res) => {
if (res.code === 200) {
this.miyuancolumns = res.rows.map(item => ({
value: item.apiaryId,
label: item.name
}))
this.apiaryId = this.miyuancolumns[0].value
this.getlist()
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
},
swiperchange(e) {
this.curtitidx = e.detail.current
// console.log(e, 'aaaa');
@ -214,6 +293,9 @@
</script>
<style lang="scss">
#active{
border-bottom: 3px solid #FFC107;
}
page {
background-color: #FAFDFD;
}
@ -222,8 +304,11 @@
// position: relative;
width: 750rpx;
.swiper {
height: 100vh !important;
padding-bottom: 300rpx;
box-sizing: border-box;
.swiper-item {
overflow: scroll;
height: 100%;
.card_box {

View File

@ -221,7 +221,7 @@
ishave(){
let data ={
pageNum:1,
pageSize:0
pageSize:10
}
this.$u.get('/farm/apiary/list?',data ).then((res) => {