取消1|2分钟刷新加载效果

pull/21/head
pangdundun 2023-10-14 11:16:59 +08:00
parent 8a491ca518
commit e0dbd6d2f2
12 changed files with 67 additions and 24 deletions

View File

@ -51,9 +51,9 @@
uni.getStorage({ uni.getStorage({
key: 'token', key: 'token',
success: function(res) { success: function(res) {
uni.showLoading({ // uni.showLoading({
title: '加载中...' // title: '...'
}) // })
that.getEquipmentInfo(uni.getStorageSync('userid')) that.getEquipmentInfo(uni.getStorageSync('userid'))
} }
}) })

View File

@ -144,7 +144,7 @@
url: this.api.chart_fsdata + '?equipmentId=' + this.equipmentId, url: this.api.chart_fsdata + '?equipmentId=' + this.equipmentId,
method: 'POST' method: 'POST'
}).then(res => { }).then(res => {
console.log(res, '获取折线图数据'); // console.log(res, '线');
res.data.forEach((i, index) => { res.data.forEach((i, index) => {
this.categoriesList.push(i.time); this.categoriesList.push(i.time);
this.valuePHList.push(i.value) this.valuePHList.push(i.value)
@ -161,7 +161,7 @@
return e[this.titleName + this.echartName] == undefined ? '' : e[this.titleName + return e[this.titleName + this.echartName] == undefined ? '' : e[this.titleName +
this.echartName] this.echartName]
}) })
console.log(this.newValuePHList, '121212212121211111111'); // console.log(this.newValuePHList, '121212212121211111111');
}) })
}, },

View File

@ -260,7 +260,21 @@
} }
}, },
onLoad() { onLoad() {
uni.showLoading({
title: '加载中...'
});
let that = this let that = this
uni.getStorage({
key: 'token',
success: function(res) {
that.getEquipmentInfo(uni.getStorageSync('userid'))
},
// fail:function(err){
// uni.reLaunch({
// url:'/pages/login/login'
// })
// }
})
this.timer = setInterval(function() { this.timer = setInterval(function() {
uni.getStorage({ uni.getStorage({
key: 'token', key: 'token',
@ -276,9 +290,13 @@
}, 60000); }, 60000);
}, },
onUnload() { onUnload() {
clearTimeout(this.timer) let that = this
clearTimeout(that.timer)
}, },
onPullDownRefresh() { onPullDownRefresh() {
uni.showLoading({
title: '加载中...'
});
let that = this let that = this
uni.getStorage({ uni.getStorage({
key: 'token', key: 'token',
@ -293,6 +311,9 @@
}) })
}, },
mounted() { mounted() {
uni.showLoading({
title: '加载中...'
});
let that = this let that = this
uni.getStorage({ uni.getStorage({
key: 'token', key: 'token',
@ -310,9 +331,9 @@
// id // id
getEquipmentInfo(userid) { getEquipmentInfo(userid) {
let that = this let that = this
uni.showLoading({ // uni.showLoading({
title: '加载中...' // title: '...'
}); // });
this.$http({ this.$http({
url: this.api.sel_eqbyid + userid, url: this.api.sel_eqbyid + userid,
method: 'GET' method: 'GET'

View File

@ -176,7 +176,7 @@
userId: res.data userId: res.data
} }
}).then(res => { }).then(res => {
console.log(res); // console.log(res);
if (res.code == 200) { if (res.code == 200) {
that.userName = res.data.username; that.userName = res.data.username;
that.admin = that.user_level(res.data.userType); that.admin = that.user_level(res.data.userType);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -216,9 +216,9 @@ var _default = {
uni.getStorage({ uni.getStorage({
key: 'token', key: 'token',
success: function success(res) { success: function success(res) {
uni.showLoading({ // uni.showLoading({
title: '加载中...' // title: '加载中...'
}); // })
that.getEquipmentInfo(uni.getStorageSync('userid')); that.getEquipmentInfo(uni.getStorageSync('userid'));
} }
}); });

View File

@ -306,7 +306,7 @@ var _default = {
url: this.api.chart_fsdata + '?equipmentId=' + this.equipmentId, url: this.api.chart_fsdata + '?equipmentId=' + this.equipmentId,
method: 'POST' method: 'POST'
}).then(function (res) { }).then(function (res) {
console.log(res, '获取折线图数据'); // console.log(res, '获取折线图数据');
res.data.forEach(function (i, index) { res.data.forEach(function (i, index) {
_this2.categoriesList.push(i.time); _this2.categoriesList.push(i.time);
_this2.valuePHList.push(i.value); _this2.valuePHList.push(i.value);
@ -321,7 +321,7 @@ var _default = {
_this2.newValuePHList = _this2.valuePHList.map(function (e, index) { _this2.newValuePHList = _this2.valuePHList.map(function (e, index) {
return e[_this2.titleName + _this2.echartName] == undefined ? '' : e[_this2.titleName + _this2.echartName]; return e[_this2.titleName + _this2.echartName] == undefined ? '' : e[_this2.titleName + _this2.echartName];
}); });
console.log(_this2.newValuePHList, '121212212121211111111'); // console.log(this.newValuePHList, '121212212121211111111');
}); });
}, },
// 判断是否是平均或者目标,或者是1# // 判断是否是平均或者目标,或者是1#

View File

@ -667,7 +667,22 @@ var _default = {
}; };
}, },
onLoad: function onLoad() { onLoad: function onLoad() {
uni.showLoading({
title: '加载中...'
});
var that = this; 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'
// })
// }
});
this.timer = setInterval(function () { this.timer = setInterval(function () {
uni.getStorage({ uni.getStorage({
key: 'token', key: 'token',
@ -683,9 +698,13 @@ var _default = {
}, 60000); }, 60000);
}, },
onUnload: function onUnload() { onUnload: function onUnload() {
clearTimeout(this.timer); var that = this;
clearTimeout(that.timer);
}, },
onPullDownRefresh: function onPullDownRefresh() { onPullDownRefresh: function onPullDownRefresh() {
uni.showLoading({
title: '加载中...'
});
var that = this; var that = this;
uni.getStorage({ uni.getStorage({
key: 'token', key: 'token',
@ -700,6 +719,9 @@ var _default = {
}); });
}, },
mounted: function mounted() { mounted: function mounted() {
uni.showLoading({
title: '加载中...'
});
var that = this; var that = this;
uni.getStorage({ uni.getStorage({
key: 'token', key: 'token',
@ -718,9 +740,9 @@ var _default = {
getEquipmentInfo: function getEquipmentInfo(userid) { getEquipmentInfo: function getEquipmentInfo(userid) {
var _this = this; var _this = this;
var that = this; var that = this;
uni.showLoading({ // uni.showLoading({
title: '加载中...' // title: '加载中...'
}); // });
this.$http({ this.$http({
url: this.api.sel_eqbyid + userid, url: this.api.sel_eqbyid + userid,
method: 'GET' method: 'GET'

View File

@ -254,7 +254,7 @@ var _default = {
userId: res.data userId: res.data
} }
}).then(function (res) { }).then(function (res) {
console.log(res); // console.log(res);
if (res.code == 200) { if (res.code == 200) {
that.userName = res.data.username; that.userName = res.data.username;
that.admin = that.user_level(res.data.userType); that.admin = that.user_level(res.data.userType);