环境数据三刷

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", "path": "pages/timeEnvironment/timeEnvironment",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationStyle": "custom" "navigationStyle": "custom",
"enablePullDownRefresh": true
} }
}, { }, {
"path": "pages/timeVideo/timeVideo", "path": "pages/timeVideo/timeVideo",

View File

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

View File

@ -250,10 +250,42 @@
{ label: '无线传感器无线信号强度', value: 57, countType: 1,unit: 'dBm' }, { label: '无线传感器无线信号强度', value: 57, countType: 1,unit: 'dBm' },
{ label: '无线传感器信噪比SNR', value: 58, countType: 1,unit: 'dB' }, { 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() { mounted() {
let that = this let that = this
@ -280,7 +312,7 @@
url: this.api.sel_eqbyid + userid, url: this.api.sel_eqbyid + userid,
method: 'GET' method: 'GET'
}).then(res => { }).then(res => {
console.log(res, '根据用户id查询对应的设备数据'); // console.log(res, 'id');
if (res.code == 200) { if (res.code == 200) {
this.waterAndFertilizerParamsList = res.data.map((item,index)=>{ this.waterAndFertilizerParamsList = res.data.map((item,index)=>{
@ -294,13 +326,14 @@
url: this.api.getFs_rtdata + "?equipmentId=" + i.deviceId, url: this.api.getFs_rtdata + "?equipmentId=" + i.deviceId,
method: 'post', method: 'post',
}).then(res => { }).then(res => {
console.log(res, '主页查看施肥机实时数据'); // console.log(res, '');
if(res.code == 200){ if(res.code == 200){
uni.hideLoading({ uni.hideLoading({
title: '完成' title: '完成'
}); });
uni.stopPullDownRefresh();
i.childList= res.data; 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", "path": "pages/timeEnvironment/timeEnvironment",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationStyle": "custom" "navigationStyle": "custom",
"enablePullDownRefresh": true
} }
}, { }, {
"path": "pages/timeVideo/timeVideo", "path": "pages/timeVideo/timeVideo",

View File

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

View File

@ -697,10 +697,43 @@ var _default = {
value: 58, value: 58,
countType: 1, countType: 1,
unit: 'dB' 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() { mounted: function mounted() {
var that = this; var that = this;
uni.getStorage({ uni.getStorage({
@ -727,7 +760,7 @@ var _default = {
url: this.api.sel_eqbyid + userid, url: this.api.sel_eqbyid + userid,
method: 'GET' method: 'GET'
}).then(function (res) { }).then(function (res) {
console.log(res, '根据用户id查询对应的设备数据'); // console.log(res, '根据用户id查询对应的设备数据');
if (res.code == 200) { if (res.code == 200) {
_this.waterAndFertilizerParamsList = res.data.map(function (item, index) { _this.waterAndFertilizerParamsList = res.data.map(function (item, index) {
return _objectSpread(_objectSpread({}, item), {}, { return _objectSpread(_objectSpread({}, item), {}, {
@ -739,13 +772,14 @@ var _default = {
url: _this.api.getFs_rtdata + "?equipmentId=" + i.deviceId, url: _this.api.getFs_rtdata + "?equipmentId=" + i.deviceId,
method: 'post' method: 'post'
}).then(function (res) { }).then(function (res) {
console.log(res, '主页查看施肥机实时数据'); // console.log(res, '主页查看施肥机实时数据');
if (res.code == 200) { if (res.code == 200) {
uni.hideLoading({ uni.hideLoading({
title: '完成' title: '完成'
}); });
uni.stopPullDownRefresh();
i.childList = res.data; i.childList = res.data;
console.log(_this.waterAndFertilizerParamsList); // console.log(this.waterAndFertilizerParamsList);
} }
}); });
}); });

View File

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