Commit 1fce6e3b by 朱建香

1207bug修改

parent 5c2f0a53
......@@ -44,6 +44,8 @@ export default {
"maxlength": 6
},
"ringBell_timeout": 300,
// "audioUrl": "../../resources/audio/tipSound.mp3"
"audioUrl": "_www/resources/audio/tipSound.mp3"
"intervalTime": 3,
"getHistoryTime": 10,
"audioUrl": "../../resources/audio/tipSound.mp3"
// "audioUrl": "_www/resources/audio/tipSound.mp3"
}
\ No newline at end of file
......@@ -96,7 +96,8 @@ function init() {
status: 0,
flag: true,
time: null,
timeout: null
timeout: null,
handle: null
},
mounted(){
notificationListener(this);
......@@ -434,11 +435,12 @@ function initComponentsConfig() {
}
function loopGetLockInfo(self, delay, timeout){
var handle = setInterval(function(){
self.handle = setInterval(function(){
getLockInfo(self);
},delay*1000);
setTimeout(function () {
window.clearInterval(handle);
let time = setTimeout(function () {
window.clearInterval(self.handle);
window.clearTimeout(time);
}, timeout * 1000);
}
......@@ -483,6 +485,7 @@ function getDevices(self){
self.deviceId = null;
self.uuid = null;
uComponents.changeMarqueeText(self, [Vue.t('device.defaultNewMsg')]);
// console.log("不滚");
self.activeFlag = false;
self.opendoorRecordFlag = false;
self.securityAlarmFlag = false;
......@@ -555,7 +558,7 @@ async function getRecordTime(self, data){
if(self.notifyTime){
console.log("notifyTime"+newNotifyTime.diff(self.notifyTime, 'seconds'));
self.notifyTime = moment(self.notifyTime,moment.ISO_8601);
if(newNotifyTime != null && newNotifyTime.diff(self.notifyTime, 'seconds') > 0){
if(newNotifyTime != null && newNotifyTime.diff(self.notifyTime, 'seconds') >= 0){
self.securityAlarmFlag = true;
self.notifyTime = newNotifyTime;
}
......@@ -569,7 +572,7 @@ async function getRecordTime(self, data){
if(self.alarmTime){
self.alarmTime = moment(self.alarmTime,moment.ISO_8601);
console.log("Alarm"+newAlarmTime.diff(self.alarmTime, 'seconds'));
if(newAlarmTime != null && newAlarmTime.diff(self.alarmTime, 'seconds') > 0){
if(newAlarmTime != null && newAlarmTime.diff(self.alarmTime, 'seconds') >= 0){
self.hijackAlarmFlag = true;
self.alarmTime = newAlarmTime;
}
......@@ -583,7 +586,7 @@ async function getRecordTime(self, data){
if(self.openTime){
self.openTime = moment(self.openTime,moment.ISO_8601);
console.log("openTime"+newOpenTime.diff(self.openTime, 'seconds'));
if(newOpenTime != null && newOpenTime.diff(self.openTime, 'seconds') > 0){
if(newOpenTime != null && newOpenTime.diff(self.openTime, 'seconds') >= 0){
self.opendoorRecordFlag = true;
self.openTime = newOpenTime;
}
......@@ -706,17 +709,21 @@ function getLockInfo(self){
// }
uComponents.changeMarqueeText(self, self.newMsg);
if(self.newMsg.length >= 2){
// console.log("滚");
self.activeFlag = true;
}else{
// console.log("不滚");
self.activeFlag = false;
}
}else{
uComponents.changeMarqueeText(self, [Vue.t('device.noNewMsg')]);
// console.log("不滚");
self.activeFlag = false;
// self.setRingingTime(null);
}
}else{
uComponents.changeMarqueeText(self, [Vue.t('device.defaultNewMsg')]);
// console.log("不滚");
self.activeFlag = false;
}
}else{
......@@ -726,6 +733,7 @@ function getLockInfo(self){
self.deviceId = null;
self.uuid = null;
uComponents.changeMarqueeText(self, [Vue.t('device.defaultNewMsg')]);
// console.log("不滚");
self.activeFlag = false;
self.opendoorRecordFlag = false;
self.securityAlarmFlag = false;
......@@ -764,7 +772,6 @@ function setDevceInfo(self, data) {
if(data.action.value == 'notify'){
if(data.notify_type.value == 104){
//门铃响了
let now = moment();
let time = moment(data.time.value, "YY-MM-DD-hh-mm-ss");
console.log('门铃时间差'+now.diff(time,'seconds')+'timeout'+config.ringBell_timeout);
......@@ -788,12 +795,12 @@ function setDevceInfo(self, data) {
}
}else if(notifyMode.indexOf(data.notify_type.value) != -1){
loopGetLockInfo(self, 1, 10);
loopGetLockInfo(self, config.intervalTime, config.getHistoryTime);
}
}
if(data.action.value == 'lock_log' && (data.lock_action.value == '1' || data.lock_action.value == '4')){
//开门或远程开门成功
loopGetLockInfo(self, 1, 10);
loopGetLockInfo(self, config.intervalTime, config.getHistoryTime);
if(data.lock_action.value == '4'){
uComponents.changeCommLoadingStatusAndText(self, 1, Vue.t('remoteOpendoor.openDoorSuccess'));
uComponents.changeCommButtonText(self, Vue.t('btn.confirm'));
......@@ -809,6 +816,45 @@ function setDevceInfo(self, data) {
self.setStatus(2);
}
}
////sds消息处理方法
//function notifyDataProcessing(self, data){
// //
// if(data.BatteryPercentage){
// //设置门铃电量
// }
// switch(data.action.value){
// case 'notify':
// switch(data.notify_type.value){
// case '104':
// //门铃
// break;
// case '5':
// //远程开门请求
// break;
// case '1' || '2' || '3':
// //防撬、试错、欠电报警
// //轮循获取最新的历史记录
// break;
// }
// break;
// case 'lock_log':
// switch(data.lock_action.value){
// case '4':
// //切换轮循loading样式
//
// case '1':
// //轮循获取最新的历史记录
//
// break;
// }
// break;
// }
// if(data.ErrorCode.value == 1){
// //远程开门失败
// }
//}
function ringBell(self){
window.clearInterval(self.time);
window.clearTimeout(self.timeout);
......@@ -902,6 +948,23 @@ function pushAction(self, msg) {
}
}
////推送消息处理方法
//function notifyDataProcessing(self, msgType){
// switch(msgType){
// case 'open' || 'notify' || 'alarm':
// //开门推送、安全报警、劫持报警
// //历史记录信息只拿一遍,不需要轮询
// getLockInfo(self);
// break;
// case 'ring':
// //门铃
// break;
// case 'remoteOpen':
// //远程开门
// break;
// }
//}
function notificationListener(self) {
if (plus.os.name == 'Android') {
setInterval(function () {
......@@ -971,6 +1034,9 @@ function doorlockManageTap(self){
function opendoorRecordTap(self){
let now = moment(new Date());
if(self.valueOpendoorRecord){
if(self.hijackAlarmFlag){
window.clearInterval(self.handle);
}
self.opendoorRecordFlag = false;
setRecordTime('openTime', now.toISOString());
iot.navigator.openWindow({
......@@ -988,6 +1054,9 @@ function securityAlarmTap(self){
let now = moment(new Date());
if(self.valueSecurityAlarm){
if(self.notifyTime != null){
if(self.hijackAlarmFlag){
window.clearInterval(self.handle);
}
self.securityAlarmFlag = false;
setRecordTime('notifyTime', now.toISOString());
}
......@@ -1030,6 +1099,7 @@ function remoteOpendoorTap(self){
// });
// }
if(self.valueRemoteOpendoor){
self.setTextPassword('');
self.setRemoteOpendoorShowFlag(true);
// self.setValueRemoteOpendoor(false);
// self.setRemoteOpendoorDisabledFlag(true);
......@@ -1042,6 +1112,9 @@ function hijackAlarmTap(self){
if(self.valueHijackAlarm){
console.log(self.alarmTime);
if(self.alarmTime != null){
if(self.hijackAlarmFlag){
window.clearInterval(self.handle);
}
self.hijackAlarmFlag = false;
setRecordTime('alarmTime', now.toISOString());
}
......@@ -1085,6 +1158,8 @@ function confirmButtonTap(self){
self.setTextErrorTip(Vue.t('remoteOpendoor.error.noPasswordTip'));
}else{
uComponents.showCommLoading(self);
self.setStatus(0);
uComponents.changeCommLoadingStatusAndText(self, 0, Vue.t('remoteOpendoor.loading'));
console.log(self.mac);
let keyIv = crypto.enkey(self.mac.replace(/:/g,''));
console.log(keyIv);
......@@ -1146,12 +1221,9 @@ function commLoadingButtonTap(self){
console.log("1111");
uComponents.hideCommLoading(self);
self.setRemoteOpendoorShowFlag(false);
}else if(self.getStatus() == 2){
//绑定失败
uComponents.hideCommLoading(self);
self.setStatus(0);
uComponents.changeCommLoadingStatusAndText(self, 0, Vue.t('remoteOpendoor.loading'));
}
}
......
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