|
@@ -15,7 +15,7 @@ import {
|
|
workLeave,
|
|
workLeave,
|
|
contactTenant
|
|
contactTenant
|
|
} from "../../requests/api";
|
|
} from "../../requests/api";
|
|
-let timer=null;
|
|
|
|
|
|
+let refreshTimer=null;
|
|
Page({
|
|
Page({
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -99,6 +99,10 @@ Page({
|
|
},
|
|
},
|
|
picInitUrl:$.store.get("picInitUrl"),
|
|
picInitUrl:$.store.get("picInitUrl"),
|
|
},
|
|
},
|
|
|
|
+ onHide(){
|
|
|
|
+ clearInterval(refreshTimer);
|
|
|
|
+ refreshTimer=null;
|
|
|
|
+ },
|
|
// 关闭问卷
|
|
// 关闭问卷
|
|
surveyClose(value){
|
|
surveyClose(value){
|
|
this.setData({surveyShow:false,lottieShow:true});
|
|
this.setData({surveyShow:false,lottieShow:true});
|
|
@@ -811,6 +815,18 @@ Page({
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ // 自动刷新
|
|
|
|
+ autoRefresh(fn){
|
|
|
|
+ if(refreshTimer){
|
|
|
|
+ clearInterval(refreshTimer);
|
|
|
|
+ refreshTimer = null;
|
|
|
|
+ }
|
|
|
|
+ let refreshTime=$.store.get("autoRefreshTime");
|
|
|
|
+ refreshTimer = setTimeout(()=>{
|
|
|
|
+ fn();
|
|
|
|
+ this.autoRefresh(fn);
|
|
|
|
+ },refreshTime)
|
|
|
|
+ },
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
*/
|
|
@@ -818,6 +834,7 @@ Page({
|
|
options = JSON.parse(decodeURIComponent(JSON.stringify(options)));
|
|
options = JSON.parse(decodeURIComponent(JSON.stringify(options)));
|
|
if(options.md1){
|
|
if(options.md1){
|
|
this.getDetail(options.md1);
|
|
this.getDetail(options.md1);
|
|
|
|
+ this.autoRefresh(this.getDetail);
|
|
}else{
|
|
}else{
|
|
options.humidity&&(options.humiditylevel = this.checkLevel(options.humidity,"humidity"));
|
|
options.humidity&&(options.humiditylevel = this.checkLevel(options.humidity,"humidity"));
|
|
options.co2&&(options.co2level = this.checkLevel(options.co2,"co2"));
|
|
options.co2&&(options.co2level = this.checkLevel(options.co2,"co2"));
|
|
@@ -838,6 +855,7 @@ Page({
|
|
this.setData({singleOffice:true})
|
|
this.setData({singleOffice:true})
|
|
}
|
|
}
|
|
this.checkPower();
|
|
this.checkPower();
|
|
|
|
+ this.autoRefresh(this.getDetail);
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -863,9 +881,9 @@ Page({
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- wx.showLoading();
|
|
|
|
|
|
+ // wx.showLoading();
|
|
let res = await getSpacedetail(data);
|
|
let res = await getSpacedetail(data);
|
|
- wx.hideLoading();
|
|
|
|
|
|
+ // wx.hideLoading();
|
|
let {content} = res;
|
|
let {content} = res;
|
|
if(content){
|
|
if(content){
|
|
(content[0].humidity||content[0].humidity==0)&&(content[0].humiditylevel = this.checkLevel(content[0].humidity,"humidity"));
|
|
(content[0].humidity||content[0].humidity==0)&&(content[0].humiditylevel = this.checkLevel(content[0].humidity,"humidity"));
|