|
|
@ -210,6 +210,7 @@ export default { |
|
|
|
// 温度、湿度、Co2、Tvoc、烟雾浓度、光照强度、是否有人、声光报警状态 |
|
|
|
deviceInfo: {}, |
|
|
|
falt: false, |
|
|
|
timer: null, |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
@ -267,6 +268,7 @@ export default { |
|
|
|
}); |
|
|
|
const { data, code } = res; |
|
|
|
if (code == 200) { |
|
|
|
this.falt = true; // 登录成功后显示数据 |
|
|
|
uni.setStorageSync("userToken", data.token); |
|
|
|
this.getqueryProjectInfoByKey(); |
|
|
|
} |
|
|
@ -395,7 +397,7 @@ export default { |
|
|
|
}; |
|
|
|
console.log("this.deviceInfo", this.deviceInfo); |
|
|
|
// 定时请求接口,每次结束后等待10秒再请求 |
|
|
|
setTimeout(() => { |
|
|
|
this.timer = setTimeout(() => { |
|
|
|
this.getAttributes(this.deviceId); // 根据设备id查找设备信息 |
|
|
|
}, 30000); |
|
|
|
} |
|
|
@ -404,7 +406,15 @@ export default { |
|
|
|
created() { |
|
|
|
this.handleLogin(); |
|
|
|
}, |
|
|
|
onShow() {}, |
|
|
|
onShow() { |
|
|
|
if (this.falt) { |
|
|
|
this.getAttributes(this.deviceId); // 根据设备id查找设备信息 |
|
|
|
} |
|
|
|
}, |
|
|
|
// 页面卸载时清除定时器 |
|
|
|
onUnload() { |
|
|
|
clearTimeout(this.timer); |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|