This commit is contained in:
3321822538@qq.com 2024-12-04 17:32:25 +08:00
parent aa6d0c218b
commit 58ed1420fc
3 changed files with 274 additions and 186 deletions

View File

@ -1,6 +1,6 @@
const install = (Vue, vm) => { const install = (Vue, vm) => {
Vue.prototype.$u.http.setConfig({ Vue.prototype.$u.http.setConfig({
// baseUrl: 'http://192.168.2.100:3202', // baseUrl: 'http://192.168.2.31:3202',
baseUrl: 'https://fen.ccttiot.com/prod-api', baseUrl: 'https://fen.ccttiot.com/prod-api',
loadingText: '努力加载中~', loadingText: '努力加载中~',
loadingTime: 800, loadingTime: 800,

View File

@ -16,11 +16,15 @@
</view> </view>
<view class="tit"> <view class="tit">
{{obj.apiaryName == undefined ? '--' : obj.apiaryName}}-{{obj.name == undefined ? '--' : obj.name}} {{obj.apiaryName == undefined ? '--' : obj.apiaryName}}-{{obj.name == undefined ? '--' : obj.name}}
<view class="sets"> <view class="sets">
<view class="tongbu" v-if="tbszflag" @click="btntbsz">
同步设置
</view>
<!-- <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 v-if="zcljflag" style="width: 184rpx;height: 40rpx;margin-right:20rpx" src="https://api.ccttiot.com/smartmeter/img/static/uYUoki4Tc56rzINzY2Ba" mode=""></image> <image v-if="zcljflag" style="width: 180rpx;height: 40rpx;margin-right:20rpx" src="https://api.ccttiot.com/smartmeter/img/static/uYUoki4Tc56rzINzY2Ba" mode=""></image>
<!-- 连接成功 --> <!-- 连接成功 -->
<image v-if="ljcgflag" style="width: 40rpx;height: 40rpx;margin-right:20rpx" src="https://api.ccttiot.com/smartmeter/img/static/uhSqWj4f07z8oDMh0i8f" mode=""></image> <image v-if="ljcgflag" style="width: 40rpx;height: 40rpx;margin-right:20rpx" src="https://api.ccttiot.com/smartmeter/img/static/uhSqWj4f07z8oDMh0i8f" mode=""></image>
<!-- 未连接 --> <!-- 未连接 -->
@ -141,7 +145,7 @@
src="https://api.ccttiot.com/smartmeter/img/static/uGGgEPbe8ryHspQPL2o8" mode=""></image> src="https://api.ccttiot.com/smartmeter/img/static/uGGgEPbe8ryHspQPL2o8" mode=""></image>
<image style="height: 25rpx;" v-if="ver_data.bat < 20" <image style="height: 25rpx;" v-if="ver_data.bat < 20"
src="https://api.ccttiot.com/smartmeter/img/static/uIRhPmP5WUJaIg0nft9E" mode=""></image> src="https://api.ccttiot.com/smartmeter/img/static/uIRhPmP5WUJaIg0nft9E" mode=""></image>
{{ver_data.bat == undefined ? '--' : ver_data.bat}}% {{this.point == undefined ? '--' : this.point}}%
</view> </view>
</view> </view>
<view class="echarts_box" v-if="xnwd" @click="btnec(1)"> <view class="echarts_box" v-if="xnwd" @click="btnec(1)">
@ -271,7 +275,7 @@
当前 {{obj.volume / 1000 == 0 ? obj.volume : (obj.volume / 1000).toFixed(1)}}khz 当前 {{obj.volume / 1000 == 0 ? obj.volume : (obj.volume / 1000).toFixed(1)}}khz
</view> </view>
<view class="top_cont" v-else> <view class="top_cont" v-else>
当前 {{ver_data.MIC / 1000 == 0 ? ver_data.MIC : (ver_data.MIC / 1000).toFixed(1)}}khz 当前 {{(ver_data.MIC !== undefined && !isNaN(ver_data.MIC) && ver_data.MIC / 1000 === 0) ? ver_data.MIC : ((ver_data.MIC !== undefined && !isNaN(ver_data.MIC)) ? (ver_data.MIC / 1000).toFixed(1) : '--')}}khz
</view> </view>
<view class="top_right"> <view class="top_right">
<view style="width: 1rpx;"> <view style="width: 1rpx;">
@ -449,7 +453,11 @@
ver_data:{}, ver_data:{},
zcljflag:false, zcljflag:false,
ljcgflag:false, ljcgflag:false,
wljflag:false wljflag:false,
tbszflag:false,
shezhiobj:{},
scdeviceflag:true,
point:''
} }
}, },
onLoad(option) { onLoad(option) {
@ -459,6 +467,7 @@
this.zcljflag = false this.zcljflag = false
this.wljflag = false this.wljflag = false
this.ljcgflag = false this.ljcgflag = false
this.tbszflag = false
setTimeout(() => { setTimeout(() => {
this.$refs.canvas1.init(this.initChart) this.$refs.canvas1.init(this.initChart)
this.$refs.canvas2.init(this.initChart2) this.$refs.canvas2.init(this.initChart2)
@ -491,13 +500,36 @@
this.clearTimer() this.clearTimer()
}, },
methods: { methods: {
//
getinfo() {
this.$u.get(`farm/userSetting/my`).then(res => {
if (res.code == 200) {
this.shezhiobj = res.data
// miteInterval: '', //
// minPower: '', //%
// minHeat: '', //
// maxHeat: '', //
// maxFan: '', //
// minFan: '', //
// minCo2: '', //
// maxCo2: '', //
}
})
},
//
btntbsz(){
// xBlufi.notifySendCustomData({
//       customData: ""
// })
},
// id // id
getobj() { getobj() {
this.$u.get(`/app/beehive/${this.beehiveId}`).then(res => { this.$u.get(`/app/beehive/${this.beehiveId}`).then(res => {
if (res.code == 200) { if (res.code == 200) {
if(res.data.onlineStatus == 0){ if(res.data.onlineStatus == 0){ //线
this.mac = res.data.mac this.mac = res.data.mac
this.Binddevice() this.Binddevice() //
this.getinfo() //
}else{ }else{
// //
this.startTimer() this.startTimer()
@ -548,7 +580,20 @@
}) })
this.gettq() this.gettq()
} else { } else if(res.code == 401){
uni.showModal({
title: '温馨提示',
content: '您还未登录,是否先去登录',
showCancel: true ,
success: function(res) {
if (res.confirm) {
uni.reLaunch({
url:'/pages/login/login'
})
}
}
})
}else{
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none', icon: 'none',
@ -617,8 +662,10 @@
title: '温馨提示', title: '温馨提示',
content: '暂未发现蜂箱设备,是否重新搜索连接', content: '暂未发现蜂箱设备,是否重新搜索连接',
showCancel: true , showCancel: true ,
success:function(res) { success: function(res) {
that.Binddevice() if (res.confirm) {
that.Binddevice()
}
} }
}) })
}else{ }else{
@ -669,6 +716,7 @@
this.zcljflag = false this.zcljflag = false
this.wljflag = false this.wljflag = false
this.ljcgflag = true this.ljcgflag = true
this.tbszflag = true
{ {
xBlufi.notifyInitBleEsp32({ xBlufi.notifyInitBleEsp32({
deviceId: options.data.deviceId deviceId: options.data.deviceId
@ -693,7 +741,23 @@
obj[key] = !isNaN(value) ? parseFloat(value) : value; obj[key] = !isNaN(value) ? parseFloat(value) : value;
}) })
this.ver_data = obj this.ver_data = obj
console.log(this.ver_data,this.ver_data.bat) if(this.ver_data.bat != '' || this.ver_data.bat != undefined){ //
this.point = (1 - (this.obj.modelMaxV - this.ver_data.bat) / (this.obj.modelMaxV -this.obj.modelMinV)) * 100
if(this.scdeviceflag == true){ //
let data = {
beehiveId:this.beehiveId,
sys:this.ver_data
}
this.$u.put(`app/beehive/btUpload`,data).then(res => {
if(res.code == 200){
this.scdeviceflag = false //
}else{
this.scdeviceflag = false //
}
})
}
}
console.log('收取到的蓝牙数据',this.ver_data,options.data)
break break
case xBlufi.XBLUFI_TYPE.TYPE_INIT_ESP32_RESULT: case xBlufi.XBLUFI_TYPE.TYPE_INIT_ESP32_RESULT:
if (options.result) { if (options.result) {
@ -930,196 +994,205 @@
}, },
// //
btndow(num) { btndow(num) {
if (num == 1) { const user = uni.getStorageSync('user')
if(this.obj.onlineStatus == 0){ if(this.obj.userId == user.userId){
xBlufi.notifySendCustomData({ if (num == 1) {
      customData: "11clear_weight@" if(this.obj.onlineStatus == 0){
 }) xBlufi.notifySendCustomData({
uni.showToast({       customData: "11clear_weight@"
title: '去皮成功',  })
icon: 'success', uni.showToast({
duration: 2000 title: '去皮成功',
}) icon: 'success',
}else{ duration: 2000
this.$u.put(`farm/beehive/iot/${this.beehiveId}/clearWeight`).then(res => { })
if (res.code == 200) { }else{
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) {
if(this.obj.onlineStatus == 0){
xBlufi.notifySendCustomData({
      customData: "11beep11@" + 10
 })
uni.showToast({
title: '响铃成功',
icon: 'success',
duration: 2000
})
}else{
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 == '关') {
if(this.obj.onlineStatus == 0){
xBlufi.notifySendCustomData({
    customData: '11fan100@'
})
this.fskx = '开'
uni.showToast({ uni.showToast({
title: '去皮成功', title: '风扇开启成功',
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}) })
} else { }else{
uni.showToast({ this.$u.put(`farm/beehive/iot/${this.beehiveId}/fan?open=true`).then(res => {
title: res.msg, if (res.code == 200) {
icon: 'none', if (this.fskx == '关') {
duration: 2000 this.fskx = '开'
} else {
this.fskx = '关'
}
uni.showToast({
title: '风扇开启成功',
icon: 'success',
duration: 2000
})
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
}) })
} }
}) } else {
} if(this.obj.onlineStatus == 0){
} else if (num == 2) { xBlufi.notifySendCustomData({
if(this.obj.onlineStatus == 0){     customData: "11fan0@"
xBlufi.notifySendCustomData({ })
      customData: "11beep11@" + 10 this.fskx = '关'
 })
uni.showToast({
title: '响铃成功',
icon: 'success',
duration: 2000
})
}else{
this.$u.put(`farm/beehive/iot/${this.beehiveId}/buzzer`).then(res => {
if (res.code == 200) {
uni.showToast({ uni.showToast({
title: '响铃成功', title: '风扇关闭成功',
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}) })
} else { }else{
uni.showToast({ this.$u.put(`farm/beehive/iot/${this.beehiveId}/fan?open=false`).then(res => {
title: res.msg, if (res.code == 200) {
icon: 'none', if (this.fskx == '关') {
duration: 2000 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 == 3) {
if (this.fskx == '关') {
if(this.obj.onlineStatus == 0){
xBlufi.notifySendCustomData({
    customData: '11fan100@'
})
this.fskx = '开'
uni.showToast({
title: '风扇开启成功',
icon: 'success',
duration: 2000
})
}else{
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 { } else if (num == 4) {
if(this.obj.onlineStatus == 0){ if (this.jrkg == '关') {
xBlufi.notifySendCustomData({ if(this.obj.onlineStatus == 0){
    customData: "11fan0@" xBlufi.notifySendCustomData({
})     customData: "11hot100@"
this.fskx = '关' })
uni.showToast({ this.jrkg = '开'
title: '风扇关闭成功', uni.showToast({
icon: 'success', title: '加热开启成功',
duration: 2000 icon: 'success',
}) duration: 2000
}else{ })
this.$u.put(`farm/beehive/iot/${this.beehiveId}/fan?open=false`).then(res => { }else{
if (res.code == 200) { this.$u.put(`farm/beehive/iot/${this.beehiveId}/heat?open=true`).then(res => {
if (this.fskx == '关') { if (res.code == 200) {
this.fskx = '开' if (this.jrkg == '关') {
this.jrkg = '开'
} else {
this.jrkg = '关'
}
uni.showToast({
title: '加热开启成功',
icon: 'success',
duration: 2000
})
} else { } else {
this.fskx = '关' uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
} }
uni.showToast({ })
title: '风扇关闭成功', }
icon: 'success', } else {
duration: 2000 if(this.obj.onlineStatus == 0){
}) xBlufi.notifySendCustomData({
} else {     customData: "11hot0@"
uni.showToast({ })
title: res.msg, this.jrkg = '关'
icon: 'none', uni.showToast({
duration: 2000 title: '加热关闭成功',
}) icon: 'success',
} duration: 2000
}) })
} }else{
} this.$u.put(`farm/beehive/iot/${this.beehiveId}/heat?open=false`).then(res => {
} else if (num == 4) { if (res.code == 200) {
if (this.jrkg == '关') { if (this.jrkg == '关') {
if(this.obj.onlineStatus == 0){ this.jrkg = '开'
xBlufi.notifySendCustomData({ } else {
    customData: "11hot100@" this.jrkg = '关'
}) }
this.jrkg = '开' uni.showToast({
uni.showToast({ title: '加热关闭成功',
title: '加热开启成功', icon: 'success',
icon: 'success', duration: 2000
duration: 2000 })
}) } else {
}else{ uni.showToast({
this.$u.put(`farm/beehive/iot/${this.beehiveId}/heat?open=true`).then(res => { title: res.msg,
if (res.code == 200) { icon: 'none',
if (this.jrkg == '关') { duration: 2000
this.jrkg = '开' })
} else { }
this.jrkg = '关' })
} }
uni.showToast({
title: '加热开启成功',
icon: 'success',
duration: 2000
})
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}
} else {
if(this.obj.onlineStatus == 0){
xBlufi.notifySendCustomData({
    customData: "11hot0@"
})
this.jrkg = '关'
uni.showToast({
title: '加热关闭成功',
icon: 'success',
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
})
}
})
} }
} }
}else{
uni.showToast({
title: '您没有权限操作',
icon: 'none',
duration: 2000
})
} }
}, },
// //
@ -2253,6 +2326,19 @@
color: #3D3D3D; color: #3D3D3D;
.sets { .sets {
position: relative; position: relative;
display: flex;
align-items: center;
.tongbu{
width: 130rpx;
height: 40rpx;
border-radius: 4rpx;
text-align: center;
line-height: 40rpx;
font-size: 28rpx;
color: #fff;
background-color: #FFC107;
margin-right: 20rpx;
}
.menu { .menu {
padding: 20rpx; padding: 20rpx;
position: absolute; position: absolute;

View File

@ -233,6 +233,8 @@
onShow() { onShow() {
this.indextab = 0 this.indextab = 0
this.pagesum = 1 this.pagesum = 1
this.curtitidx = 0
this.apiaryId = ''
this.miyuancolumns = [] this.miyuancolumns = []
this.getmiyuancolumns() this.getmiyuancolumns()
}, },