环境数据三刷

pull/4/head
pangdundun 2023-10-07 14:44:30 +08:00
parent 776306f95a
commit aaa4a9afda
10 changed files with 102 additions and 23 deletions

View File

@ -7,7 +7,8 @@
"path": "pages/timeEnvironment/timeEnvironment",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
"navigationStyle": "custom",
"enablePullDownRefresh": true
}
}, {
"path": "pages/timeVideo/timeVideo",

View File

@ -218,7 +218,9 @@
topActive: 0,
indexs: 1,
inputData1: []
inputData1: [],
timer:null
};
},
watch: {
@ -228,11 +230,14 @@
this.deviceId = option.id
this.dataInit()
let that = this
setInterval(function() {
this.timer = setInterval(function() {
that.dataInit();
that.getReg();
}, 3000);
},
onUnload() {
clearTimeout(this.timer)
},
onPullDownRefresh() {
uni.showLoading({
title: '加载中...'

View File

@ -250,10 +250,42 @@
{ label: '无线传感器无线信号强度', value: 57, countType: 1,unit: 'dBm' },
{ label: '无线传感器信噪比SNR', value: 58, countType: 1,unit: 'dB' },
],
timer:null
}
},
onShow() {
onLoad() {
let that = this
this.timer = setInterval(function() {
uni.getStorage({
key: 'token',
success: function(res) {
that.getEquipmentInfo(uni.getStorageSync('userid'))
},
// fail:function(err){
// uni.reLaunch({
// url:'/pages/login/login'
// })
// }
})
}, 60000);
},
onUnload() {
clearTimeout(this.timer)
},
onPullDownRefresh() {
let that = this
uni.getStorage({
key: 'token',
success: function(res) {
that.getEquipmentInfo(uni.getStorageSync('userid'))
},
// fail:function(err){
// uni.reLaunch({
// url:'/pages/login/login'
// })
// }
})
},
mounted() {
let that = this
@ -280,7 +312,7 @@
url: this.api.sel_eqbyid + userid,
method: 'GET'
}).then(res => {
console.log(res, '根据用户id查询对应的设备数据');
// console.log(res, 'id');
if (res.code == 200) {
this.waterAndFertilizerParamsList = res.data.map((item,index)=>{
@ -294,13 +326,14 @@
url: this.api.getFs_rtdata + "?equipmentId=" + i.deviceId,
method: 'post',
}).then(res => {
console.log(res, '主页查看施肥机实时数据');
// console.log(res, '');
if(res.code == 200){
uni.hideLoading({
title: '完成'
});
uni.stopPullDownRefresh();
i.childList= res.data;
console.log(this.waterAndFertilizerParamsList);
// console.log(this.waterAndFertilizerParamsList);
}
})
})

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -21361,7 +21361,8 @@ var _default = {
"path": "pages/timeEnvironment/timeEnvironment",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
"navigationStyle": "custom",
"enablePullDownRefresh": true
}
}, {
"path": "pages/timeVideo/timeVideo",

View File

@ -408,7 +408,8 @@ var _default = {
left1Act: -1,
topActive: 0,
indexs: 1,
inputData1: []
inputData1: [],
timer: null
};
},
watch: {},
@ -416,11 +417,14 @@ var _default = {
this.deviceId = option.id;
this.dataInit();
var that = this;
setInterval(function () {
this.timer = setInterval(function () {
that.dataInit();
that.getReg();
}, 3000);
},
onUnload: function onUnload() {
clearTimeout(this.timer);
},
onPullDownRefresh: function onPullDownRefresh() {
uni.showLoading({
title: '加载中...'

View File

@ -697,10 +697,43 @@ var _default = {
value: 58,
countType: 1,
unit: 'dB'
}]
}],
timer: null
};
},
onShow: function onShow() {},
onLoad: function onLoad() {
var that = this;
this.timer = setInterval(function () {
uni.getStorage({
key: 'token',
success: function success(res) {
that.getEquipmentInfo(uni.getStorageSync('userid'));
}
// fail:function(err){
// uni.reLaunch({
// url:'/pages/login/login'
// })
// }
});
}, 60000);
},
onUnload: function onUnload() {
clearTimeout(this.timer);
},
onPullDownRefresh: function onPullDownRefresh() {
var that = this;
uni.getStorage({
key: 'token',
success: function success(res) {
that.getEquipmentInfo(uni.getStorageSync('userid'));
}
// fail:function(err){
// uni.reLaunch({
// url:'/pages/login/login'
// })
// }
});
},
mounted: function mounted() {
var that = this;
uni.getStorage({
@ -727,7 +760,7 @@ var _default = {
url: this.api.sel_eqbyid + userid,
method: 'GET'
}).then(function (res) {
console.log(res, '根据用户id查询对应的设备数据');
// console.log(res, '根据用户id查询对应的设备数据');
if (res.code == 200) {
_this.waterAndFertilizerParamsList = res.data.map(function (item, index) {
return _objectSpread(_objectSpread({}, item), {}, {
@ -739,13 +772,14 @@ var _default = {
url: _this.api.getFs_rtdata + "?equipmentId=" + i.deviceId,
method: 'post'
}).then(function (res) {
console.log(res, '主页查看施肥机实时数据');
// console.log(res, '主页查看施肥机实时数据');
if (res.code == 200) {
uni.hideLoading({
title: '完成'
});
uni.stopPullDownRefresh();
i.childList = res.data;
console.log(_this.waterAndFertilizerParamsList);
// console.log(this.waterAndFertilizerParamsList);
}
});
});

View File

@ -1,6 +1,7 @@
{
"navigationBarTitleText": "",
"navigationStyle": "custom",
"enablePullDownRefresh": true,
"usingComponents": {
"u-navbar": "/node-modules/uview-ui/components/u-navbar/u-navbar"
}