From 58ed1420fc1a21d9003a982733855ef3af57f4c6 Mon Sep 17 00:00:00 2001
From: "3321822538@qq.com" <3321822538@qq.com>
Date: Wed, 4 Dec 2024 17:32:25 +0800
Subject: [PATCH] =?UTF-8?q?=E8=9C=82=E7=AE=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/http.interceptor.js | 2 +-
page_Beehive/Beehive_detail.vue | 456 +++++++++++++++++++-------------
pages/Beehive.vue | 2 +
3 files changed, 274 insertions(+), 186 deletions(-)
diff --git a/common/http.interceptor.js b/common/http.interceptor.js
index 205a907..b137384 100644
--- a/common/http.interceptor.js
+++ b/common/http.interceptor.js
@@ -1,6 +1,6 @@
const install = (Vue, vm) => {
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',
loadingText: '努力加载中~',
loadingTime: 800,
diff --git a/page_Beehive/Beehive_detail.vue b/page_Beehive/Beehive_detail.vue
index fea8070..da17673 100644
--- a/page_Beehive/Beehive_detail.vue
+++ b/page_Beehive/Beehive_detail.vue
@@ -16,11 +16,15 @@
{{obj.apiaryName == undefined ? '--' : obj.apiaryName}}-{{obj.name == undefined ? '--' : obj.name}}
+
+
+ 同步设置
+
-
+
@@ -141,7 +145,7 @@
src="https://api.ccttiot.com/smartmeter/img/static/uGGgEPbe8ryHspQPL2o8" mode="">
- {{ver_data.bat == undefined ? '--' : ver_data.bat}}%
+ {{this.point == undefined ? '--' : this.point}}%
@@ -271,7 +275,7 @@
当前 {{obj.volume / 1000 == 0 ? obj.volume : (obj.volume / 1000).toFixed(1)}}khz
- 当前 {{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
@@ -449,7 +453,11 @@
ver_data:{},
zcljflag:false,
ljcgflag:false,
- wljflag:false
+ wljflag:false,
+ tbszflag:false,
+ shezhiobj:{},
+ scdeviceflag:true,
+ point:''
}
},
onLoad(option) {
@@ -459,6 +467,7 @@
this.zcljflag = false
this.wljflag = false
this.ljcgflag = false
+ this.tbszflag = false
setTimeout(() => {
this.$refs.canvas1.init(this.initChart)
this.$refs.canvas2.init(this.initChart2)
@@ -491,13 +500,36 @@
this.clearTimer()
},
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获取设备信息
getobj() {
this.$u.get(`/app/beehive/${this.beehiveId}`).then(res => {
if (res.code == 200) {
- if(res.data.onlineStatus == 0){
- this.mac = res.data.mac
- this.Binddevice()
+ if(res.data.onlineStatus == 0){ //判断蜂箱离线时
+ this.mac = res.data.mac
+ this.Binddevice() //执行连接蓝牙方法
+ this.getinfo() //获取设置数值
}else{
// 每次进入执行定时器
this.startTimer()
@@ -548,7 +580,20 @@
})
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({
title: res.msg,
icon: 'none',
@@ -617,9 +662,11 @@
title: '温馨提示',
content: '暂未发现蜂箱设备,是否重新搜索连接',
showCancel: true ,
- success:function(res) {
- that.Binddevice()
- }
+ success: function(res) {
+ if (res.confirm) {
+ that.Binddevice()
+ }
+ }
})
}else{
this.zcljflag = false
@@ -669,6 +716,7 @@
this.zcljflag = false
this.wljflag = false
this.ljcgflag = true
+ this.tbszflag = true
{
xBlufi.notifyInitBleEsp32({
deviceId: options.data.deviceId
@@ -693,7 +741,23 @@
obj[key] = !isNaN(value) ? parseFloat(value) : value;
})
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
case xBlufi.XBLUFI_TYPE.TYPE_INIT_ESP32_RESULT:
if (options.result) {
@@ -930,196 +994,205 @@
},
// 点击进行蜂箱操作
btndow(num) {
- if (num == 1) {
- if(this.obj.onlineStatus == 0){
- xBlufi.notifySendCustomData({
- customData: "11clear_weight@"
- })
- uni.showToast({
- title: '去皮成功',
- icon: 'success',
- duration: 2000
- })
- }else{
- this.$u.put(`farm/beehive/iot/${this.beehiveId}/clearWeight`).then(res => {
- if (res.code == 200) {
+ const user = uni.getStorageSync('user')
+ if(this.obj.userId == user.userId){
+ if (num == 1) {
+ if(this.obj.onlineStatus == 0){
+ xBlufi.notifySendCustomData({
+ customData: "11clear_weight@"
+ })
+ uni.showToast({
+ title: '去皮成功',
+ icon: 'success',
+ duration: 2000
+ })
+ }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({
- title: '去皮成功',
+ 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=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 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) {
+ } else {
+ if(this.obj.onlineStatus == 0){
+ xBlufi.notifySendCustomData({
+ customData: "11fan0@"
+ })
+ this.fskx = '关'
uni.showToast({
- title: '响铃成功',
+ 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 == 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 {
- if(this.obj.onlineStatus == 0){
- xBlufi.notifySendCustomData({
- customData: "11fan0@"
- })
- this.fskx = '关'
- uni.showToast({
- title: '风扇关闭成功',
- icon: 'success',
- 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 if (num == 4) {
+ if (this.jrkg == '关') {
+ if(this.obj.onlineStatus == 0){
+ xBlufi.notifySendCustomData({
+ customData: "11hot100@"
+ })
+ this.jrkg = '开'
+ uni.showToast({
+ title: '加热开启成功',
+ icon: 'success',
+ duration: 2000
+ })
+ }else{
+ 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 {
- this.fskx = '关'
+ uni.showToast({
+ title: res.msg,
+ icon: 'none',
+ duration: 2000
+ })
}
- uni.showToast({
- title: '风扇关闭成功',
- icon: 'success',
- duration: 2000
- })
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none',
- duration: 2000
- })
- }
- })
- }
- }
- } else if (num == 4) {
- if (this.jrkg == '关') {
- if(this.obj.onlineStatus == 0){
- xBlufi.notifySendCustomData({
- customData: "11hot100@"
- })
- this.jrkg = '开'
- uni.showToast({
- title: '加热开启成功',
- icon: 'success',
- duration: 2000
- })
- }else{
- 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 {
- 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 {
+ 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;
.sets {
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 {
padding: 20rpx;
position: absolute;
diff --git a/pages/Beehive.vue b/pages/Beehive.vue
index 98f2fdb..bf1ec98 100644
--- a/pages/Beehive.vue
+++ b/pages/Beehive.vue
@@ -233,6 +233,8 @@
onShow() {
this.indextab = 0
this.pagesum = 1
+ this.curtitidx = 0
+ this.apiaryId = ''
this.miyuancolumns = []
this.getmiyuancolumns()
},