Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DoorLock
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
朱建香
DoorLock
Commits
d66ebf1a
Commit
d66ebf1a
authored
Dec 18, 2017
by
jenny
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zjx' into 'master'
2017/12/18 See merge request iot-project-js/doorlock!6
parents
ec48f787
85f03e00
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
134 additions
and
62 deletions
+134
-62
dev/src/public/public.js
+133
-51
dev/src/view/device/v_index.js
+1
-11
No files found.
dev/src/public/public.js
View file @
d66ebf1a
...
@@ -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,62 +165,62 @@ iot.navigator.closeAll = function (){
...
@@ -165,62 +165,62 @@ 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
();
if
(
wbs
.
length
>
1
)
{
if
(
wbs
.
length
>
1
)
{
// console.log("不止一个webview...");
// console.log("不止一个webview...");
// return;
// return;
iot
.
navigator
.
back
();
iot
.
navigator
.
back
();
// console.log("有父webview...");
// console.log("有父webview...");
// return;
// parent.evalJS('iot.navigator.back()');
// parent.evalJS('mui&&mui.back();');
}
else
{
console
.
log
(
"只有一个webView"
);
// return;
wobj
.
canBack
(
function
(
e
)
{
console
.
log
(
"是否可以返回canback..."
);
console
.
log
(
window
.
history
);
// window.history.back();
console
.
log
(
e
);
//by chb 暂时注释,在碰到类似popover之类的锚点的时候,需多次点击才能返回;
if
(
e
.
canBack
)
{
//webview history back
console
.
log
(
"e.canback...."
);
// return;
// return;
// parent.evalJS('iot.navigator.back()');
// window.history.back();
// parent.evalJS('mui&&mui.back();');
// iot.navigator.back();
}
else
{
}
else
{
//webview close or hide
console
.
log
(
"只有一个webView"
);
console
.
log
(
"不能back。。。"
);
// return;
wobj
.
canBack
(
function
(
e
)
{
if
(
!
__back__first
)
{
console
.
log
(
"是否可以返回canback..."
);
__back__first
=
new
Date
().
getTime
();
console
.
log
(
window
.
history
);
console
.
log
(
"给back_first设值...."
);
window
.
history
.
back
();
plus
.
nativeUI
.
toast
(
"再按一次退出应用"
);
console
.
log
(
e
);
// mui.toast('再按一次退出应用');
//by chb 暂时注释,在碰到类似popover之类的锚点的时候,需多次点击才能返回;
setTimeout
(
function
()
{
if
(
e
.
canBack
)
{
//webview history back
__back__first
=
null
;
console
.
log
(
"e.canback...."
);
},
2000
);
// return;
}
else
{
window
.
history
.
back
();
console
.
log
(
"back_first不为空...."
);
// iot.navigator.back();
if
(
new
Date
().
getTime
()
-
__back__first
<
2000
)
{
}
else
{
//webview close or hide
console
.
log
(
"两次的间隔时间少于2秒"
);
console
.
log
(
"不能back。。。"
);
plus
.
runtime
.
quit
();
}
else
{
if
(
!
__back__first
)
{
console
.
log
(
"时间间隔大于2s"
);
__back__first
=
new
Date
().
getTime
();
}
console
.
log
(
"给back_first设值...."
);
plus
.
nativeUI
.
toast
(
"再按一次退出应用"
);
// mui.toast('再按一次退出应用');
setTimeout
(
function
()
{
__back__first
=
null
;
},
2000
);
}
else
{
console
.
log
(
"back_first不为空...."
);
if
(
new
Date
().
getTime
()
-
__back__first
<
2000
)
{
console
.
log
(
"两次的间隔时间少于2秒"
);
plus
.
runtime
.
quit
();
}
else
{
console
.
log
(
"时间间隔大于2s"
);
}
}
return
;
}
}
});
return
;
}
}
});
}
}
}
...
@@ -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
dev/src/view/device/v_index.js
View file @
d66ebf1a
...
@@ -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
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment