重构第一版 智控助手小程序
This commit is contained in:
@@ -191,6 +191,16 @@ export async function GetRoomTypeNode(params){
|
||||
url: BoonliveUrl + 'GetDeviceInfo',
|
||||
data: params || {}
|
||||
})
|
||||
}
|
||||
//获取房型下的设备
|
||||
export async function GetRoomAddressStatus(params){
|
||||
params.token = gettoken();
|
||||
console.log(params)
|
||||
return await reqeust1({
|
||||
title: "",
|
||||
url: BoonliveUrl + 'GetRoomAddressStatus',
|
||||
data: params || {}
|
||||
})
|
||||
}
|
||||
export async function WebChatUpgrade(params){
|
||||
|
||||
@@ -257,4 +267,58 @@ export async function SetRCUCurtain(params){
|
||||
data: params || {}
|
||||
})
|
||||
}
|
||||
SetRCUCurtain
|
||||
|
||||
//查询设备列表
|
||||
export async function QueryDeviceList(params){
|
||||
params.token = gettoken();
|
||||
console.log(params)
|
||||
return await reqeust1({
|
||||
title: null,
|
||||
url: BoonliveUrl + 'QueryDeviceList',
|
||||
data: params || {}
|
||||
})
|
||||
}
|
||||
|
||||
//设置RCU服务
|
||||
export async function SetRCUService(params){
|
||||
params.token = gettoken();
|
||||
console.log(params)
|
||||
return await reqeust1({
|
||||
title: null,
|
||||
url: BoonliveUrl + 'SetRCUService',
|
||||
data: params || {}
|
||||
})
|
||||
}
|
||||
|
||||
//写入房间设备访问日志
|
||||
export async function WriteRoomVisitLog(params){
|
||||
params.token = gettoken();
|
||||
console.log(params)
|
||||
return await reqeust1({
|
||||
title: "上传查房记录中",
|
||||
url: BoonliveUrl + 'WriteRoomVisitLog',
|
||||
data: params || {}
|
||||
})
|
||||
}
|
||||
|
||||
//查询房间设备访问日志
|
||||
export async function QueryRoomVisitLog(params){
|
||||
params.token = gettoken();
|
||||
console.log(params)
|
||||
return await reqeust1({
|
||||
title: "查询设备访问日志中",
|
||||
url: BoonliveUrl + 'QueryRoomVisitLog',
|
||||
data: params || {}
|
||||
})
|
||||
}
|
||||
|
||||
//修改房间设备访问日志
|
||||
export async function UpdateRoomVisitLog(params){
|
||||
params.token = gettoken();
|
||||
console.log(params)
|
||||
return await reqeust1({
|
||||
title: "更新故障记录中",
|
||||
url: BoonliveUrl + 'UpdateRoomVisitLog',
|
||||
data: params || {}
|
||||
})
|
||||
}
|
||||
@@ -2,29 +2,34 @@
|
||||
let show = 0;
|
||||
export default async function reqeust(params) {
|
||||
show++;
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
// 判断是否需要显示loading弹窗
|
||||
const needLoading = params.title !== undefined && params.title !== null && params.title !== '';
|
||||
|
||||
if (needLoading) {
|
||||
wx.showLoading({
|
||||
title: params.title,
|
||||
mask:true
|
||||
})
|
||||
wx.request({
|
||||
mask: true
|
||||
});
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.request({
|
||||
header: {
|
||||
contentType: 'application/x-www-form-urlencoded', // 填入服务名称
|
||||
},
|
||||
contentType: 'application/x-www-form-urlencoded', // 填入服务名称
|
||||
},
|
||||
url: params.url,
|
||||
method: params.method || 'post',
|
||||
data: params.data || {},
|
||||
success: res => {
|
||||
resolve(res.data)
|
||||
resolve(res.data)
|
||||
},
|
||||
fail: err => {
|
||||
reject(err)
|
||||
},
|
||||
complete:()=>{
|
||||
show--;
|
||||
if(show==0){
|
||||
wx.hideLoading()
|
||||
if (needLoading && show === 0) {
|
||||
wx.hideLoading();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user