Commit 85f03e00 by 朱建香

2017/12/18

1.android双击返回按钮返回,mui.back重写
2.设备绑定成功回到首页后,关闭其他页面
parent ad0e7efa
...@@ -148,11 +148,11 @@ iot.navigator.trigger = function (element, eventType, eventData) { ...@@ -148,11 +148,11 @@ iot.navigator.trigger = function (element, eventType, eventData) {
iot.navigator.closeAllBesidesItself = function () { iot.navigator.closeAllBesidesItself = function () {
var wvs = plus.webview.all(); var wvs = plus.webview.all();
// var curWb = plus.webview.currentWebview(); var curWb = plus.webview.currentWebview();
for (var i = 0; i < wvs.length-1; i++) { for (var i = 0; i < wvs.length-1; i++) {
// if (wvs[i].id != curWb.id) { if (wvs[i].id != curWb.id) {
wvs[i].close(); wvs[i].close();
// } }
} }
} }
...@@ -165,12 +165,12 @@ iot.navigator.closeAll = function (){ ...@@ -165,12 +165,12 @@ iot.navigator.closeAll = function (){
} }
iot.ready(function(){ iot.ready(function(){
plus.key.addEventListener('backbutton',iot.navigator.aback,false); // plus.key.addEventListener('backbutton',iot.navigator.aback,false);
}) })
var __back__first = null; var __back__first = null;
iot.navigator.aback =function(){ mui.back = function(){
var wobj = plus.webview.currentWebview(); var wobj = plus.webview.currentWebview();
var parent = wobj.parent(); var parent = wobj.parent();
var wbs = iot.navigator.getAllWebviw(); var wbs = iot.navigator.getAllWebviw();
...@@ -188,13 +188,13 @@ iot.navigator.aback =function(){ ...@@ -188,13 +188,13 @@ iot.navigator.aback =function(){
wobj.canBack(function(e) { wobj.canBack(function(e) {
console.log("是否可以返回canback..."); console.log("是否可以返回canback...");
console.log(window.history); console.log(window.history);
window.history.back(); // window.history.back();
console.log(e); console.log(e);
//by chb 暂时注释,在碰到类似popover之类的锚点的时候,需多次点击才能返回; //by chb 暂时注释,在碰到类似popover之类的锚点的时候,需多次点击才能返回;
if (e.canBack) { //webview history back if (e.canBack) { //webview history back
console.log("e.canback...."); console.log("e.canback....");
// return; // return;
window.history.back(); // window.history.back();
// iot.navigator.back(); // iot.navigator.back();
} else { //webview close or hide } else { //webview close or hide
console.log("不能back。。。"); console.log("不能back。。。");
...@@ -228,4 +228,85 @@ iot.navigator.getCurrentWebView = function (){ ...@@ -228,4 +228,85 @@ iot.navigator.getCurrentWebView = function (){
return plus.webview.currentWebview(); return plus.webview.currentWebview();
} }
function requestsend(url, opts, i){
opts.success(i);
}
function clearTime(interval, timeout){
window.clearInterval(interval);
window.clearTimeout(timeout);
}
//uComponents.loop = function(request, timeout, interval, fincb, stopcondition){
// var handle = null;
// var time = null;
// var url = request.url;
// var opts = request.opts;
// var intervalTime = interval.delay;
// var intervalcb = interval.opts;
// var flag = true;
// var i = 0;
//
// handle = setInterval(() => {
// i++;
// console.log(i);
// if(flag){
// flag = false;
// requestsend(url, {
// data: {},
// success: (response) => {
// intervalcb.success(response);
// if(stopcondition(response)){
// fincb.success(response);
// clearTime(handle, time);
// }
// flag = true;
// },
// error: (error) => {
// intervalcb.success(response);
// fincb.success(error);
// clearTime(handle, time);
// },
// complete: {}
// }, i);
// }
// },intervalTime);
//
// time = setTimeout(function(){
// clearTime(handle, time);
// },timeout);
//}
//
//uComponents.loop({url:'getLockInfo',opts: {
// success: (response) => {
// console.log(response);
// },
// error: (error) => {
// console.log(error);
// }
//}}, 10000, {
// delay: 1000,
// opts: {
// success: (response) => {
// console.log('intervalcbSuccess:'+response);
// },
// error: (error) => {
// console.log(error);
// }
// }
//}, {
// success: (response) => {
// console.log('fincbSuccess:'+response);
// },
// error: (error) => {
// console.log(error);
// }
//}, (response) => {
// if(response == 5){
// return true;
// }else{
// return false;
// }
//});
export {iot, uPublic, uComponents} export {iot, uPublic, uComponents}
\ No newline at end of file
...@@ -113,18 +113,8 @@ function init() { ...@@ -113,18 +113,8 @@ function init() {
getDevices(self); getDevices(self);
//注册监听上报 //注册监听上报
registerPushListener(self); registerPushListener(self);
iot.navigator.closeAllBesidesItself();
}); });
// uPublic.loopUtils(function(){
// console.log('1233434');
// }, {
// success: (response) => {
// console.log('success');
// },
// error: (err) => {
// console.log(err);
// }
// }, 1, 30000);
// ringBell(this);sss
}, },
methods:{ methods:{
setValueRemoteOpendoor(value){ setValueRemoteOpendoor(value){
......
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