|
@@ -46,6 +46,18 @@ Page({
|
|
|
temperatureNum:'--',
|
|
|
guideUser:false,
|
|
|
},
|
|
|
+ toDetail(e){
|
|
|
+ if(!e.currentTarget.dataset.istemp){
|
|
|
+ router.push("detail",e.currentTarget.dataset)
|
|
|
+ }else{
|
|
|
+ router.push("detail",{name:"温度",
|
|
|
+ localname:"温度",
|
|
|
+ param:"temperature",
|
|
|
+ funcid:"Tdb",
|
|
|
+ spaceid:e.currentTarget.dataset.spaceid,
|
|
|
+ projectid:e.currentTarget.dataset.projectid})
|
|
|
+ }
|
|
|
+ },
|
|
|
// 检查是否过引导
|
|
|
checkGuide(){
|
|
|
if(!this.data.tenantName){
|
|
@@ -88,10 +100,10 @@ Page({
|
|
|
},
|
|
|
// 置顶操作
|
|
|
tapItem(e){
|
|
|
- let {id,top} = e.currentTarget.dataset.spaceid;
|
|
|
+ let {id,top,projectId} = e.currentTarget.dataset.spaceid;
|
|
|
let spaceIndex = e.currentTarget.dataset.index;
|
|
|
let data = {
|
|
|
- "projectId":this.data.projectId,
|
|
|
+ "projectId":projectId,
|
|
|
"spaceId":id,
|
|
|
"userId":this.data.userId,
|
|
|
"top":top?0:1
|
|
@@ -162,7 +174,11 @@ Page({
|
|
|
} else {
|
|
|
await that.getTenant(res);
|
|
|
// 第一次进入获取数据
|
|
|
+ console.log($.storage.get('wxqcode'),"$.storage.get('wxqcode')")
|
|
|
!$.storage.get('wxqcode')&&that.getData();
|
|
|
+ if($.storage.get('wxqcode')&&$.storage.get('logined')){
|
|
|
+ this.checkCode($.storage.get('wxqcode'));
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -187,9 +203,9 @@ Page({
|
|
|
this.setData({logined:true});
|
|
|
!$.storage.get('openId')&&$.storage.set('openId', res.content.openId);
|
|
|
!$.storage.get('openId')&&$.storage.set('userId', res.content.id);
|
|
|
- $.storage.set('projectId', $.store.get("projectId"));
|
|
|
- $.storage.set('tenantId', $.store.get('tenantId'));
|
|
|
- $.storage.set('tenantName', $.store.get('tenantName'));
|
|
|
+ $.storage.set('projectId', currentTenant.projectId);
|
|
|
+ $.storage.set('tenantId', currentTenant.tenantId);
|
|
|
+ $.storage.set('tenantName',currentTenant.tenantName);
|
|
|
|
|
|
this.setData({
|
|
|
projectId: $.store.get('projectId'),
|
|
@@ -263,11 +279,11 @@ Page({
|
|
|
current = value[0];
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
- current.projectId = currntProjectId;
|
|
|
- current.tenantId = currntProjecttenantId;
|
|
|
- current.tenantName = currntProjecttenantName;
|
|
|
- }
|
|
|
+ }else{
|
|
|
+ current.projectId = currntProjectId;
|
|
|
+ current.tenantId = currntProjecttenantId;
|
|
|
+ current.tenantName = currntProjecttenantName;
|
|
|
+ }
|
|
|
|
|
|
resolve(current)
|
|
|
})
|
|
@@ -282,24 +298,28 @@ Page({
|
|
|
*/
|
|
|
async getData() {
|
|
|
// $.loading()
|
|
|
+ let userId = $.store.get('userId')||$.storage.get('userId');
|
|
|
+ if(!userId){
|
|
|
+ return;
|
|
|
+ }
|
|
|
wx.showLoading({
|
|
|
title:"加载中"
|
|
|
})
|
|
|
const data = {
|
|
|
"criteria": {
|
|
|
- "userId": $.store.get('userId'),
|
|
|
- "projectId": $.store.get('projectId'),
|
|
|
- "tenantId": $.store.get('tenantId')
|
|
|
+ "userId": userId,
|
|
|
+ "projectId": $.store.get('projectId')||$.storage.get('projectId'),
|
|
|
+ "tenantId": $.store.get('tenantId')||$.storage.get('tenantId')
|
|
|
}
|
|
|
}
|
|
|
// let res = await queryRotation(data);
|
|
|
let res = await getSpaceAdjustList(data);
|
|
|
if(res.count){
|
|
|
res.content.forEach(item=>{
|
|
|
- item.humidity&&(item.humiditylevel = this.checkLevel(item.humidity,"humidity"));
|
|
|
- item.co2&&(item.co2level = this.checkLevel(item.co2,"co2"));
|
|
|
- item.pm25&&(item.pm25level = this.checkLevel(item.pm25,"pm25"));
|
|
|
- item.hcho&&(item.hcholevel = this.checkLevel(item.hcho,"hcho"));
|
|
|
+ (item.humidity||item.humidity==0)&&(item.humiditylevel = this.checkLevel(item.humidity,"humidity"));
|
|
|
+ (item.co2||item.co2==0)&&(item.co2level = this.checkLevel(item.co2,"co2"));
|
|
|
+ (item.pm25||item.pm25==0)&&(item.pm25level = this.checkLevel(item.pm25,"pm25"));
|
|
|
+ (item.hcho||item.hcho==0)&&(item.hcholevel = this.checkLevel(item.hcho,"hcho"));
|
|
|
})
|
|
|
this.setData({cardList:res.content})
|
|
|
}else{
|
|
@@ -311,7 +331,7 @@ Page({
|
|
|
checkLevel(value,name){
|
|
|
let objList={
|
|
|
humidity:{
|
|
|
- range:[20,50],
|
|
|
+ range:[30,70],
|
|
|
text:["干燥","适宜","湿润"]
|
|
|
},
|
|
|
co2:{
|
|
@@ -330,6 +350,7 @@ Page({
|
|
|
let sortArr=[value,...objList[name].range].sort((a,b)=>{return a-b});
|
|
|
|
|
|
let level=sortArr.findIndex(item=>item===value);
|
|
|
+ console.log(level,349)
|
|
|
let levelTxt = objList[name].text[level];
|
|
|
return {level,levelTxt}
|
|
|
},
|
|
@@ -422,11 +443,13 @@ Page({
|
|
|
let q = decodeURIComponent(options.q);
|
|
|
// let q="https://duoduoenv.sagacloud.cn/scan?key=Sp110108025988e09ed4cd8c45b5a496f18622ab81ca";
|
|
|
$.storage.set('wxqcode', q);
|
|
|
+ // console.log($.storage.get('wxqcode'),"123")
|
|
|
}
|
|
|
await this.inItUserdate();
|
|
|
- if($.storage.get('wxqcode')&&this.data.logined){
|
|
|
- this.checkCode($.storage.get('wxqcode'));
|
|
|
- }
|
|
|
+ console.log($.storage.get('wxqcode'),$.storage.get('logined'),"449")
|
|
|
+ // if($.storage.get('wxqcode')&&$.storage.get('logined')){
|
|
|
+ // this.checkCode($.storage.get('wxqcode'));
|
|
|
+ // }
|
|
|
this.getWeatherNum();
|
|
|
this.checkGuide();
|
|
|
// 加载数据
|
|
@@ -447,9 +470,10 @@ Page({
|
|
|
*/
|
|
|
async onShow() {
|
|
|
// await this.inItUserdate();
|
|
|
- if($.store.get("tenantId")&&!$.store.get('changeTenantId')&&!this.data.formList){
|
|
|
+ if($.storage.get("tenantId")&&!$.store.get('changeTenantId')&&!this.data.formList){
|
|
|
this.getData();
|
|
|
}
|
|
|
+
|
|
|
if(this.data.formList){
|
|
|
this.setData({
|
|
|
tenantName:$.store.get('tenantName'),
|