Commit 4c01643a by 朱建香

1120

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