Commit e9cdb5a5 by wjd

Merge branch 'jianxiang' into 'test/96'

Jianxiang

See merge request iot-project-js/doorlock!46
parents 87f1f583 3e9d3cdc
...@@ -23,6 +23,7 @@ export default { ...@@ -23,6 +23,7 @@ export default {
}, },
"hijackMode": { "hijackMode": {
2: "hijackingAlarm", 2: "hijackingAlarm",
20: "hijackingAlarm"
}, },
"model": "USMARTLOCK_SECURITY_SMARTDOOR_SMART_LOCK", "model": "USMARTLOCK_SECURITY_SMARTDOOR_SMART_LOCK",
"GET_MSG_INTERVAL": 5000, "GET_MSG_INTERVAL": 5000,
......
...@@ -148,8 +148,8 @@ function openScanCode(self){ ...@@ -148,8 +148,8 @@ function openScanCode(self){
console.log(response); console.log(response);
let data = uPublic.checkResponseData(response.data); let data = uPublic.checkResponseData(response.data);
if(data){ if(data){
//云端绑定 //获取设备详情
deviceBind(self, lockId, relId); getInfo(self, lockId, relId, data.uuid);
}else{} }else{}
}, },
error: (error) => { error: (error) => {
...@@ -183,11 +183,38 @@ function openScanCode(self){ ...@@ -183,11 +183,38 @@ function openScanCode(self){
}); });
} }
function deviceBind(self, lockId, relId){ //获取设备详情
function getInfo(self, lockId, relId, uuid){
if(uuid){
iot.business.device.getInfo({
data: {
sds: true,
uuid: uuid
},
success: (response) => {
console.log(response);
let data = uPublic.checkResponseData(response.data);
if(data){
//云端绑定
deviceBind(self, lockId, relId, data.auid);
// deviceBind(self, lockId, relId);
}
},
error: (error) => {
console.log(error);
},
complete: () => {}
});
}
}
// 云端绑定
function deviceBind(self, lockId, relId, auid){
iot.business.api.sendCustom('lock/bindUser',{ iot.business.api.sendCustom('lock/bindUser',{
data: { data: {
device_id: lockId, device_id: lockId,
rel_id: relId, rel_id: relId,
auid: auid,
// mac: parameters.mac, // mac: parameters.mac,
nickname: '' nickname: ''
}, },
......
...@@ -338,7 +338,7 @@ function sendDeviceStatus(self, deviceId, productId, uuid){ ...@@ -338,7 +338,7 @@ function sendDeviceStatus(self, deviceId, productId, uuid){
}, },
success: (response) => { success: (response) => {
//激活成功 //激活成功
bind(self, deviceId, productId); getInfo(self, deviceId, productId,uuid);
console.log(response); console.log(response);
}, },
error: (error) => { error: (error) => {
...@@ -382,12 +382,38 @@ function unbind(self, deviceId, productId){ ...@@ -382,12 +382,38 @@ function unbind(self, deviceId, productId){
}); });
} }
//获取设备详情
function getInfo(self, deviceId, productId,uuid){
if(uuid){
iot.business.device.getInfo({
data: {
sds: true,
uuid: uuid
},
success: (response) => {
console.log(response);
let data = uPublic.checkResponseData(response.data);
if(data){
//云端绑定
bind(self, deviceId, productId, data.auid);
// bind(self, deviceId, productId);
}
},
error: (error) => {
console.log(error);
},
complete: () => {}
});
}
}
//云端绑定 //云端绑定
function bind(self, deviceId, productId){ function bind(self, deviceId, productId, auid){
iot.business.api.sendCustom('lock/bind',{ iot.business.api.sendCustom('lock/bind',{
data: { data: {
product_id: productId, product_id: productId,
device_id: deviceId, device_id: deviceId,
auid: auid,
// mac: sn, // mac: sn,
nickname: '' nickname: ''
}, },
......
...@@ -1270,11 +1270,13 @@ function doorlockManageTap(self){ ...@@ -1270,11 +1270,13 @@ function doorlockManageTap(self){
//tap 门铃(停止响铃) //tap 门铃(停止响铃)
function stopDoorbellRing(self){ function stopDoorbellRing(self){
self.setDoorbellRingingFlag(false); if(self.getMsgClass() == 'doorbell_img'){
self.setNormalApertureShow(false); self.setDoorbellRingingFlag(false);
self.setRingTime(0); self.setNormalApertureShow(false);
window.clearInterval(self.time); self.setRingTime(0);
window.clearTimeout(self.timeout); window.clearInterval(self.time);
window.clearTimeout(self.timeout);
}
} }
//tap 保存二维码到相册 //tap 保存二维码到相册
......
...@@ -292,6 +292,7 @@ function sleep(time){ ...@@ -292,6 +292,7 @@ function sleep(time){
mui.back = function(){ mui.back = function(){
iot.navigator.fire(plus.webview.currentWebview().opener(),'returnPage',{}); iot.navigator.fire(plus.webview.currentWebview().opener(),'returnPage',{});
console.log("returnPage");
iot.navigator.back(); iot.navigator.back();
} }
......
...@@ -86,9 +86,15 @@ function initComponentsConfig() { ...@@ -86,9 +86,15 @@ function initComponentsConfig() {
} }
} }
mui.back = function() {
iot.navigator.fire(plus.webview.currentWebview().opener(), 'returnPage', {});
console.log("returnPage");
iot.navigator.back();
}
//tap < //tap <
function backTap(){ function backTap() {
iot.navigator.back(); iot.navigator.aback();
} }
function nameChange(self,text){ function nameChange(self,text){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment