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
6f2fbc0d
Commit
6f2fbc0d
authored
Dec 19, 2017
by
朱建香
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'remotes/origin/zhujianxiang' into zjx
parents
4131d18c
98765389
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
220 additions
and
77 deletions
+220
-77
dev/src/public/public.js
+100
-23
dev/src/public/unotify.js
+54
-5
dev/src/view/addDevice/v_wifiAdd.js
+1
-1
dev/src/view/device/v_alarmInfo.js
+1
-1
dev/src/view/device/v_hijackRecord.js
+1
-1
dev/src/view/device/v_index.js
+8
-2
dev/src/view/device/v_opendoorRecord.js
+1
-1
dev/src/view/doorlockManage/v_index.js
+1
-1
dev/src/view/doorlockUsers/v_addUnlockInfo.js
+1
-1
dev/src/view/doorlockUsers/v_doorlockUser.js
+1
-1
dev/src/view/doorlockUsers/v_index.js
+1
-1
dev/src/view/doorlockUsers/v_inviteBind.js
+5
-1
dev/src/view/login/v_index.js
+8
-1
dev/src/view/myInfo/v_editNickname.js
+1
-1
dev/src/view/myInfo/v_index.js
+36
-36
web/resources/lang/en.json
+0
-0
web/resources/lang/zh.json
+0
-0
No files found.
dev/src/public/public.js
View file @
6f2fbc0d
...
...
@@ -108,6 +108,45 @@ uPublic.closeSlideBack = function (){
});
}
//logout退出
uPublic
.
logout
=
function
(
opts
){
iot
.
business
.
user
.
logout
({
data
:
opts
.
data
,
success
:
(
response
)
=>
{
console
.
log
(
"sdsLogout:"
+
response
);
var
sdsResponse
=
response
;
iot
.
business
.
api
.
send
(
'user/logout'
,{
data
:
{
key
:
[
'clienId'
]
},
success
:
(
response
)
=>
{
console
.
log
(
"logout"
+
response
)
iot
.
business
.
websql
.
delMaps
([
'utoken'
,
'userinfo'
],
(
response
)
=>
{
iot
.
storage
.
delMaps
([
'notifyTime'
,
'alarmTime'
,
'openTime'
],
(
response
)
=>
{
console
.
log
(
"clearMap"
+
response
);
opts
.
success
(
sdsResponse
);
},
(
error
)
=>
{
opts
.
error
(
error
);
});
},
(
error
)
=>
{
opts
.
error
(
error
);
});
},
error
:
(
error
)
=>
{
opts
.
error
(
error
);
},
complete
:
()
=>
{
opts
.
complete
();
}
},
true
,
false
);
},
error
:
(
error
)
=>
{
opts
.
error
(
error
);
},
complete
:
()
=>
{}
});
}
iot
.
ready
(()
=>
{
uPublic
.
recalc
();
});
...
...
@@ -147,15 +186,20 @@ iot.navigator.trigger = function (element, eventType, eventData) {
};
iot
.
navigator
.
closeAllBesidesItself
=
function
()
{
setTimeout
(
function
()
{
var
wvs
=
plus
.
webview
.
all
();
var
curWb
=
plus
.
webview
.
currentWebview
();
for
(
var
i
=
0
;
i
<
wvs
.
length
-
1
;
i
++
)
{
if
(
wvs
[
i
].
id
!=
curWb
.
id
)
{
wvs
[
i
].
close
();
var
page
=
plus
.
webview
.
currentWebview
();
for
(
var
i
=
0
;
i
<
wvs
.
length
;
i
++
)
{
if
(
wvs
[
i
].
id
!=
page
.
id
&&
wvs
[
i
])
{
// wvs[i].close();
plus
.
webview
.
close
(
wvs
[
i
],
"none"
,
0
,{});
}
}
var
wvs
=
plus
.
webview
.
all
();
},
500
);
}
iot
.
navigator
.
closeAll
=
function
(){
var
wvs
=
plus
.
webview
.
all
();
var
curWb
=
plus
.
webview
.
currentWebview
();
...
...
@@ -165,9 +209,13 @@ iot.navigator.closeAll = function (){
}
iot
.
ready
(
function
(){
//
plus.key.addEventListener('backbutton',iot.navigator.aback,false);
plus
.
key
.
addEventListener
(
'backbutton'
,
iot
.
navigator
.
aback
,
false
);
})
iot
.
navigator
.
aback
=
function
(){
mui
.
back
();
}
var
__back__first
=
null
;
mui
.
back
=
function
(){
...
...
@@ -223,20 +271,22 @@ mui.back = function(){
}
}
iot
.
navigator
.
getCurrentWebView
=
function
(){
return
plus
.
webview
.
currentWebview
();
}
function
requestsend
(
url
,
opts
,
i
){
opts
.
success
(
i
);
}
function
clearTime
(
interval
,
timeout
){
window
.
clearInterval
(
interval
);
window
.
clearTimeout
(
timeout
);
}
//function requestsend(url, opts, i){
// let data = [0,0,0,0,0,0,0,1,0,0,0];
// opts.success(data[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;
...
...
@@ -246,7 +296,22 @@ function clearTime(interval, timeout){
// var intervalcb = interval.opts;
// var flag = true;
// var i = 0;
//
// time = setTimeout(function(){
// clearTime(handle, time);
// intervalcb.error('timeout');
// fincb.error('timeout');
// },timeout);
// //一开始执行一次,发送一次请求
// requestsend(url, {
// data: {},
// success: (response) => {
// intervalcb.success(response);
// if(stopcondition(response)){
// //首次请求结果符合条件的话,结束整个方法
// fincb.success(response);
// clearTime(handle, time);
// }else{
// //首次请求结果不符合条件的话,每隔intervalTime时间发送请求
// handle = setInterval(() => {
// i++;
// console.log(i);
...
...
@@ -263,20 +328,32 @@ function clearTime(interval, timeout){
// flag = true;
// },
// error: (error) => {
//
intervalcb.success(response
);
//
fincb.success
(error);
//
intervalcb.error(error
);
//
fincb.error
(error);
// clearTime(handle, time);
// },
// complete: {}
// }, i);
// }
// },intervalTime);
//
// time = setTimeout(function(){
// }
// },
// error: (error) => {
// intervalcb.error(error);
// fincb.error(error);
// clearTime(handle, time);
// },timeout);
// },
// complete: {}
// }, 0);
//
//}
//
////传递的参数依次是:
////1.request: 请求参数(数据类型: map,包括:url、header等);
////2.timeout: 整个方法的超时时间;
////3.interval: 发送请求的间隔时间、callback;
////4.fincb: 整个方法的callback;
////5.stopcondition: 请求停止所要符合的条件
//uComponents.loop({url:'getLockInfo',opts: {
// success: (response) => {
// console.log(response);
...
...
@@ -284,14 +361,14 @@ function clearTime(interval, timeout){
// error: (error) => {
// console.log(error);
// }
//}},
10
000, {
//}},
8
000, {
// delay: 1000,
// opts: {
// success: (response) => {
// console.log('intervalcbSuccess:'+response);
// },
// error: (error) => {
// console.log(error);
// console.log(
'intervalcbSuccess:'+
error);
// }
// }
//}, {
...
...
@@ -299,10 +376,10 @@ function clearTime(interval, timeout){
// console.log('fincbSuccess:'+response);
// },
// error: (error) => {
// console.log(error);
// console.log(
'fincbError'+
error);
// }
//}, (response) => {
// if(response ==
5
){
// if(response ==
1
){
// return true;
// }else{
// return false;
...
...
dev/src/public/unotify.js
View file @
6f2fbc0d
...
...
@@ -3,12 +3,19 @@
* unotify
*/
class
unotify
{
//在一个周期内获取cid
static
async
getCid
(
successCallback
,
errorCallback
){
var
a
=
null
;
var
cid
=
null
;
try
{
a
=
await
this
.
getCidPeriotic
(
3
);
//利用promise,直到执行完代码再获取cid
cid
=
await
this
.
getCidPeriotic
(
3
);
//获取后,在缓存中存储cid
if
(
typeof
successCallback
==
'function'
){
successCallback
(
a
);
iot
.
storage
.
setMap
(
'clientId'
,
cid
,
(
res
)
=>
{
console
.
log
(
"已成功保存cid"
+
cid
);
successCallback
(
cid
);
},
()
=>
{
});
}
}
catch
(
err
){
...
...
@@ -18,6 +25,7 @@ class unotify{
}
}
}
//周期性获取cid,周期可调整
static
getCidPeriotic
(
times
){
var
self
=
this
;
return
new
Promise
(
function
(
resolve
,
reject
){
...
...
@@ -26,14 +34,16 @@ class unotify{
var
handle
=
null
;
i
++
;
cid
=
self
.
getCidOnce
(
i
);
if
(
cid
!=
null
||
i
>=
times
){
console
.
log
(
"第"
+
i
+
"次"
+
"获取的cid为"
+
cid
);
if
(
cid
!=
null
&&
cid
!=
'null'
||
i
>=
times
){
window
.
clearInterval
(
handle
);
resolve
(
cid
);
}
else
{
handle
=
setInterval
(
function
(){
i
++
;
cid
=
self
.
getCidOnce
(
i
);
if
(
cid
!=
null
||
i
>=
times
){
console
.
log
(
"第"
+
i
+
"次"
+
"获取的cid为"
+
cid
);
if
(
cid
!=
null
&&
cid
!=
'null'
||
i
>=
times
){
window
.
clearInterval
(
handle
);
resolve
(
cid
);
}
...
...
@@ -41,13 +51,51 @@ class unotify{
}
});
}
//单次获取cid
static
getCidOnce
(
i
){
var
clientInfo
=
plus
.
push
.
getClientInfo
();
if
(
clientInfo
&&
clientInfo
.
hasOwnProperty
(
'clientid'
)
&&
clientInfo
.
clientid
){
// if(i == 6){
return
(
clientInfo
.
clientid
);
// }else{
// return(null);
// }
}
else
{
return
(
null
);
}
}
//长期不断循环获取cid,并更新cid
// static async getCid(successCallback, errorCallback){
// var cid = null;
// var oldCid = null;
// try{
// cid = await this.getCidPeriotic(9);
// if(cid != null && cid != oldCid){
// successCallback('cid updateSuccess');
// iot.business.api.send('user/updateCid',{
// data: {
// clienId: cid
// },
// success: (response) => {
// if(typeof successCallback == 'function'){
// uccessCallback('cid updateSuccess');
// }
// },
// error: (error) => {
// console.log(error);
// errorCallback(error);
// }
// }, true, false);
// }else{
// successCallback('cid not updated');
// }
// }
// catch (err){
// console.log(err);
// if(typeof errorCallback == 'function'){
// errorCallback(err);
// }
// }
// }
}
export
default
unotify
;
\ No newline at end of file
dev/src/view/addDevice/v_wifiAdd.js
View file @
6f2fbc0d
...
...
@@ -135,7 +135,7 @@ function passwordChange(self,text){
console
.
log
(
'passwordChange: '
+
self
.
textPassword
);
}
iot
.
navigator
.
a
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{
});
iot
.
navigator
.
back
();
}
...
...
dev/src/view/device/v_alarmInfo.js
View file @
6f2fbc0d
...
...
@@ -149,7 +149,7 @@ function backTap(){
iot
.
navigator
.
aback
();
}
iot
.
navigator
.
a
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
iot
.
navigator
.
back
();
...
...
dev/src/view/device/v_hijackRecord.js
View file @
6f2fbc0d
...
...
@@ -170,7 +170,7 @@ function backTap(){
iot
.
navigator
.
aback
();
}
iot
.
navigator
.
a
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
iot
.
navigator
.
back
();
...
...
dev/src/view/device/v_index.js
View file @
6f2fbc0d
...
...
@@ -18,6 +18,9 @@ function init() {
uPublic
.
closeSlideBack
();
//通用 图片轮播、跑马灯、开关、按钮、dialog、loading组件
uPublic
.
componentsInit
([
'u-carousel'
,
'u-marquee'
,
'u-switch'
,
'u-button'
,
'u-dialog'
,
'u-loading'
,
'u-text'
,
'u-comm-loading'
]);
if
(
iot
.
navigator
.
getExtras
().
needClose
){
iot
.
navigator
.
closeAllBesidesItself
();
}
const
app
=
new
Vue
({
data
:{
//开门记录
...
...
@@ -101,9 +104,9 @@ function init() {
remoteTime
:
null
},
mounted
(){
uComponents
.
showLoading
(
this
);
notificationListener
(
this
);
let
self
=
this
;
iot
.
navigator
.
closeAllBesidesItself
();
//获取设备信息
getDevices
(
this
);
//注册监听上报
...
...
@@ -482,6 +485,7 @@ function getDevices(self){
self
.
hijackAlarmFlag
=
false
;
self
.
setRemoteOpendoorDisabledFlag
(
true
);
self
.
setValueRemoteOpendoor
(
0
);
uComponents
.
hideLoading
(
self
);
}
},
error
:
(
error
)
=>
{
...
...
@@ -493,7 +497,8 @@ function getDevices(self){
iotDebug
.
upload
(
iot
,
'获取设备信息'
);
}
uPublic
.
openRequestErrorAlert
(
self
);
}
},
complete
:
()
=>
{}
});
}
...
...
@@ -714,6 +719,7 @@ function getLockInfo(self){
console
.
log
(
error
);
},
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
}
});
}
...
...
dev/src/view/device/v_opendoorRecord.js
View file @
6f2fbc0d
...
...
@@ -107,7 +107,7 @@ function backTap(){
iot
.
navigator
.
aback
();
}
iot
.
navigator
.
a
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
iot
.
navigator
.
back
();
...
...
dev/src/view/doorlockManage/v_index.js
View file @
6f2fbc0d
...
...
@@ -262,7 +262,7 @@ function backTap(){
iot
.
navigator
.
aback
();
}
iot
.
navigator
.
a
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
iot
.
navigator
.
back
();
...
...
dev/src/view/doorlockUsers/v_addUnlockInfo.js
View file @
6f2fbc0d
...
...
@@ -290,7 +290,7 @@ function sleep(time){
})
}
iot
.
navigator
.
a
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
iot
.
navigator
.
back
();
}
...
...
dev/src/view/doorlockUsers/v_doorlockUser.js
View file @
6f2fbc0d
...
...
@@ -292,7 +292,7 @@ function setUserInfo(self, data){
self
.
setUnbindShowFlag
(
data
.
user_id
?
true
:
false
);
}
iot
.
navigator
.
a
back
=
function
(){
mui
.
back
=
function
(){
let
opener
=
plus
.
webview
.
currentWebview
().
opener
();
if
(
opener
.
id
==
'addUser'
){
opener
.
close
();
...
...
dev/src/view/doorlockUsers/v_index.js
View file @
6f2fbc0d
...
...
@@ -209,7 +209,7 @@ function backTap(){
iot
.
navigator
.
aback
();
}
iot
.
navigator
.
a
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
iot
.
navigator
.
back
();
...
...
dev/src/view/doorlockUsers/v_inviteBind.js
View file @
6f2fbc0d
...
...
@@ -77,8 +77,12 @@ function initComponentsConfig() {
//tap <
function
backTap
(){
iot
.
navigator
.
aback
();
}
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
'returnPage'
);
console
.
log
(
"fire"
);
iot
.
navigator
.
back
();
}
...
...
dev/src/view/login/v_index.js
View file @
6f2fbc0d
...
...
@@ -15,6 +15,10 @@ function init() {
//通用 dialog、loading组件
uPublic
.
componentsInit
([
'u-dialog'
,
'u-loading'
,
'u-button'
]);
uPublic
.
closeSlideBack
();
//是否需要关闭其他页面
if
(
iot
.
navigator
.
getExtras
().
needClose
){
iot
.
navigator
.
closeAllBesidesItself
();
}
const
app
=
new
Vue
({
data
:{
//配置组件
...
...
@@ -193,7 +197,10 @@ function cloudsLogin(self, id){
iot
.
business
.
websql
.
setMaps
(
infoArray
,
()
=>
{
iot
.
navigator
.
openWindow
({
url
:
'../device/index.html'
,
id
:
'device'
id
:
'device'
,
extras
:
{
needClose
:
true
}
});
},
(
error
)
=>
{
console
.
log
(
error
);
...
...
dev/src/view/myInfo/v_editNickname.js
View file @
6f2fbc0d
...
...
@@ -108,7 +108,7 @@ function saveTap(self){
}
}
iot
.
navigator
.
aback
=
function
(){
mui
.
back
()
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{
});
iot
.
navigator
.
back
();
}
...
...
dev/src/view/myInfo/v_index.js
View file @
6f2fbc0d
...
...
@@ -108,12 +108,6 @@ function getInfo(self){
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 获取用户信息'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'获取用户信息');
// }
uPublic
.
openRequestErrorAlert
(
self
);
},
complete
:
()
=>
{}
...
...
@@ -125,49 +119,55 @@ function logoutButtonTap(self){
uComponents
.
openConfirm
(
self
,
Vue
.
t
(
'myInfo.logoutDialogTip'
),
{
text
:
Vue
.
t
(
'dialog.cancel'
),
callback
:
function
()
{}},
{
text
:
Vue
.
t
(
'dialog.confirm'
),
callback
:
function
()
{
// uPublic.logout({
// data: {
// sds: true
// },
// success: (response) => {
// console.log(response);
// iot.navigator.openWindow({
// url: '../login/index.html',
// id: 'login',
// extras: {
// needClose: true
// }
// });
// },
// error: (error) => {
// console.log(error);
// },
// complete: () => {}
// });
iot
.
business
.
user
.
logout
({
data
:
{
sds
:
true
},
data
:
{},
success
:
(
response
)
=>
{
console
.
log
(
"sdsLogout:"
+
response
);
let
sdsResponse
=
response
;
iot
.
business
.
websql
.
delMaps
([
'utoken'
,
'userinfo'
],
(
response
)
=>
{
console
.
log
(
response
);
iot
.
storage
.
delMaps
([
'notifyTime'
,
'alarmTime'
,
'openTime'
],
(
response
)
=>
{
console
.
log
(
"clearMap"
+
response
);
//打开首页
iot
.
navigator
.
openWindow
({
url
:
'../login/index.html'
,
id
:
'login'
,
extras
:
{
needClose
:
true
}
});
},
(
error
)
=>
{
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 清除tocken失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'清除tocken失败');
// }
uPublic
.
openRequestErrorAlert
(
self
);
});
iot
.
storage
.
delMaps
([
'notifyTime'
,
'alarmTime'
,
'openTime'
],
(
response
)
=>
{
console
.
log
(
response
);
},
()
=>
{
});
iot
.
navigator
.
openWindow
({
url
:
'../login/index.html'
,
id
:
'login'
},
(
error
)
=>
{
console
.
log
(
error
);
uPublic
.
openRequestErrorAlert
(
self
);
});
let
wvs
=
plus
.
webview
.
all
();
for
(
var
i
=
0
;
i
<
wvs
.
length
-
1
;
i
++
)
{
plus
.
webview
.
close
(
wvs
[
i
]);
}
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: 退出登陆失败'
+
JSON
.
stringify
(
error
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
,
'退出登陆失败'
);
}
uPublic
.
openRequestErrorAlert
(
self
);
},
complete
:
()
=>
{
console
.
log
(
"complete"
);
}
complete
:
()
=>
{}
});
}}
);
...
...
web/resources/lang/en.json
View file @
6f2fbc0d
This diff is collapsed.
Click to expand it.
web/resources/lang/zh.json
View file @
6f2fbc0d
This diff is collapsed.
Click to expand it.
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