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
felix
DoorLock
Commits
ca597bec
Commit
ca597bec
authored
Dec 26, 2017
by
朱建香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2017/12/26
#1.轮询方法完善(已完成) 2.整理less #4.getCid用通用方法调用(已完成)
parent
c605af96
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
228 additions
and
186 deletions
+228
-186
dev/src/public/uloop.js
+24
-11
dev/src/public/unotify.js
+70
-20
dev/src/view/device/v_index.js
+10
-3
dev/src/view/doorlockUsers/v_index.js
+1
-31
dev/src/view/doorlockUsers/v_inviteBind.js
+24
-18
dev/src/view/login/v_index.js
+5
-27
dev/src/view/myInfo/v_index.js
+0
-20
web/lib/less/addDevice/addDevice.less
+1
-0
web/lib/less/device/device.less
+12
-0
web/lib/less/doorlockManage/doorlockManage.less
+5
-0
web/lib/less/doorlockUsers/doorlockUser.less
+6
-0
web/lib/less/doorlockUsers/unlockInfo.less
+2
-2
web/view/device/device.css
+17
-5
web/view/doorlockManage/doorlockManage.css
+46
-45
web/view/doorlockUsers/doorlockUser.css
+5
-4
web/view/doorlockUsers/unlockInfo.css
+0
-0
No files found.
dev/src/public/loop.js
→
dev/src/public/
u
loop.js
View file @
ca597bec
...
...
@@ -12,7 +12,7 @@ class Loop{
// this.url = params.request.url;
// this.opts = params.request.opts;
this
.
loopContent
=
params
.
loopContent
;
this
.
timeout
=
params
.
timeout
|
3
0
;
this
.
timeout
=
params
.
timeout
|
|
1
0
;
this
.
fincb
=
params
.
fincb
;
this
.
intervalTime
=
params
.
interval
.
delay
;
this
.
intervalcb
=
params
.
interval
.
cb
;
...
...
@@ -74,15 +74,15 @@ class Loop{
start
(){
console
.
log
(
"开始"
);
this
.
time
=
setTimeout
(()
=>
{
this
.
clearTime
();
this
.
canDo
=
false
;
this
.
fincb
.
error
(
'timeout'
);
this
.
fincb
.
complete
();
console
.
log
(
"超时"
);
this
.
intervalcb
=
null
;
this
.
fincb
=
null
;
},
this
.
timeout
);
//
this.time = setTimeout(() => {
//
this.clearTime();
//
this.canDo = false;
//
this.fincb.error('timeout');
//
this.fincb.complete();
//
console.log("超时");
//
this.intervalcb = null;
//
this.fincb = null;
//
},this.timeout);
console
.
log
(
"第"
+
this
.
i
+
"次发送了请求"
);
console
.
log
(
"发送时间"
+
new
Date
().
getTime
());
this
.
i
++
;
...
...
@@ -96,9 +96,22 @@ class Loop{
this
.
sendRequest
();
}
},
1000
);
let
times
=
1
;
this
.
handle
=
setInterval
(()
=>
{
times
++
;
console
.
log
(
'times'
+
times
);
if
(
times
>
this
.
timeout
){
this
.
clearTime
();
this
.
canDo
=
false
;
this
.
fincb
.
error
(
'timeout'
);
this
.
fincb
.
complete
();
this
.
intervalcb
=
null
;
this
.
fincb
=
null
;
}
else
{
this
.
canDo
=
true
;
},
3000
);
}
},
this
.
intervalTime
);
}
}
...
...
dev/src/public/unotify.js
View file @
ca597bec
...
...
@@ -2,10 +2,12 @@
* @class
* unotify
*/
import
uloop
from
'./uloop'
;
class
unotify
{
//在一个周期内获取cid
static
async
getCid
(
successCallback
,
errorCallback
){
UpdateCid
((
response
)
=>
{
static
getCid
(
successCallback
,
errorCallback
){
this
.
UpdateCid
((
response
)
=>
{
successCallback
(
response
);
},
(
error
)
=>
{
errorCallback
(
error
);
...
...
@@ -13,28 +15,76 @@ class unotify{
}
//周期性获取cid,周期可调整
static
getCidPeriotic
(
times
){
// var self = this;
// return new Promise(function(resolve, reject){
// var i = 0;
// var cid = null;
// var handle = null;
// i++;
// cid = self.getCidOnce(i);
// 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);
// console.log("第"+i+"次"+"获取的cid为"+cid);
// if(cid != null && cid != 'null' || i >= times){
// window.clearInterval(handle);
// resolve(cid);
// }
// },1000);
// }
// });
var
self
=
this
;
return
new
Promise
(
function
(
resolve
,
reject
){
var
i
=
0
;
var
cid
=
null
;
var
handle
=
null
;
i
++
;
cid
=
self
.
getCidOnce
(
i
);
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
);
console
.
log
(
"第"
+
i
+
"次"
+
"获取的cid为"
+
cid
);
if
(
cid
!=
null
&&
cid
!=
'null'
||
i
>=
times
){
window
.
clearInterval
(
handle
);
resolve
(
cid
);
new
uloop
({
loopContent
:
()
=>
{
// var urlParams = {
// type: 'get',
// data: {},
// };
// return iot.network.send('http://192.168.2.75:3000/get', urlParams);
console
.
log
(
self
.
getCidOnce
());
return
self
.
getCidOnce
();
},
timeout
:
times
,
interval
:{
delay
:
1000
,
cb
:
{
success
:
(
response
)
=>
{
console
.
log
(
'intervalcbSuccess:'
+
JSON
.
stringify
(
response
));
},
error
:
(
error
)
=>
{
console
.
log
(
'intervalcbError:'
+
JSON
.
stringify
(
error
));
}
}
},
fincb
:
{
success
:
(
response
)
=>
{
console
.
log
(
'fincbSuccess:'
+
JSON
.
stringify
(
response
));
resolve
(
response
);
},
error
:
(
error
)
=>
{
console
.
log
(
'fincbSuccess:'
+
JSON
.
stringify
(
error
));
if
(
error
==
'timeout'
){
resolve
(
null
);
}
},
complete
:
()
=>
{}
},
stopcondition
:
async
(
response
)
=>
{
// if(response.data.msg == 5){
// return true;
// }
if
(
response
!=
null
&&
response
!=
'null'
){
return
true
;
}
},
1000
);
}
}).
start
();
});
}
//单次获取cid
...
...
dev/src/view/device/v_index.js
View file @
ca597bec
...
...
@@ -12,7 +12,8 @@ import moment from 'moment';
import
crypto
from
'../../public/crypto.js'
;
import
config
from
'../../public/config.js'
;
import
{
iot
,
uPublic
,
uComponents
}
from
'../../public/public.js'
;
import
Loop
from
'../../public/loop.js'
;
import
uloop
from
'../../public/uloop.js'
;
import
unotify
from
'../../public/unotify.js'
;
iot
.
ready
(
init
);
function
init
()
{
...
...
@@ -112,6 +113,11 @@ function init() {
getDevices
(
this
);
//注册监听上报
registerPushListener
(
this
);
unotify
.
getCid
((
response
)
=>
{
console
.
log
(
response
);
},(
error
)
=>
{
console
.
log
(
error
);
});
let
self
=
this
;
window
.
addEventListener
(
'returnPage'
,
function
(
event
){
console
.
log
(
'returnPage'
);
...
...
@@ -500,6 +506,7 @@ function getLockInfo(self){
},
error
:
(
error
)
=>
{
uPublic
.
openRequestErrorAlert
(
self
);
initDeviceInfo
(
self
);
console
.
log
(
error
);
},
complete
:
()
=>
{
...
...
@@ -670,7 +677,7 @@ async function loopGetLockInfo(self, delay, timeout){
console
.
log
(
error
);
}
console
.
log
(
oldHistoryId
);
new
L
oop
({
new
ul
oop
({
loopContent
:
()
=>
{
var
urlParams
=
{
type
:
'post'
,
...
...
@@ -682,7 +689,7 @@ async function loopGetLockInfo(self, delay, timeout){
return
iot
.
business
.
api
.
send
(
'lock/getNewInfo'
,
urlParams
,
true
,
false
);
// return plus.push.getClientInfo().clientid;
},
timeout
:
config
.
getHistoryTime
*
1000
,
timeout
:
3
,
interval
:{
delay
:
config
.
intervalTime
*
1000
,
cb
:
{
...
...
dev/src/view/doorlockUsers/v_index.js
View file @
ca597bec
...
...
@@ -77,14 +77,6 @@ function init() {
setRole
(
role
){
this
.
role
=
role
;
},
//
// onSwipeLeftRow(index){
// swipeLeftRow(this, index);
// },
// onSwipeRightRow(){
// swipeRightRow(this);
// },
//
onTapLoad
(){
// tapLoad();
},
...
...
@@ -132,12 +124,6 @@ function getUserList(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
:
()
=>
{
...
...
@@ -146,7 +132,6 @@ function getUserList(self){
});
}
//
function
sortRule
(
a
,
b
){
return
a
.
role
-
b
.
role
;
}
...
...
@@ -228,16 +213,7 @@ function addUserTap(self){
}
});
}
//
//// 向左滑动用户列表,修改用户列表下标
//function swipeLeftRow(self, index) {
// self.userListIndex = index;
//}
//// 向右滑动用户列表,修改用户列表下标
//function swipeRightRow(self) {
// self.userListIndex = null;
//}
//
// 点击组件列表 通知事件和当前点击列表下标
function
onTapUserList
(
self
,
listIndex
)
{
iot
.
navigator
.
openWindow
({
...
...
@@ -291,12 +267,6 @@ function deleteUser(self, index){
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 删除用户失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'删除用户失败');
// }
uComponents
.
openAlert
(
self
,
Vue
.
t
(
'doorlockUser.deleteFailure'
),
{
text
:
Vue
.
t
(
'btn.confirm'
),
callback
:
function
()
{
}
...
...
dev/src/view/doorlockUsers/v_inviteBind.js
View file @
ca597bec
...
...
@@ -98,6 +98,30 @@ function qrcodeButtonTap(self){
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
let
qrKey
=
response
.
data
.
qrKey
;
createQrcode
(
self
,
qrKey
);
}
else
{}
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: 生成二维码失败'
+
JSON
.
stringify
(
error
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
,
'生成二维码失败'
);
}
//请求失败
uPublic
.
openRequestErrorAlert
(
self
);
},
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
}
});
setTimeout
(()
=>
{
self
.
setQrCodeDisabled
(
true
);
},
config
.
qrcode_timeout
)
}
function
createQrcode
(
self
,
qrKey
){
let
data
=
{
qrKey
:
qrKey
,
lockId
:
self
.
extras
.
lockId
,
...
...
@@ -113,7 +137,6 @@ function qrcodeButtonTap(self){
console
.
log
(
error
)
}
else
{
console
.
log
(
'success'
);
uComponents
.
hideLoading
(
self
);
qr
.
style
.
width
=
"5.333rem"
;
qr
.
style
.
height
=
"5.333rem"
;
console
.
log
(
qr
.
style
);
...
...
@@ -122,21 +145,4 @@ function qrcodeButtonTap(self){
},
qrcode_timeout
);
}
});
}
else
{}
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: 生成二维码失败'
+
JSON
.
stringify
(
error
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
,
'生成二维码失败'
);
}
//请求失败
uPublic
.
openRequestErrorAlert
(
self
);
}
});
setTimeout
(()
=>
{
self
.
setQrCodeDisabled
(
true
);
},
config
.
qrcode_timeout
)
}
dev/src/view/login/v_index.js
View file @
ca597bec
...
...
@@ -8,7 +8,7 @@
*/
import
{
iot
,
uPublic
,
uComponents
}
from
'../../public/public.js'
;
import
unotify
from
'../../public/unotify.js'
;
iot
.
ready
(
init
);
function
init
()
{
...
...
@@ -31,9 +31,6 @@ function init() {
iotDebug
.
push
(
'start: Debug'
);
}
var
self
=
this
;
// unotify.getCid(function(ret){
// console.log(ret);
// self.setClientId(ret);
if
(
plus
.
os
.
name
==
'Android'
)
{
iot
.
permission
.
checkPermission
([
'READ_EXTERNAL_STORAGE'
],
function
(
res
)
{
console
.
log
(
'success'
,
res
);
...
...
@@ -44,10 +41,6 @@ function init() {
}
else
{
loginButtonTap
(
self
);
}
// },function(err){
// console.log(err);
// })
console
.
log
(
'innnnnnn'
);
},
methods
:{
getShowLoginButtonFlag
(){
...
...
@@ -93,23 +86,8 @@ function initComponentsConfig() {
}
}
//sds登陆
function
loginButtonTap
(
self
){
// if(window.iotDebug){
// iotDebug.push('start: initSDSLogin');
// }
// window.SDSPlugin.login({},(res)=>{
// console.log(res);
//// alert(res);
// var data = uPublic.checkResponseData(res.data);
// if(data){
//// alert("sds登陆成功");
// cloudsLogin(self, data.UserID);
// }
// },(err)=>{
// alert(error);
// console.log(err);
// })
console
.
log
(
"loginButton"
);
iot
.
business
.
sds
.
checkSDSInit
({
data
:
{},
success
:
(
response
)
=>
{
...
...
@@ -168,9 +146,9 @@ console.log("loginButton");
},
complete
:
()
=>
{}
});
}
//云端登陆
function
cloudsLogin
(
self
,
id
){
uComponents
.
showLoading
(
self
);
if
(
window
.
iotDebug
){
...
...
@@ -179,8 +157,8 @@ function cloudsLogin(self, id){
iot
.
business
.
api
.
send
(
'user/sds_login'
,{
data
:
{
username
:
id
,
clienId
:
self
.
getClientId
()
//
clienId: null
//
clienId: self.getClientId()
clienId
:
null
},
success
:
(
response
)
=>
{
if
(
window
.
iotDebug
){
...
...
dev/src/view/myInfo/v_index.js
View file @
ca597bec
...
...
@@ -119,26 +119,6 @@ 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: () => {}
// });
console
.
log
(
"logout"
);
iot
.
business
.
user
.
logout
({
data
:
{
// sds: false
...
...
web/lib/less/addDevice/addDevice.less
View file @
ca597bec
...
...
@@ -187,6 +187,7 @@
.custom-comm-loading();
//
.scanContent {
position: fixed;
top: 1.173rem;
...
...
web/lib/less/device/device.less
View file @
ca597bec
...
...
@@ -469,3 +469,14 @@
.remoteOpendoorPage{
.mask(1051,@BODY-BG-COLOR);
}
//
.custom-marquee .u-marquee-text {
display: block;
line-height: 0.96rem;
}
.active .u-marquee-text {
-webkit-animation: none;
animation: none;
}
\ No newline at end of file
web/lib/less/doorlockManage/doorlockManage.less
View file @
ca597bec
...
...
@@ -220,6 +220,11 @@
}
}
//
.nameDisabled:before{
display: none;
}
.custom-isClearSwitch-switch {
width: 5.333rem;
height: auto;
...
...
web/lib/less/doorlockUsers/doorlockUser.less
View file @
ca597bec
...
...
@@ -329,3 +329,8 @@
}
.mediaPosition(true);
//
.userInfo-title-disabled:after {
display: none;
}
\ No newline at end of file
web/lib/less/doorlockUsers/unlockInfo.less
View file @
ca597bec
...
...
@@ -224,14 +224,14 @@
&.u-switch-on .u-switch-handle{
background-color: transparent;
&:before{
content: '\e6a
9
';
content: '\e6a
a
';
left: 0;
}
}
&.u-switch-off .u-switch-handle{
background-color: transparent;
&:before{
content: '\e6a
a
';
content: '\e6a
9
';
left: 0;
}
}
...
...
web/view/device/device.css
View file @
ca597bec
...
...
@@ -1199,7 +1199,7 @@ p {
}
.u-marquee
.u-marquee-text
{
/*display: inline-block;*/
display
:
inline-block
;
line-height
:
0.667rem
;
}
...
...
@@ -1212,6 +1212,7 @@ p {
.custom-marquee
.u-marquee-text
{
line-height
:
0.96rem
;
display
:
block
;
}
.custom-marquee
:before
{
...
...
@@ -1248,7 +1249,7 @@ p {
color
:
#91929a
;
}
/*
.active .u-marquee-text {
.active
.u-marquee-text
{
-webkit-animation
:
marquee
5s
linear
infinite
;
animation
:
marquee
5s
linear
infinite
;
}
...
...
@@ -1263,9 +1264,9 @@ p {
-webkit-transform
:
translate
(
0
,
-100%
);
transform
:
translate
(
0
,
-100%
);
}
}
*/
}
/*
@keyframes marquee {
@keyframes
marquee
{
from
{
-webkit-transform
:
translate
(
0
,
0.533rem
);
transform
:
translate
(
0
,
0.533rem
);
...
...
@@ -1275,7 +1276,7 @@ p {
-webkit-transform
:
translate
(
0
,
-100%
);
transform
:
translate
(
0
,
-100%
);
}
}
*/
}
.deviceHandle
{
position
:
absolute
;
...
...
@@ -1621,3 +1622,13 @@ p {
z-index
:
1051
;
background-color
:
#242635
;
}
.custom-marquee
.u-marquee-text
{
display
:
block
;
line-height
:
0.96rem
;
}
.active
.u-marquee-text
{
-webkit-animation
:
none
;
animation
:
none
;
}
\ No newline at end of file
web/view/doorlockManage/doorlockManage.css
View file @
ca597bec
...
...
@@ -849,10 +849,6 @@ p {
line-height
:
1
;
}
.nameDisabled
:before
{
display
:
none
;
}
.doorlockManage
li
:after
{
content
:
''
;
position
:
absolute
;
...
...
@@ -958,47 +954,8 @@ p {
left
:
0
;
}
.unbindState-dialog
{
position
:
fixed
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
100%
;
z-index
:
1051
;
background-color
:
rgba
(
36
,
38
,
53
,
0.9
);
}
.unbindState-dialog
div
{
position
:
absolute
;
top
:
50%
;
left
:
50%
;
-webkit-transform
:
translate
(
-50%
,
-50%
);
transform
:
translate
(
-50%
,
-50%
);
width
:
8.933rem
;
height
:
5.68rem
;
display
:
-webkit-box
;
display
:
-webkit-flex
;
display
:
flex
;
-webkit-box-orient
:
vertical
;
-webkit-flex-direction
:
column
;
flex-direction
:
column
;
-webkit-box-pack
:
center
;
-webkit-justify-content
:
center
;
justify-content
:
center
;
-webkit-box-align
:
center
;
-webkit-align-items
:
center
;
align-items
:
center
;
color
:
#00ffff
;
font-size
:
0.427rem
;
border
:
1px
solid
;
border-radius
:
0.133rem
;
}
.unbindState-dialog
div
img
{
display
:
block
;
width
:
1.733rem
;
height
:
1.733rem
;
margin-bottom
:
0.373rem
;
.nameDisabled
:before
{
display
:
none
;
}
.custom-isClearSwitch-switch
{
...
...
@@ -1061,3 +1018,46 @@ p {
content
:
'\e6a9'
;
left
:
0
;
}
.unbindState-dialog
{
position
:
fixed
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
100%
;
z-index
:
1051
;
background-color
:
rgba
(
36
,
38
,
53
,
0.9
);
}
.unbindState-dialog
div
{
position
:
absolute
;
top
:
50%
;
left
:
50%
;
-webkit-transform
:
translate
(
-50%
,
-50%
);
transform
:
translate
(
-50%
,
-50%
);
width
:
8.933rem
;
height
:
5.68rem
;
display
:
-webkit-box
;
display
:
-webkit-flex
;
display
:
flex
;
-webkit-box-orient
:
vertical
;
-webkit-flex-direction
:
column
;
flex-direction
:
column
;
-webkit-box-pack
:
center
;
-webkit-justify-content
:
center
;
justify-content
:
center
;
-webkit-box-align
:
center
;
-webkit-align-items
:
center
;
align-items
:
center
;
color
:
#00ffff
;
font-size
:
0.427rem
;
border
:
1px
solid
;
border-radius
:
0.133rem
;
}
.unbindState-dialog
div
img
{
display
:
block
;
width
:
1.733rem
;
height
:
1.733rem
;
margin-bottom
:
0.373rem
;
}
\ No newline at end of file
web/view/doorlockUsers/doorlockUser.css
View file @
ca597bec
...
...
@@ -723,10 +723,6 @@ p {
line-height
:
1
;
}
.userInfo-title-disabled
:after
{
display
:
none
;
}
.userInfoLink
li
.userInfo
.userInfo-subtitle
{
position
:
relative
;
}
...
...
@@ -1099,3 +1095,7 @@ p {
bottom
:
1.2rem
;
}
}
.userInfo-title-disabled
:after
{
display
:
none
;
}
\ No newline at end of file
web/view/doorlockUsers/unlockInfo.css
View file @
ca597bec
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