diff --git a/pages/fengchang/index.vue b/pages/fengchang/index.vue
index 0e34216..3e5e32e 100644
--- a/pages/fengchang/index.vue
+++ b/pages/fengchang/index.vue
@@ -175,11 +175,12 @@
},
methods: {
tofx(id){
- uni.setStorageSync('targetId', id);
+ uni.setStorageSync('targetId', id);
uni.switchTab({
url: '/pages/fengxiang/index'
- });
+ })
},
+
searchFn() {
// 清除之前的定时器
clearTimeout(this.timer);
diff --git a/pages/fengxiang/index.vue b/pages/fengxiang/index.vue
index b54b642..319a3ef 100644
--- a/pages/fengxiang/index.vue
+++ b/pages/fengxiang/index.vue
@@ -31,13 +31,25 @@
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
+
{{item.name}}
@@ -46,32 +58,33 @@
{{item.status_text}}
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
+
@@ -93,7 +106,7 @@
-
+
-
+
-
-
-
+
+
+
{{item.qrcode}}
- 丨 {{item.update_time}}
+ 丨{{item.update_time}}
丨
{{item.address}}
-
+
@@ -145,17 +158,19 @@
箱内
- {{item.temperature_in_box.substring(0, 3) < -40 || item.temperature_in_box.substring(0, 3) > 100 ? '--' : item.temperature_in_box}}
+ {{item.temperature_in_box.substring(0, 3) < -40 || item.temperature_in_box.substring(0, 3) > 100 ? '--' : item.temperature_in_box}}
箱内
- {{item.temperature_in_box.substring(0, 3) < -40 || item.temperature_in_box.substring(0, 3) > 100? '--' : item.humidity_in_box}}
+ {{item.temperature_in_box.substring(0, 3) < -40 || item.temperature_in_box.substring(0, 3) > 100? '--' : item.humidity_in_box}}
-
+
出勤
@@ -166,19 +181,21 @@
箱外
- {{item.temperature_out_box.substring(0, 3) < -40 || item.temperature_out_box.substring(0, 3) > 100 ? '--' : item.temperature_out_box}}
+ {{item.temperature_out_box.substring(0, 3) < -40 || item.temperature_out_box.substring(0, 3) > 100 ? '--' : item.temperature_out_box}}
箱外
- {{item.temperature_out_box.substring(0, 3) < -40 || item.temperature_out_box.substring(0, 3) > 100 ? '--' :item.humidity_out_box}}
+ {{item.temperature_out_box.substring(0, 3) < -40 || item.temperature_out_box.substring(0, 3) > 100 ? '--' :item.humidity_out_box}}
-
-
+
+
-
+
电量
@@ -187,9 +204,9 @@
加热
-
+ :color="'#3a942b'" style="transform:scale(0.5)" />
@@ -200,33 +217,23 @@
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -293,39 +300,42 @@
ewmflag: false,
disabledflag: false,
tokenflag: false,
- total:0,
- showflag:false,
- masks:false
+ total: 0,
+ showflag: false,
+ masks: false,
+ quchongid:''
};
},
onShow() {
- uni.showLoading({
- title: '加载中...',
- mask: true,
- success: function() {
- // 显示成功的回调
- },
- });
- this.loadData();
+ // uni.showLoading({
+ // title: '加载中...',
+ // mask: true,
+ // success: function() {
+ // // 显示成功的回调
+ // },
+ // });
+ // this.listData = []
+ this.page = 1
+ this.loadData()
setTimeout(() => {
uni.hideLoading()
- }, 1000)
+ }, 5000)
// this.cheshi()
this.tabitems = [{
- name: '全部'
- }]
+ name: '全部'
+ }]
},
onHide() {
uni.removeStorageSync('targetId');
// Clear the interval when the component is destroyed
clearInterval(this.intervalId);
},
- onPullDownRefresh() {
- // this.listData = []
- setTimeout(() => {
- this.loadData();
- }, 2000)
- },
+ // onPullDownRefresh() {
+ // // this.listData = []
+ // setTimeout(() => {
+ // this.loadData();
+ // }, 2000)
+ // },
watch: {
id(newId, oldId) {
// 在这里执行你的监听操作,比如触发事件、调用函数等
@@ -341,24 +351,23 @@
},
async loadData() {
// 先执行获取数据的方法
- await this.getfengchangList();
+ // await this.getfengchangList();
// 获取targetId
- setTimeout(() => {
- const targetId = uni.getStorageSync('targetId');
- if (targetId) {
- // 如果存在,赋值给this.checkid
- this.checkid = targetId;
- const index = this.tabitems.findIndex(item => item.id === this.checkid);
-
- // 将索引赋值给this.currentindex
- this.currentindex = index;
- this.pageData('', this.checkid)
- } else {
- this.getfengchangList()
- }
- }, 300);
+ // setTimeout(() => {
+ const targetId = uni.getStorageSync('targetId');
+ if (targetId) {
+ // 如果存在,赋值给this.checkid
+ this.checkid = targetId;
+ const index = this.tabitems.findIndex(item => item.id === this.checkid);
+ // 将索引赋值给this.currentindex
+ this.currentindex = index;
+ this.pageData('', this.checkid)
+ } else {
+ this.getfengchangList()
+ }
+ // }, 300);
// this.refresh();
// 设置定时刷新
// this.intervalId = setInterval(() => {
@@ -371,6 +380,9 @@
} else {
this.pageData('', this.checkid)
}
+ setTimeout(() => {
+ uni.hideLoading()
+ }, 5000)
},
fenlampbut(item) {
if (this.switchk) {
@@ -410,7 +422,7 @@
// return array.findIndex(i => i.name === item.name) === index;
// });
// } catch (error) {
-
+
// }
// },
// 点击刷新
@@ -602,35 +614,41 @@
mask: true
})
request.post('/api/beehive/removePeel/' + item.id, {}).then(res => {
- request.get('/api/beehive/detail/' + item.id, {}).then(res => {
- const newData = res.data.data;
- const existingItem = that.listData.find(item => item.id === newData.id);
- if (existingItem) {
- // 如果找到,替换原数据
- const index = that.listData.indexOf(existingItem);
- that.listData.splice(index, 1, newData);
- } else {
- that.listData.push(newData);
- }
- })
- setTimeout(() => {
- setTimeout(() => {
- request.get('/api/beehive/detail/' + item.id, {}).then(res => {
- const newData = res.data.data;
- const existingItem = that.listData.find(item => item.id === newData
- .id);
- if (existingItem) {
- // 如果找到,替换原数据
- const index = that.listData.indexOf(existingItem)
- that.listData.splice(index, 1, newData)
- uni.hideLoading()
- } else {
- that.listData.push(newData);
- }
- })
- }, 500)
- // uni.hideLoading()
- }, 6000)
+ request.get('/api/beehive/detail/' + item.id, {}).then(res => {
+ const newData = res.data.data;
+ const existingItem = that.listData.find(item => item.id ===
+ newData.id);
+ if (existingItem) {
+ // 如果找到,替换原数据
+ const index = that.listData.indexOf(existingItem);
+ that.listData.splice(index, 1, newData);
+ } else {
+ that.listData.push(newData);
+ }
+ })
+ setTimeout(() => {
+ setTimeout(() => {
+ request.get('/api/beehive/detail/' + item
+ .id, {}).then(res => {
+ const newData = res.data.data;
+ const existingItem = that.listData
+ .find(item => item.id ===
+ newData
+ .id);
+ if (existingItem) {
+ // 如果找到,替换原数据
+ const index = that.listData
+ .indexOf(existingItem)
+ that.listData.splice(index, 1,
+ newData)
+ uni.hideLoading()
+ } else {
+ that.listData.push(newData);
+ }
+ })
+ }, 500)
+ // uni.hideLoading()
+ }, 6000)
})
} else if (res.cancel) {}
@@ -727,9 +745,9 @@
}
await request.get('/api/apiary/index', {}).then(res => {
if (res.msg == '用户凭证不存在') {
- console.log(11);
- uni.hideLoading()
+ this.masks = true
this.tokenflag = false
+ uni.hideLoading()
} else {
uni.hideLoading()
this.tokenflag = true
@@ -770,21 +788,83 @@
qrcode
}
}).then(res => {
- this.masks = false
- uni.hideLoading()
- wx.setStorageSync('user_id', res.data.data[0].user_id);
- this.total = res.data.total
- if (res.data.data.length > 0) {
- // 有数据,追加到列表
- this.listData = this.listData.concat(res.data.data)
- this.page++
- // uni.hideLoading()
- }
- // 停止下拉刷新状态
- wx.stopPullDownRefresh();
- // this.$forceUpdate()
+ if(res.statusCode == 200){
+ wx.setStorageSync('user_id', res.data.data[0].user_id);
+ this.total = res.data.total
+ if(this.total > 0){
+ this.masks = false
+ }else{
+ this.masks = true
+ }
+ if (res.data.data.length > 0) {
+ // 有数据,追加到列表
+ // this.listData = this.listData.concat(res.data.data)
+ this.listData.push(...res.data.data)
+ if (this.quchongid === '') {
+ let filteredData = this.listData
+ let uniqueIds = new Set()
+ let uniqueData = filteredData.filter(item => {
+ if (!uniqueIds.has(item.id)) {
+ uniqueIds.add(item.id);
+ return true;
+ }
+ return false
+ })
+ uniqueData.sort((a, b) => {
+ // 首先根据 status_text 排序
+ if (a.status_text !== b.status_text) {
+ // 假设 "在线" 应该排在 "离线" 前面
+ return a.status_text === '在线' ? -1 : 1;
+ }
+
+ // status_text 相同,则根据 name 排序
+ // 尝试将 name 转换为数字,如果失败则保留为字符串
+ const numA = Number(a.name);
+ const numB = Number(b.name);
+
+ // 检查 name 是否可以转换为数字
+ if (!isNaN(numA) && !isNaN(numB)) {
+ // 两者都是数字,按数字大小排序
+ return numA - numB;
+ } else if (!isNaN(numA)) {
+ // a 是数字,b 不是数字,数字排前面
+ return -1;
+ } else if (!isNaN(numB)) {
+ // b 是数字,a 不是数字,b 排后面
+ return 1;
+ } else {
+ // 两者都不是数字,按字符串排序
+ return a.name.localeCompare(b.name);
+ }
+ });
+ // this.listData = filteredData;
+ this.listData = uniqueData;
+ } else {
+ let filteredData = this.listData.filter(item => item.apiary_id === this.quchongid)
+ let uniqueIds = new Set()
+ let uniqueData = filteredData.filter(item => {
+ if (!uniqueIds.has(item.id)) {
+ uniqueIds.add(item.id);
+ return true;
+ }
+ return false
+ })
+ this.listData = uniqueData;
+ }
+
+ this.page++
+ }
+ uni.hideLoading()
+ // 停止下拉刷新状态
+ wx.stopPullDownRefresh();
+ // this.$forceUpdate()
+ }else{
+ this.masks = true
+ }
}).catch(e => {})
},
+
+
// 跳转添加蜂箱页面
xinzeng() {
if (this.tokenflag == true) {
@@ -826,26 +906,31 @@
})
},
clicktabs(event) {
+ console.log(event);
+ if(event.id){
+ this.quchongid = event.id
+ }else{
+ this.quchongid = ''
+ }
uni.showLoading({
title: '加载中',
mask: true
})
this.page = 1
- this.listData = []
- this.masks = true
+ // this.listData = []
if (event.index = 0) {
this.checkid = ''
this.currentindex = 0
-
+
} else {
this.checkid = event.id
const index = this.tabitems.findIndex(item => item.id === this.checkid);
this.currentindex = index
-
+
}
- setTimeout(()=>{
+ setTimeout(() => {
this.refresh()
- },1000)
+ }, 1000)
},
},
};
@@ -855,6 +940,7 @@
/deep/ .u-popup__content {
width: 750rpx;
}
+
.shuaxin {
width: 32rpx;
height: 32rpx;
@@ -864,7 +950,7 @@
height: 100%;
}
}
-
+
.maskgun {
width: 100%;
height: 100vh;
@@ -1020,7 +1106,7 @@
text-align: center;
width: 100rpx;
height: 50rpx;
-
+
}
// 气泡框的样式
@@ -1158,7 +1244,7 @@
background-color: #f7f7f7;
width: 100%;
overflow-y: auto;
- overflow-x: hidden;
+ overflow-x: hidden;
// height: 100vh;
}
@@ -1408,7 +1494,7 @@
border-radius: 16rpx;
width: 65rpx;
height: 26rpx;
- vertical-align: top;
+ vertical-align: top;
}
.view_5 {
diff --git a/pages/login/index.vue b/pages/login/index.vue
index f9b5c96..3467f4a 100644
--- a/pages/login/index.vue
+++ b/pages/login/index.vue
@@ -125,6 +125,9 @@
},
getPhoneNumber(e) {
console.log(this.flage,'that.flage');
+ uni.showLoading({
+ title: '加载中...',
+ })
let that = this;
if(that.flage==false){
console.log('没确认');
@@ -182,12 +185,14 @@
console.log(res.data, 'resres');
if(res.data.code==0){
console.log('进入跳转');
+ uni.hideLoading()
uni.switchTab({
url: '/pages/index/index'
})
}
// console.log(this.formData
} catch (error) {
+ uni.hideLoading()
console.log(error, 'aaa')
if (error.data.code == 401) {
// this.userlogin()
diff --git a/pages/wode/index.vue b/pages/wode/index.vue
index d57ded3..89cb02c 100644
--- a/pages/wode/index.vue
+++ b/pages/wode/index.vue
@@ -5,10 +5,8 @@
-
+
+
@@ -79,11 +77,13 @@ import request from '../../utils/request'
async setuser() {
const res = await request.get('/api/user/info')
console.log(res)
- if(res.code == 401){
- this.tokenflag = false
- }else{
+ if(res.statusCode == 200){
this.tokenflag = true
this.userImage = res.data.data.avatar
+ }else{
+ console.log(1010);
+ this.tokenflag = false
+ this.userImage = 'https://api.ccttiot.com/smartmeter/img/static/usaBta7T92keDZwpiqjM'
}
},
diff --git a/pagesFengChang/addfengchang/index.vue b/pagesFengChang/addfengchang/index.vue
index 11da04e..a98dbc5 100644
--- a/pagesFengChang/addfengchang/index.vue
+++ b/pagesFengChang/addfengchang/index.vue
@@ -24,7 +24,7 @@
具体位置
+ v-model="form.addresss">{{form.addresss}}
@@ -91,6 +91,7 @@
lng: '',
lat: '',
address: '',
+ addresss:'',
bee_type: '',
honey_source: '',
remark: '',
@@ -136,7 +137,7 @@
addressData: ['北京市', '北京市', '东城区'],
fileList1: [],
uploadfileList: [],
- title: '添加蜂场'
+ title: '添加蜂场',
};
},
mounted() {
@@ -163,10 +164,30 @@
return res
},
gotomap() {
- console.log("跳转到地图")
- uni.navigateTo({
- url: '/pagesFengChang/components/map',
- })
+ uni.chooseLocation({
+ success: (res) => {
+ console.log(res);
+ this.form.lng = res.latitude
+ this.form.lat = res.longitude
+ this.form.addresss = res.address
+ },
+ fail: function(err) {
+ // 检查错误消息,看是否是用户取消了位置选择
+ if (err.errMsg && err.errMsg.indexOf('chooseLocation:cancel') === 0) {
+ uni.showToast({
+ title: '您取消了位置选择',
+ icon: 'none'
+ });
+ } else {
+ console.log('选择位置失败', err);
+ // 处理其他失败情况
+ }
+ },
+ });
+ // console.log("跳转到地图")
+ // uni.navigateTo({
+ // url: '/pagesFengChang/components/map',
+ // })
},
submit() {
diff --git a/pagesFengXiang/pages/fengxiangDetail/index.vue b/pagesFengXiang/pages/fengxiangDetail/index.vue
index ccaa424..85c8620 100644
--- a/pagesFengXiang/pages/fengxiangDetail/index.vue
+++ b/pagesFengXiang/pages/fengxiangDetail/index.vue
@@ -10,7 +10,7 @@
{{listdata.name}}
-
{{listdata.status_text}}
@@ -48,6 +48,9 @@
:latitude="map.latitude" :longitude="map.longitude" :markers="map.markers" :enable-satellite="map.isMap"
show-location>
+
+ 未获取到定位信息
+
@@ -207,6 +210,7 @@
return {
loading: true,
switchk: true,
+ maskflag:false,
listdata: {},
id: null,
chartdataObj: {},
@@ -883,22 +887,18 @@
listDataFn() {
request.get('/api/beehive/detail/' + this.id, {}).then(res => {
this.idss = res.data.data.id
- // this.user_id = res.data.data.user_id
- // console.log(wx.getStorageSync('user_id'),this.user_id);
- // if (wx.getStorageSync('user_id') != this.user_id) {
- // uni.reLaunch({
- // url: '/pagesFengXiang/pages/fengxiangDetailtwo/index?id=' + this.id
- // })
- // }
this.getServerDatas()
console.log(res);
this.listdata = {
...res.data.data
}
- this.map.longitude = this.listdata.lng
- this.map.latitude = this.listdata.lat
- // this.map.markers[0].latitude = this.listdata.latGcj02
- // this.map.markers[0].longitude = this.listdata.lngGcj02
+ if(this.listdata.lng == ''){
+ this.maskflag = true
+ }else{
+ this.map.longitude = this.listdata.lng
+ this.map.latitude = this.listdata.lat
+ this.maskflag = false
+ }
if (this.listdata.status_text == '离线') {
this.map.markers.push({
latitude: this.listdata.lat,
@@ -907,9 +907,6 @@
height: 15,
id: this.listdata.id,
iconPath: '../../../static/a22.png',
- // label: {
- // content: item.name,
- // }
})
} else {
this.map.markers.push({
@@ -919,9 +916,6 @@
height: 15,
id: this.listdata.id,
iconPath: '../../../static/a11.png',
- // label: {
- // content: item.name,
- // }
})
}
@@ -1105,7 +1099,20 @@
.wendubox {
display: flex;
}
-
+ .maskmap{
+ position: absolute;
+ left: 50%;
+ transform: translateX(-50%);
+ bottom: 0rpx;
+ width: 100%;
+ text-align: center;
+ height: 599rpx;
+ background: #ccc;
+ opacity: .5;
+ color: red;
+ font-size: 32rpx;
+ font-weight: 600;
+ }
.flex-taxt {
display: flex;
align-items: center;
@@ -1268,6 +1275,7 @@
.mapbox {
height: 600rpx;
+ position: relative;
}
.detailbox {
diff --git a/pagesFengXiang/pages/fengxiangDetailtwo/index.vue b/pagesFengXiang/pages/fengxiangDetailtwo/index.vue
index 76c10b8..160bffd 100644
--- a/pagesFengXiang/pages/fengxiangDetailtwo/index.vue
+++ b/pagesFengXiang/pages/fengxiangDetailtwo/index.vue
@@ -52,6 +52,9 @@
:latitude="map.latitude" :longitude="map.longitude" :markers="map.markers" :enable-satellite="map.isMap"
show-location>
+
+ 未获取到定位信息
+
@@ -213,6 +216,7 @@
listdata: {},
id: null,
chartdataObj: {},
+ maskflag:false,
map: {
zoomSize: 15,
latitude: null,
@@ -901,8 +905,13 @@
...res.data.data
}
// console.log(this.listdata,'121212')
- this.map.longitude = this.listdata.lng
- this.map.latitude = this.listdata.lat
+ if(this.listdata.lng == ''){
+ this.maskflag = true
+ }else{
+ this.map.longitude = this.listdata.lng
+ this.map.latitude = this.listdata.lat
+ this.maskflag = false
+ }
// this.map.markers[0].latitude = this.listdata.latGcj02
// this.map.markers[0].longitude = this.listdata.lngGcj02
if(this.listdata.status_text == '离线'){
@@ -1075,6 +1084,20 @@
.dflex1 {
display: flex;
}
+ .maskmap{
+ position: absolute;
+ left: 50%;
+ transform: translateX(-50%);
+ bottom: 0rpx;
+ width: 100%;
+ text-align: center;
+ height: 599rpx;
+ background: #ccc;
+ opacity: .5;
+ color: red;
+ font-size: 32rpx;
+ font-weight: 600;
+ }
.image_7 {
border-radius: 4rpx;
@@ -1276,6 +1299,7 @@
.mapbox {
height: 600rpx;
+ position: relative;
}
.detailbox {