Commit 6c368916 by 朱建香

2018/01/10 20:27

1.首页字符拼接【已完成】
2.远程开门有效时间更改【已完成】
3.门铃间隔时间缩短【已完成】
4.通知页面返回刷新页面【已完成】
5.邀请绑定优化【完成度:50%】
parent 6ff2e897
...@@ -115,7 +115,8 @@ ...@@ -115,7 +115,8 @@
"doorLockRinging": "门铃响了", "doorLockRinging": "门铃响了",
"defaultNewMsg": "您尚未绑定门锁", "defaultNewMsg": "您尚未绑定门锁",
"noNewMsg": "门锁休息中", "noNewMsg": "门锁休息中",
"bindDoorlock": "绑定门锁" "bindDoorlock": "绑定门锁",
"use": "使用"
}, },
"opendoorRecord":{ "opendoorRecord":{
"noRecordTip": "暂无记录", "noRecordTip": "暂无记录",
......
...@@ -26,17 +26,17 @@ export default { ...@@ -26,17 +26,17 @@ export default {
}, },
"model": "UGEN_SECURITY_SMARTDOOR_YJ2017", "model": "UGEN_SECURITY_SMARTDOOR_YJ2017",
"GET_MSG_INTERVAL": 5000, "GET_MSG_INTERVAL": 5000,
"wifi_add_timeout": 300000, "wifi_add_timeout": 3000,
//门铃晃动间隔时间 //门铃晃动间隔时间
"await_time": 5000, "await_time": 3000,
//门铃晃动次数 //门铃晃动次数
"shake_times": 5, "shake_times": 3,
//门锁晃动总时间 //门锁晃动总时间
"ring_time": 30000, "ring_time": 12000,
"remote_opendoor_timeout": 30000, "remote_opendoor_timeout": 30000,
//二维码失效时间 //二维码失效时间
"qrcode_timeout": 600000, "qrcode_timeout": 600000,
"remote_timeout": 300, "remote_timeout": 120,
"input":{ "input":{
"maxlength": 16 "maxlength": 16
}, },
......
...@@ -13,13 +13,14 @@ iot.ready(init); ...@@ -13,13 +13,14 @@ iot.ready(init);
function init() { function init() {
console.log("init" + new Date().getTime()); console.log("init" + new Date().getTime());
//通用 dialog、loading组件 //通用 dialog、loading组件
uPublic.componentsInit(['u-dialog','u-loading']); uPublic.componentsInit(['u-dialog','u-loading','u-process']);
// uPublic.closeSlideBack(); // uPublic.closeSlideBack();
const app = new Vue({ const app = new Vue({
data:{ data:{
//配置组件 //配置组件
componentsConfig: initComponentsConfig(), componentsConfig: initComponentsConfig(),
barcode: null barcode: null,
noticeTipShowFlag: false
}, },
mounted(){ mounted(){
let self = this; let self = this;
...@@ -34,6 +35,10 @@ function init() { ...@@ -34,6 +35,10 @@ function init() {
}else{ }else{
openScanCode(self); openScanCode(self);
} }
window.addEventListener('returnPage',() => {
this.noticeTipShowFlag = !iot.native.isNotifycationOpen();
addSuccess(this);
});
}, },
methods:{ methods:{
//tap < //tap <
...@@ -56,6 +61,12 @@ function initComponentsConfig() { ...@@ -56,6 +61,12 @@ function initComponentsConfig() {
initParam: { initParam: {
class: 'custom-loading' class: 'custom-loading'
} }
},
processLoading: {
initParam: {
class: 'custom-process',
status: 0
}
} }
} }
} }
...@@ -82,8 +93,14 @@ function openScanCode(self){ ...@@ -82,8 +93,14 @@ function openScanCode(self){
console.log(response); console.log(response);
let data = uPublic.checkResponseData(response.data); let data = uPublic.checkResponseData(response.data);
if(data){ if(data){
console.log(data.result.indexOf('qrKey'));
//扫描成功 //扫描成功
if(data.result.indexOf('qrKey') != -1){
uComponents.showProcess(self, 0, Vue.t('addDevice.loading'));
let result = JSON.parse(data.result); let result = JSON.parse(data.result);
console.log(result);
console.log(result.hasOwnProperty('qrKey'));
let qrKey = result.qrKey; let qrKey = result.qrKey;
let lockId = result.lockId; let lockId = result.lockId;
let relId = result.relId; let relId = result.relId;
...@@ -103,18 +120,18 @@ function openScanCode(self){ ...@@ -103,18 +120,18 @@ function openScanCode(self){
error: (error) => { error: (error) => {
//绑定失败 //绑定失败
console.log(error); console.log(error);
// if(window.iotDebug){ // if(window.iotDebug){
// iotDebug.push('end: 绑定失败'+JSON.stringify(error)); // iotDebug.push('end: 绑定失败'+JSON.stringify(error));
// } // }
// if (window.iotDebug) { // if (window.iotDebug) {
// iotDebug.upload(iot,'绑定失败'); // iotDebug.upload(iot,'绑定失败');
// } // }
uComponents.openAlert(self, Vue.t('addDevice.bindFailure'), { scanCodeFailue(self);
text: Vue.t('dialog.confirm'), callback: function () {
} }
}); });
}else{
scanCodeFailue(self);
} }
});
}else{} }else{}
}, },
error: (error) => { error: (error) => {
...@@ -126,7 +143,7 @@ function openScanCode(self){ ...@@ -126,7 +143,7 @@ function openScanCode(self){
// if (window.iotDebug) { // if (window.iotDebug) {
// iotDebug.upload(iot,'扫描失败'); // iotDebug.upload(iot,'扫描失败');
// } // }
uPublic.openRequestErrorAlert(self); scanCodeFailue(self);
} }
}); });
} }
...@@ -143,17 +160,18 @@ function deviceBind(self, lockId, relId){ ...@@ -143,17 +160,18 @@ function deviceBind(self, lockId, relId){
console.log(response); console.log(response);
let data = response.data; let data = response.data;
if(data.success){ if(data.success){
uComponents.openAlert(self, Vue.t('addDevice.bindSuccess'), { scanCodeSuccess(self);
text: Vue.t('dialog.confirm'), callback: function () { // uComponents.openAlert(self, Vue.t('addDevice.bindSuccess'), {
iot.navigator.fire(plus.webview.getWebviewById('device'),'returnPage',{ // text: Vue.t('dialog.confirm'), callback: function () {
needClose: true // iot.navigator.fire(plus.webview.getWebviewById('device'),'returnPage',{
}); // needClose: true
iot.navigator.openWindow({ // });
url: '../device/index.html', // iot.navigator.openWindow({
id: 'device' // url: '../device/index.html',
}); // id: 'device'
} // });
}); // }
// });
} }
}, },
error: (error) => { error: (error) => {
...@@ -172,3 +190,63 @@ function deviceBind(self, lockId, relId){ ...@@ -172,3 +190,63 @@ function deviceBind(self, lockId, relId){
complete: () => {} complete: () => {}
}); });
} }
function scanCodeSuccess(self){
self.noticeTipShowFlag = !iot.native.isNotifycationOpen();
if(self.noticeTipShowFlag){
uComponents.showProcess(self, 1, Vue.t('wifiAdd.deviceActivateSuccess'), [{
"class": 'custom-process-button', 'text': Vue.t('btn.openNotify'), 'callback': () => {
//开启推送通知
if(plus.os.name == 'Android'){
// alert("打开通知页面");
iot.navigator.openWindow({
url: '../device/notify.html',
id: 'notify',
styles: {
popGesture: 'none'
}
});
}else{
iot.native.toNotifycationSetting();
}
}
},{
"class": 'custom-process-button custom-process-cancelButton', 'text': Vue.t('btn.ignore'), 'callback': () => {
//暂不开启
uComponents.hideProcess(self);
iot.navigator.fire(plus.webview.getWebviewById('device'),'returnPage',{
needClose: true
});
iot.navigator.openWindow({
url: '../device/index.html',
id: 'device'
});
}
}]);
}else{
uComponents.showProcess(self, 1, Vue.t('wifiAdd.deviceActivateSuccess'), [{
"class": 'custom-process-button', 'text': Vue.t('btn.startNow'), 'callback': () => {
//立即体验
uComponents.hideProcess(self);
iot.navigator.fire(plus.webview.getWebviewById('device'),'returnPage',{
needClose: true
});
iot.navigator.openWindow({
url: '../device/index.html',
id: 'device'
});
}
}]);
}
}
function scanCodeFailue(self){
uComponents.showProcess(self, 2, Vue.t('wifiAdd.deviceActivateFailure'), [{
"class": 'custom-process-button', 'text': Vue.t('addDevice.reBindDevice'), 'callback': () => {
//激活失败
uComponents.hideProcess(self);
uComponents.showProcess(self, 0, Vue.t('addDevice.loading'));
openScanCode(self);
}
}]);
}
...@@ -24,10 +24,15 @@ function init() { ...@@ -24,10 +24,15 @@ function init() {
//配置组件 //配置组件
componentsConfig: initComponentsConfig(), componentsConfig: initComponentsConfig(),
status: 0, status: 0,
noticeTipShowFlag: false noticeTipShowFlag: false,
timeout: null
}, },
mounted(){ mounted(){
resolve(this); resolve(this);
window.addEventListener('returnPage',() => {
this.noticeTipShowFlag = !iot.native.isNotifycationOpen();
addSuccess(this);
});
}, },
methods:{ methods:{
getTextWiFiName(){ getTextWiFiName(){
...@@ -264,7 +269,7 @@ function connectButtonTap(self){ ...@@ -264,7 +269,7 @@ function connectButtonTap(self){
} }
}); });
} }
setTimeout(function (){ self.timeout = setTimeout(function (){
if(self.getStatus() == 0){ if(self.getStatus() == 0){
console.log("timeout"); console.log("timeout");
//连接失败 //连接失败
...@@ -277,6 +282,7 @@ function connectButtonTap(self){ ...@@ -277,6 +282,7 @@ function connectButtonTap(self){
success: (response) => {}, success: (response) => {},
error: (error) => {} error: (error) => {}
}); });
window.clearTimeout(self.timeout);
} }
},config.wifi_add_timeout); },config.wifi_add_timeout);
} }
...@@ -363,15 +369,13 @@ function addFailue(self){ ...@@ -363,15 +369,13 @@ function addFailue(self){
"class": 'custom-process-button', 'text': Vue.t('addDevice.reBindDevice'), 'callback': () => { "class": 'custom-process-button', 'text': Vue.t('addDevice.reBindDevice'), 'callback': () => {
//激活失败 //激活失败
uComponents.hideProcess(self); uComponents.hideProcess(self);
self.setStatus(0);
uComponents.changeCommLoadingStatusAndText(self, 0, Vue.t('addDevice.loading'));
} }
}]); }]);
} }
function addSuccess(self){ function addSuccess(self){
if(!iot.native.isNotifycationOpen()){ self.noticeTipShowFlag = !iot.native.isNotifycationOpen();
self.noticeTipShowFlag = true; if(self.noticeTipShowFlag){
uComponents.showProcess(self, 1, Vue.t('wifiAdd.deviceActivateSuccess'), [{ uComponents.showProcess(self, 1, Vue.t('wifiAdd.deviceActivateSuccess'), [{
"class": 'custom-process-button', 'text': Vue.t('btn.openNotify'), 'callback': () => { "class": 'custom-process-button', 'text': Vue.t('btn.openNotify'), 'callback': () => {
//开启推送通知 //开启推送通知
......
...@@ -30,6 +30,9 @@ function init() { ...@@ -30,6 +30,9 @@ function init() {
uComponents.showLoading(this); uComponents.showLoading(this);
this.noticeTipShowFlag = !iot.native.isNotifycationOpen(); this.noticeTipShowFlag = !iot.native.isNotifycationOpen();
resolve(this); resolve(this);
window.addEventListener('returnPage',() => {
this.noticeTipShowFlag = !iot.native.isNotifycationOpen();
});
}, },
methods:{ methods:{
getList(){ getList(){
......
...@@ -32,6 +32,9 @@ function init() { ...@@ -32,6 +32,9 @@ function init() {
uComponents.showLoading(this); uComponents.showLoading(this);
this.noticeTipShowFlag = !iot.native.isNotifycationOpen(); this.noticeTipShowFlag = !iot.native.isNotifycationOpen();
resolve(this); resolve(this);
window.addEventListener('returnPage',() => {
this.noticeTipShowFlag = !iot.native.isNotifycationOpen();
});
}, },
methods:{ methods:{
getList(){ getList(){
......
...@@ -548,7 +548,15 @@ function getLockInfoSuccess(self, data){ ...@@ -548,7 +548,15 @@ function getLockInfoSuccess(self, data){
let historyRecord = data.info.history; let historyRecord = data.info.history;
updateHistoryMap(self, historyRecord); updateHistoryMap(self, historyRecord);
//拼接首页滚动的三条记录 //拼接首页滚动的三条记录
let record = data.info.history.open; getTreenRecord(self, data.info.history.open);
}else{
uComponents.changeMarqueeText(self, [Vue.t('device.defaultNewMsg')]);
self.activeFlag = false;
}
}
//拼接首页滚动的三条记录
function getTreenRecord(self, record){
if(record && record.length){ if(record && record.length){
self.newMsg = []; self.newMsg = [];
for(let i=0; i< record.length; i++){ for(let i=0; i< record.length; i++){
...@@ -558,7 +566,7 @@ function getLockInfoSuccess(self, data){ ...@@ -558,7 +566,7 @@ function getLockInfoSuccess(self, data){
}else{ }else{
msg = record[i].nickname; msg = record[i].nickname;
} }
self.newMsg.push(moment(record[i].time).format("YY.MM.DD HH:mm") + msg + Vue.t('opendoorRecord.'+config.openDoorMode[record[i].mode]+'')); self.newMsg.push(moment(record[i].time).format("YY.MM.DD HH:mm")+ ' ' + msg + Vue.t('device.use') + Vue.t('opendoorRecord.'+config.openDoorMode[record[i].mode]+''));
} }
uComponents.changeMarqueeText(self, self.newMsg); uComponents.changeMarqueeText(self, self.newMsg);
if(self.newMsg.length >= 2){ if(self.newMsg.length >= 2){
...@@ -570,10 +578,6 @@ function getLockInfoSuccess(self, data){ ...@@ -570,10 +578,6 @@ function getLockInfoSuccess(self, data){
uComponents.changeMarqueeText(self, [Vue.t('device.noNewMsg')]); uComponents.changeMarqueeText(self, [Vue.t('device.noNewMsg')]);
self.activeFlag = false; self.activeFlag = false;
} }
}else{
uComponents.changeMarqueeText(self, [Vue.t('device.defaultNewMsg')]);
self.activeFlag = false;
}
} }
//获取设备的初始状态 //获取设备的初始状态
...@@ -633,6 +637,28 @@ async function updateHistoryMap(self, historyRecord){ ...@@ -633,6 +637,28 @@ async function updateHistoryMap(self, historyRecord){
if(openHistory.length && oldHistory.open.time < moment(openHistory[0].time).unix() && now - moment(openHistory[0].time).unix() < 3600){ if(openHistory.length && oldHistory.open.time < moment(openHistory[0].time).unix() && now - moment(openHistory[0].time).unix() < 3600){
newHistory.open.time = moment(openHistory[0].time).unix(); newHistory.open.time = moment(openHistory[0].time).unix();
newHistory.open.isReadFlag = false; newHistory.open.isReadFlag = false;
let record = openHistory;
if(record && record.length){
for(let i=0; i< record.length; i++){
let msg = '';
if(record[i].nickname == null){
msg = ' ID:' + record[i].openId;
}else{
msg = record[i].nickname;
}
self.newMsg.shift();
self.newMsg.push(moment(record[i].time).format("YY.MM.DD HH:mm")+ ' ' + msg + Vue.t('device.use') + Vue.t('opendoorRecord.'+config.openDoorMode[record[i].mode]+''));
}
uComponents.changeMarqueeText(self, self.newMsg);
if(self.newMsg.length >= 2){
self.activeFlag = true;
}else{
self.activeFlag = false;
}
}else{
uComponents.changeMarqueeText(self, [Vue.t('device.noNewMsg')]);
self.activeFlag = false;
}
} }
let historyType = ['alarm','notify']; let historyType = ['alarm','notify'];
...@@ -912,15 +938,15 @@ function simpleRingBell(self,i){ ...@@ -912,15 +938,15 @@ function simpleRingBell(self,i){
self.timeout = setTimeout(function(){ self.timeout = setTimeout(function(){
self.setDoorbellRingingFlag(false); self.setDoorbellRingingFlag(false);
window.clearTimeout(self.timeout); window.clearTimeout(self.timeout);
if(i>2){ if(i>=1){
window.clearInterval(self.time); window.clearInterval(self.time);
} }
},config.await_time*3/5); },config.await_time*3/5);
if(i>2){ if(i>=1){
window.clearInterval(self.time); window.clearInterval(self.time);
} }
},config.await_time*2/5); },config.await_time*2/5);
if(i>2){ if(i>=1){
window.clearInterval(self.time); window.clearInterval(self.time);
} }
} }
......
...@@ -83,8 +83,12 @@ function init() { ...@@ -83,8 +83,12 @@ function init() {
} }
} }
//重写mui.back
mui.back = function(){
iot.navigator.fire(plus.webview.currentWebview().opener(),'returnPage',{});
console.log("fire");
iot.navigator.back();
}
...@@ -31,6 +31,9 @@ function init() { ...@@ -31,6 +31,9 @@ function init() {
uComponents.showLoading(this); uComponents.showLoading(this);
this.noticeTipShowFlag = !iot.native.isNotifycationOpen(); this.noticeTipShowFlag = !iot.native.isNotifycationOpen();
resolve(this); resolve(this);
window.addEventListener('returnPage',() => {
this.noticeTipShowFlag = !iot.native.isNotifycationOpen();
});
}, },
methods:{ methods:{
getList(){ getList(){
......
...@@ -27,6 +27,14 @@ ...@@ -27,6 +27,14 @@
</div> </div>
<div class="scanContent" id="bcid" > <div class="scanContent" id="bcid" >
</div> </div>
<u-process ref="uprocess" :init-param="componentsConfig.processLoading.initParam">
<p class="loader"></p>
<p class="icon"></p>
<p class="noticeContent" v-show = "noticeTipShowFlag">
<span>&#xe637;</span>
<span v-html="$t('wifiAdd.noticeTip')"></span>
</p>
</u-process>
<u-dialog ref="udialog" :init-param="componentsConfig.dialog.initParam"></u-dialog> <u-dialog ref="udialog" :init-param="componentsConfig.dialog.initParam"></u-dialog>
<u-loading ref="uloading" :init-param="componentsConfig.loading.initParam"></u-loading> <u-loading ref="uloading" :init-param="componentsConfig.loading.initParam"></u-loading>
</div> </div>
......
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