Commit 4c01643a by 朱建香

1120

parent 21da8e70
......@@ -71,6 +71,7 @@ function init() {
lockId: null,
//获取用户的身份
role: null,
lockInfo: {},
//最新消息
newMsg: [],
//是否第一次获取门锁信息
......@@ -211,6 +212,12 @@ function init() {
setRole(bool){
this.role = bool;
},
getLockInfo(){
return this.lockInfo;
},
setLockInfo(info){
this.lockInfo = info;
},
getRemoteOpendoorShowFlag(){
return this.remoteOpendoorShowFlag;
},
......@@ -615,6 +622,7 @@ function getLockInfo(self){
//判断云端是否绑定
if(data.lock_id){
setValueOfSwitch(self, false);
self.setLockInfo(data);
self.setLockId(data.lock_id);
self.setRole(data.role);
if(self.isFirstGetLockInfo){
......@@ -818,10 +826,9 @@ function notificationListener(self) {
}, false);
// 应用从推送服务器接收到推送消息事件
plus.push.addEventListener('receive', function (msg) {
console.log("收到了receive");
alert("收到了receive");
pushAction(self, msg);
alert("receive"+JSON.stringify(msg));
// plus.push.createMessage(msg.content, msg.payload);
}, false);
}
......@@ -874,8 +881,9 @@ function doorlockManageTap(self){
extras: {
deviceId: self.deviceId,
uuid: self.getUuid(),
role: self.getRole(),
lockId: self.getLockId()
// role: self.getRole(),
// lockId: self.getLockId(),
lockInfo: self.getLockInfo()
}
});
}
......
......@@ -32,11 +32,11 @@ function init() {
extras: {},
unbindSucceess: false,
//门铃消息推送
valueDoorbell: true,
valueDoorbell: iot.navigator.getExtras().lockInfo.options[0],
//报警消息推送
valueAlarm: true,
valueAlarm: iot.navigator.getExtras().lockInfo.options[1],
//开发消息推送
valueOpendoor: true,
valueOpendoor: iot.navigator.getExtras().lockInfo.options[2],
role: null,
valueIsClear: true,
unbindShowDialog: false
......@@ -44,14 +44,14 @@ function init() {
mounted(){
this.extras = iot.navigator.getExtras();
console.log(this.extras);
this.role = this.extras.role;
this.role = this.extras.lockInfo.role;
//获取门锁
getDoorlockInfo(this);
// getDoorlockInfo(this);
//监听returnPage返回事件,重新获取最新数据
let self = this;
window.addEventListener('returnPage',function(event){
console.log("returnPage");
getDoorlockInfo(self);
// getDoorlockInfo(self);
});
},
......@@ -202,7 +202,7 @@ function getDoorlockInfo(self){
let productId = config.model;
iot.business.device.getInfo({
data: {
device_id: self.extras.lockId
device_id: self.extras.lockInfo.lock_id
},
success: (response) => {
console.log(response);
......@@ -275,7 +275,7 @@ function editNameTap(self){
url: './editName.html',
id: 'editName',
extras: {
lockId: self.extras.lockId,
lockId: self.extras.lockInfo.lock_id,
nickname: self.getTextNickname()
}
});
......@@ -323,7 +323,7 @@ function unbind(self){
iot.business.api.sendCustom('lock/unbind',{
data: {
device_sn: self.extras.deviceId,
device_id: self.extras.lockId,
device_id: self.extras.lockInfo.lock_id,
needDelInfo: self.getValueIsClear()
},
success: (response) => {
......@@ -393,7 +393,7 @@ function setOption(self){
iot.business.api.sendCustom('lock/setPushOption',
{
data: {
device_id: self.extras.lockId,
device_id: self.extras.lockInfo.lock_id,
opt_ring: self.getValueDoorbell(),
opt_alarm: self.getValueAlarm(),
opt_open: self.getValueOpendoor()
......
......@@ -23911,6 +23911,7 @@ function init() {
lockId: null,
//获取用户的身份
role: null,
lockInfo: {},
//最新消息
newMsg: [],
//是否第一次获取门锁信息
......@@ -24052,6 +24053,12 @@ function init() {
setRole: function setRole(bool) {
this.role = bool;
},
getLockInfo: function getLockInfo() {
return this.lockInfo;
},
setLockInfo: function setLockInfo(info) {
this.lockInfo = info;
},
getRemoteOpendoorShowFlag: function getRemoteOpendoorShowFlag() {
return this.remoteOpendoorShowFlag;
},
......@@ -24507,6 +24514,7 @@ function getLockInfo(self) {
//判断云端是否绑定
if (data.lock_id) {
setValueOfSwitch(self, false);
self.setLockInfo(data);
self.setLockId(data.lock_id);
self.setRole(data.role);
if (self.isFirstGetLockInfo) {
......@@ -24747,10 +24755,9 @@ function notificationListener(self) {
}, false);
// 应用从推送服务器接收到推送消息事件
plus.push.addEventListener('receive', function (msg) {
console.log("收到了receive");
alert("收到了receive");
pushAction(self, msg);
alert("receive" + JSON.stringify(msg));
// plus.push.createMessage(msg.content, msg.payload);
}, false);
}
......@@ -24799,8 +24806,9 @@ function doorlockManageTap(self) {
extras: {
deviceId: self.deviceId,
uuid: self.getUuid(),
role: self.getRole(),
lockId: self.getLockId()
// role: self.getRole(),
// lockId: self.getLockId(),
lockInfo: self.getLockInfo()
}
});
}
......
......@@ -45,11 +45,11 @@ function init() {
extras: {},
unbindSucceess: false,
//门铃消息推送
valueDoorbell: true,
valueDoorbell: _public.iot.navigator.getExtras().lockInfo.options[0],
//报警消息推送
valueAlarm: true,
valueAlarm: _public.iot.navigator.getExtras().lockInfo.options[1],
//开发消息推送
valueOpendoor: true,
valueOpendoor: _public.iot.navigator.getExtras().lockInfo.options[2],
role: null,
valueIsClear: true,
unbindShowDialog: false
......@@ -57,14 +57,14 @@ function init() {
mounted: function mounted() {
this.extras = _public.iot.navigator.getExtras();
console.log(this.extras);
this.role = this.extras.role;
this.role = this.extras.lockInfo.role;
//获取门锁
getDoorlockInfo(this);
// getDoorlockInfo(this);
//监听returnPage返回事件,重新获取最新数据
var self = this;
window.addEventListener('returnPage', function (event) {
console.log("returnPage");
getDoorlockInfo(self);
// getDoorlockInfo(self);
});
},
......@@ -219,7 +219,7 @@ function getDoorlockInfo(self) {
var productId = _config2.default.model;
_public.iot.business.device.getInfo({
data: {
device_id: self.extras.lockId
device_id: self.extras.lockInfo.lock_id
},
success: function success(response) {
console.log(response);
......@@ -292,7 +292,7 @@ function editNameTap(self) {
url: './editName.html',
id: 'editName',
extras: {
lockId: self.extras.lockId,
lockId: self.extras.lockInfo.lock_id,
nickname: self.getTextNickname()
}
});
......@@ -340,7 +340,7 @@ function unbind(self) {
_public.iot.business.api.sendCustom('lock/unbind', {
data: {
device_sn: self.extras.deviceId,
device_id: self.extras.lockId,
device_id: self.extras.lockInfo.lock_id,
needDelInfo: self.getValueIsClear()
},
success: function success(response) {
......@@ -409,7 +409,7 @@ function setOption(self) {
_public.uComponents.showLoading(self);
_public.iot.business.api.sendCustom('lock/setPushOption', {
data: {
device_id: self.extras.lockId,
device_id: self.extras.lockInfo.lock_id,
opt_ring: self.getValueDoorbell(),
opt_alarm: self.getValueAlarm(),
opt_open: self.getValueOpendoor()
......
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