Commit 1fce6e3b by 朱建香

1207bug修改

parent 5c2f0a53
...@@ -44,6 +44,8 @@ export default { ...@@ -44,6 +44,8 @@ export default {
"maxlength": 6 "maxlength": 6
}, },
"ringBell_timeout": 300, "ringBell_timeout": 300,
// "audioUrl": "../../resources/audio/tipSound.mp3" "intervalTime": 3,
"audioUrl": "_www/resources/audio/tipSound.mp3" "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() { ...@@ -96,7 +96,8 @@ function init() {
status: 0, status: 0,
flag: true, flag: true,
time: null, time: null,
timeout: null timeout: null,
handle: null
}, },
mounted(){ mounted(){
notificationListener(this); notificationListener(this);
...@@ -434,11 +435,12 @@ function initComponentsConfig() { ...@@ -434,11 +435,12 @@ function initComponentsConfig() {
} }
function loopGetLockInfo(self, delay, timeout){ function loopGetLockInfo(self, delay, timeout){
var handle = setInterval(function(){ self.handle = setInterval(function(){
getLockInfo(self); getLockInfo(self);
},delay*1000); },delay*1000);
setTimeout(function () { let time = setTimeout(function () {
window.clearInterval(handle); window.clearInterval(self.handle);
window.clearTimeout(time);
}, timeout * 1000); }, timeout * 1000);
} }
...@@ -483,6 +485,7 @@ function getDevices(self){ ...@@ -483,6 +485,7 @@ function getDevices(self){
self.deviceId = null; self.deviceId = null;
self.uuid = null; self.uuid = null;
uComponents.changeMarqueeText(self, [Vue.t('device.defaultNewMsg')]); uComponents.changeMarqueeText(self, [Vue.t('device.defaultNewMsg')]);
// console.log("不滚");
self.activeFlag = false; self.activeFlag = false;
self.opendoorRecordFlag = false; self.opendoorRecordFlag = false;
self.securityAlarmFlag = false; self.securityAlarmFlag = false;
...@@ -555,7 +558,7 @@ async function getRecordTime(self, data){ ...@@ -555,7 +558,7 @@ async function getRecordTime(self, data){
if(self.notifyTime){ if(self.notifyTime){
console.log("notifyTime"+newNotifyTime.diff(self.notifyTime, 'seconds')); console.log("notifyTime"+newNotifyTime.diff(self.notifyTime, 'seconds'));
self.notifyTime = moment(self.notifyTime,moment.ISO_8601); 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.securityAlarmFlag = true;
self.notifyTime = newNotifyTime; self.notifyTime = newNotifyTime;
} }
...@@ -569,7 +572,7 @@ async function getRecordTime(self, data){ ...@@ -569,7 +572,7 @@ async function getRecordTime(self, data){
if(self.alarmTime){ if(self.alarmTime){
self.alarmTime = moment(self.alarmTime,moment.ISO_8601); self.alarmTime = moment(self.alarmTime,moment.ISO_8601);
console.log("Alarm"+newAlarmTime.diff(self.alarmTime, 'seconds')); 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.hijackAlarmFlag = true;
self.alarmTime = newAlarmTime; self.alarmTime = newAlarmTime;
} }
...@@ -583,7 +586,7 @@ async function getRecordTime(self, data){ ...@@ -583,7 +586,7 @@ async function getRecordTime(self, data){
if(self.openTime){ if(self.openTime){
self.openTime = moment(self.openTime,moment.ISO_8601); self.openTime = moment(self.openTime,moment.ISO_8601);
console.log("openTime"+newOpenTime.diff(self.openTime, 'seconds')); 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.opendoorRecordFlag = true;
self.openTime = newOpenTime; self.openTime = newOpenTime;
} }
...@@ -658,7 +661,7 @@ function getDeviceStatus(self){ ...@@ -658,7 +661,7 @@ function getDeviceStatus(self){
}); });
} }
function getLockInfo(self){ function getLockInfo(self){
console.log("getLockInfo"); console.log("getLockInfo");
iot.business.api.sendCustom('lock/getLockInfo',{ iot.business.api.sendCustom('lock/getLockInfo',{
data: { data: {
...@@ -706,17 +709,21 @@ function getLockInfo(self){ ...@@ -706,17 +709,21 @@ function getLockInfo(self){
// } // }
uComponents.changeMarqueeText(self, self.newMsg); uComponents.changeMarqueeText(self, self.newMsg);
if(self.newMsg.length >= 2){ if(self.newMsg.length >= 2){
// console.log("滚");
self.activeFlag = true; self.activeFlag = true;
}else{ }else{
// console.log("不滚");
self.activeFlag = false; self.activeFlag = false;
} }
}else{ }else{
uComponents.changeMarqueeText(self, [Vue.t('device.noNewMsg')]); uComponents.changeMarqueeText(self, [Vue.t('device.noNewMsg')]);
// console.log("不滚");
self.activeFlag = false; self.activeFlag = false;
// self.setRingingTime(null); // self.setRingingTime(null);
} }
}else{ }else{
uComponents.changeMarqueeText(self, [Vue.t('device.defaultNewMsg')]); uComponents.changeMarqueeText(self, [Vue.t('device.defaultNewMsg')]);
// console.log("不滚");
self.activeFlag = false; self.activeFlag = false;
} }
}else{ }else{
...@@ -726,6 +733,7 @@ function getLockInfo(self){ ...@@ -726,6 +733,7 @@ function getLockInfo(self){
self.deviceId = null; self.deviceId = null;
self.uuid = null; self.uuid = null;
uComponents.changeMarqueeText(self, [Vue.t('device.defaultNewMsg')]); uComponents.changeMarqueeText(self, [Vue.t('device.defaultNewMsg')]);
// console.log("不滚");
self.activeFlag = false; self.activeFlag = false;
self.opendoorRecordFlag = false; self.opendoorRecordFlag = false;
self.securityAlarmFlag = false; self.securityAlarmFlag = false;
...@@ -764,7 +772,6 @@ function setDevceInfo(self, data) { ...@@ -764,7 +772,6 @@ function setDevceInfo(self, data) {
if(data.action.value == 'notify'){ if(data.action.value == 'notify'){
if(data.notify_type.value == 104){ if(data.notify_type.value == 104){
//门铃响了 //门铃响了
let now = moment(); let now = moment();
let time = moment(data.time.value, "YY-MM-DD-hh-mm-ss"); let time = moment(data.time.value, "YY-MM-DD-hh-mm-ss");
console.log('门铃时间差'+now.diff(time,'seconds')+'timeout'+config.ringBell_timeout); console.log('门铃时间差'+now.diff(time,'seconds')+'timeout'+config.ringBell_timeout);
...@@ -788,12 +795,12 @@ function setDevceInfo(self, data) { ...@@ -788,12 +795,12 @@ function setDevceInfo(self, data) {
} }
}else if(notifyMode.indexOf(data.notify_type.value) != -1){ }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')){ 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'){ if(data.lock_action.value == '4'){
uComponents.changeCommLoadingStatusAndText(self, 1, Vue.t('remoteOpendoor.openDoorSuccess')); uComponents.changeCommLoadingStatusAndText(self, 1, Vue.t('remoteOpendoor.openDoorSuccess'));
uComponents.changeCommButtonText(self, Vue.t('btn.confirm')); uComponents.changeCommButtonText(self, Vue.t('btn.confirm'));
...@@ -809,6 +816,45 @@ function setDevceInfo(self, data) { ...@@ -809,6 +816,45 @@ function setDevceInfo(self, data) {
self.setStatus(2); 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){ function ringBell(self){
window.clearInterval(self.time); window.clearInterval(self.time);
window.clearTimeout(self.timeout); window.clearTimeout(self.timeout);
...@@ -902,6 +948,23 @@ function pushAction(self, msg) { ...@@ -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) { function notificationListener(self) {
if (plus.os.name == 'Android') { if (plus.os.name == 'Android') {
setInterval(function () { setInterval(function () {
...@@ -971,6 +1034,9 @@ function doorlockManageTap(self){ ...@@ -971,6 +1034,9 @@ function doorlockManageTap(self){
function opendoorRecordTap(self){ function opendoorRecordTap(self){
let now = moment(new Date()); let now = moment(new Date());
if(self.valueOpendoorRecord){ if(self.valueOpendoorRecord){
if(self.hijackAlarmFlag){
window.clearInterval(self.handle);
}
self.opendoorRecordFlag = false; self.opendoorRecordFlag = false;
setRecordTime('openTime', now.toISOString()); setRecordTime('openTime', now.toISOString());
iot.navigator.openWindow({ iot.navigator.openWindow({
...@@ -988,6 +1054,9 @@ function securityAlarmTap(self){ ...@@ -988,6 +1054,9 @@ function securityAlarmTap(self){
let now = moment(new Date()); let now = moment(new Date());
if(self.valueSecurityAlarm){ if(self.valueSecurityAlarm){
if(self.notifyTime != null){ if(self.notifyTime != null){
if(self.hijackAlarmFlag){
window.clearInterval(self.handle);
}
self.securityAlarmFlag = false; self.securityAlarmFlag = false;
setRecordTime('notifyTime', now.toISOString()); setRecordTime('notifyTime', now.toISOString());
} }
...@@ -1030,6 +1099,7 @@ function remoteOpendoorTap(self){ ...@@ -1030,6 +1099,7 @@ function remoteOpendoorTap(self){
// }); // });
// } // }
if(self.valueRemoteOpendoor){ if(self.valueRemoteOpendoor){
self.setTextPassword('');
self.setRemoteOpendoorShowFlag(true); self.setRemoteOpendoorShowFlag(true);
// self.setValueRemoteOpendoor(false); // self.setValueRemoteOpendoor(false);
// self.setRemoteOpendoorDisabledFlag(true); // self.setRemoteOpendoorDisabledFlag(true);
...@@ -1042,6 +1112,9 @@ function hijackAlarmTap(self){ ...@@ -1042,6 +1112,9 @@ function hijackAlarmTap(self){
if(self.valueHijackAlarm){ if(self.valueHijackAlarm){
console.log(self.alarmTime); console.log(self.alarmTime);
if(self.alarmTime != null){ if(self.alarmTime != null){
if(self.hijackAlarmFlag){
window.clearInterval(self.handle);
}
self.hijackAlarmFlag = false; self.hijackAlarmFlag = false;
setRecordTime('alarmTime', now.toISOString()); setRecordTime('alarmTime', now.toISOString());
} }
...@@ -1085,6 +1158,8 @@ function confirmButtonTap(self){ ...@@ -1085,6 +1158,8 @@ function confirmButtonTap(self){
self.setTextErrorTip(Vue.t('remoteOpendoor.error.noPasswordTip')); self.setTextErrorTip(Vue.t('remoteOpendoor.error.noPasswordTip'));
}else{ }else{
uComponents.showCommLoading(self); uComponents.showCommLoading(self);
self.setStatus(0);
uComponents.changeCommLoadingStatusAndText(self, 0, Vue.t('remoteOpendoor.loading'));
console.log(self.mac); console.log(self.mac);
let keyIv = crypto.enkey(self.mac.replace(/:/g,'')); let keyIv = crypto.enkey(self.mac.replace(/:/g,''));
console.log(keyIv); console.log(keyIv);
...@@ -1146,12 +1221,9 @@ function commLoadingButtonTap(self){ ...@@ -1146,12 +1221,9 @@ function commLoadingButtonTap(self){
console.log("1111"); console.log("1111");
uComponents.hideCommLoading(self); uComponents.hideCommLoading(self);
self.setRemoteOpendoorShowFlag(false); self.setRemoteOpendoorShowFlag(false);
}else if(self.getStatus() == 2){ }else if(self.getStatus() == 2){
//绑定失败 //绑定失败
uComponents.hideCommLoading(self); 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