Commit f1b5ce2d by 朱建香

点击远程开门通知,远程开门按钮亮起并可点击

parent 5e05a281
......@@ -15,6 +15,8 @@ import config from '../../public/config.js';
import {iot, uPublic, uComponents} from '../../public/public.js';
import uloop from '../../public/uloop.js';
import unotify from '../../public/unotify.js';
const Emitter = require('events').EventEmitter ;
let emit = new Emitter();
const ON_LINE = 'on';
const OFF_LINE = 'off';
......@@ -635,6 +637,8 @@ function getLockInfoSuccess(self, data){
}
//拼接首页滚动的三条记录
getTreenRecord(self, data.info.history.open);
emit.emit('getLockInfoSuccess');
}else{
uComponents.changeMarqueeText(self, [Vue.t('device.defaultNewMsg')]);
self.activeFlag = false;
......@@ -921,7 +925,7 @@ function registerPushListener(self){
}
if (window.iotDebug) {
iotDebug.upload(iot,'监听消息');
iotDebug = [];
iotDebug.clear();
}
},
error: (error) => {
......@@ -1048,10 +1052,10 @@ function setRemoteOpendoor(self, time){
iotDebug.push('end: 远程开门'+'设备当前时间'+now.unix()+'通知时间'+time.unix());
}
console.log(now.diff(time,'seconds'));
if(window.iotDebug){
iotDebug.push('end: 远程开门'+now.diff(time,'seconds')+'权限'+self.getRole()+'');
iotDebug.push('end: 远程开门时间差:'+now.diff(time,'seconds')+'权限:'+self.getRole()+'');
}
if(now.diff(time,'seconds') < config.pushMsg_timeout && now.diff(time,'seconds') >= 0 && (self.getRole() == 0)){
if(window.iotDebug){
iotDebug.push('end: 远程开门'+'进入展示');
......@@ -1081,7 +1085,7 @@ function setRemoteOpendoor(self, time){
}
if (window.iotDebug) {
iotDebug.upload(iot,'远程开门');
iotDebug = [];
iotDebug.clear();
}
}
......@@ -1158,7 +1162,7 @@ function pushAction(self, msg) {
}
//推送消息处理方法
function notifyDataProcessing(self, payload){
async function notifyDataProcessing(self, payload){
switch(payload.type){
// case 'open':
// case 'notify':
......@@ -1173,20 +1177,32 @@ function notifyDataProcessing(self, payload){
break;
case 'remoteOpen':
//远程开门
console.log("innnnremoteOPen");
await waitGetLockInfo();
setRemoteOpendoor(self, payload.time);
break;
}
}
function waitGetLockInfo(){
return new Promise((r,j) => {
emit.on("getLockInfoSuccess", () =>{
r();
})
});
}
function notificationListener(self) {
// 从系统消息中心点击消息启动应用事件
plus.push.addEventListener('click', function (msg) {
console.log("点击推送");
console.log(msg);
if(window.iotDebug){
iotDebug.push('end: 点击通知'+JSON.stringify(msg));
}
if (window.iotDebug) {
iotDebug.upload(iot,'点击通知');
iotDebug = [];
iotDebug.clear();
}
pushAction(self, msg);
}, false);
......@@ -1197,7 +1213,7 @@ function notificationListener(self) {
}
if (window.iotDebug) {
iotDebug.upload(iot,'接收通知');
iotDebug = [];
iotDebug.clear();
}
}, false);
}
......
......@@ -9,6 +9,11 @@ UIOT_Debug.prototype.push = function (key) {
time: time
});
};
UIOT_Debug.prototype.clear = function () {
this.logData = [];
}
UIOT_Debug.prototype.upload = function (iot,title) {
var logData = this.logData;
// console.log(logData);
......
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