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
22735af2
Commit
22735af2
authored
Nov 23, 2017
by
朱建香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1123
parent
6ea9af5f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
86 deletions
+75
-86
dev/src/view/device/v_index.js
+8
-6
dev/src/view/login/v_index.js
+57
-73
web/lib/js/SDSPlugin.js
+0
-0
web/lib/js/start.js
+1
-1
web/view/device/index.js
+8
-6
web/view/login/index.html
+1
-0
web/view/login/index.js
+0
-0
No files found.
dev/src/view/device/v_index.js
View file @
22735af2
...
...
@@ -697,12 +697,14 @@ function getLockInfo(self){
//设置设备信息
function
setDevceInfo
(
self
,
data
)
{
console
.
log
(
data
);
self
.
setBatteryPercent
(
data
.
BatteryPercentage
.
value
);
if
(
data
.
BatteryPercentage
.
value
>=
10
){
//向上取整
self
.
setBatteryState
(
config
.
powerIcon
[
Math
.
ceil
(
data
.
BatteryPercentage
.
value
/
20
)]);
}
else
{
self
.
setBatteryState
(
config
.
powerIcon
[
Math
.
round
(
data
.
BatteryPercentage
.
value
/
20
)]);
if
(
data
.
BatteryPercentage
){
self
.
setBatteryPercent
(
data
.
BatteryPercentage
.
value
);
if
(
data
.
BatteryPercentage
.
value
>=
10
){
//向上取整
self
.
setBatteryState
(
config
.
powerIcon
[
Math
.
ceil
(
data
.
BatteryPercentage
.
value
/
20
)]);
}
else
{
self
.
setBatteryState
(
config
.
powerIcon
[
Math
.
round
(
data
.
BatteryPercentage
.
value
/
20
)]);
}
}
if
(
data
.
action
.
value
==
'notify'
){
if
(
data
.
notify_type
.
value
==
104
){
...
...
dev/src/view/login/v_index.js
View file @
22735af2
...
...
@@ -21,15 +21,17 @@ function init() {
showLoginButtonFlag
:
true
},
mounted
(){
// loginButtonTap(this);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'start: Debug'
);
}
var
self
=
this
;
if
(
plus
.
os
.
name
==
'Android'
)
{
iot
.
permission
.
checkPermission
([
'READ_EXTERNAL_STORAGE'
],
function
(
res
)
{
console
.
log
(
'success'
,
res
);
var
clientInfo
=
plus
.
push
.
getClientInfo
();
self
.
setClientId
(
clientInfo
.
clientid
);
self
.
setClientId
(
clientInfo
.
clientid
);
loginButtonTap
(
self
);
},
function
(
err
)
{
console
.
log
(
'error'
,
err
);
...
...
@@ -83,79 +85,60 @@ function initComponentsConfig() {
}
function
loginButtonTap
(
self
){
uComponents
.
showLoading
(
self
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'start: initSDSLogin'
);
}
iot
.
business
.
sds
.
init
({
data
:
{
oa
:
true
},
success
:
(
response
)
=>
{
console
.
log
(
response
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: initSDSLoginSuccess'
);
}
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'start: SDSlogin'
);
}
iot
.
business
.
user
.
login
({
data
:
{
sds
:
true
},
success
:
(
response
)
=>
{
console
.
log
(
response
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: SDSloginSuccees'
);
}
// console.log(response);
// alert(JSON.stringify(response));
var
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
self
.
setShowLoginButtonFlag
(
false
);
if
(
data
.
hasOwnProperty
(
'UserID'
)){
console
.
log
(
"sds登陆成功了"
);
cloudsLogin
(
self
,
data
.
UserID
);
}
// iot.navigator.openWindow({
// url: '../device/index.html',
// id: 'device'
// });
}
else
{
}
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: sds登陆失败'
+
JSON
.
stringify
(
error
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
,
'sds登陆失败'
);
}
//请求失败
// uPublic.openRequestErrorAlert(self);
},
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
}
});
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: sds登陆初始化失败'
+
JSON
.
stringify
(
error
));
}
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
,
'sds登陆初始化失败'
);
}
//请求失败
uPublic
.
openRequestErrorAlert
(
self
);
},
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
// uComponents.showLoading(self);
// if(window.iotDebug){
// iotDebug.push('start: initSDSLogin');
// }
window
.
SDSPlugin
.
login
({},(
res
)
=>
{
console
.
log
(
res
);
var
data
=
uPublic
.
checkResponseData
(
res
.
data
);
if
(
data
){
cloudsLogin
(
self
,
data
.
UserID
);
}
});
},(
err
)
=>
{
console
.
log
(
err
);
})
// iot.business.sds.login({
// data: {
//// sds: true
// },
// success: (response) => {
//// console.log(response);
//// if(window.iotDebug){
//// iotDebug.push('end: SDSloginSuccees');
//// }
////// console.log(response);
////// alert(JSON.stringify(response));
//// var data = uPublic.checkResponseData(response.data);
//// if(data){
//// self.setShowLoginButtonFlag(false);
//// if(data.hasOwnProperty('UserID')){
//// console.log("sds登陆成功了");
//// cloudsLogin(self, data.UserID);
//// }
////// iot.navigator.openWindow({
////// url: '../device/index.html',
////// id: 'device'
////// });
//// }else{
////
//// }
// },
// error: (error) => {
//// console.log(error);
//// if(window.iotDebug){
//// iotDebug.push('end: sds登陆失败'+JSON.stringify(error));
//// }
//// if (window.iotDebug) {
//// iotDebug.upload(iot,'sds登陆失败');
//// }
//// //请求失败
////// uPublic.openRequestErrorAlert(self);
// },
// complete: () => {
//// uComponents.hideLoading(self);
// }
// });
}
function
cloudsLogin
(
self
,
id
){
...
...
@@ -179,6 +162,7 @@ function cloudsLogin(self, id){
url
:
'../device/index.html'
,
id
:
'device'
});
plus
.
navigator
.
closeSplashscreen
();
// uPublic.openWindow({
// url: '../device/index.html',
// id: 'device',
...
...
web/lib/js/SDSPlugin.js
0 → 100644
View file @
22735af2
This diff is collapsed.
Click to expand it.
web/lib/js/start.js
View file @
22735af2
...
...
@@ -26,7 +26,7 @@ UIOT_Debug.prototype.upload = function (iot,title) {
http
.
open
(
'POST'
,
'https://admin.iot.u-gen.net/admin/api/debug/uploadDebugLog'
,
true
);
http
.
setRequestHeader
(
'Accept'
,
'application/json'
);
http
.
setRequestHeader
(
'Content-type'
,
'application/json; charset=UTF-8'
);
http
.
onreadystatechange
=
()
=>
{
http
.
onreadystatechange
=
function
()
{
if
(
http
.
readyState
===
4
&&
http
.
status
===
200
)
{
var
response
=
JSON
.
parse
(
http
.
responseText
);
// console.log(response);
...
...
web/view/device/index.js
View file @
22735af2
...
...
@@ -24588,12 +24588,14 @@ function getLockInfo(self) {
//设置设备信息
function
setDevceInfo
(
self
,
data
)
{
console
.
log
(
data
);
self
.
setBatteryPercent
(
data
.
BatteryPercentage
.
value
);
if
(
data
.
BatteryPercentage
.
value
>=
10
)
{
//向上取整
self
.
setBatteryState
(
_config2
.
default
.
powerIcon
[
Math
.
ceil
(
data
.
BatteryPercentage
.
value
/
20
)]);
}
else
{
self
.
setBatteryState
(
_config2
.
default
.
powerIcon
[
Math
.
round
(
data
.
BatteryPercentage
.
value
/
20
)]);
if
(
data
.
BatteryPercentage
)
{
self
.
setBatteryPercent
(
data
.
BatteryPercentage
.
value
);
if
(
data
.
BatteryPercentage
.
value
>=
10
)
{
//向上取整
self
.
setBatteryState
(
_config2
.
default
.
powerIcon
[
Math
.
ceil
(
data
.
BatteryPercentage
.
value
/
20
)]);
}
else
{
self
.
setBatteryState
(
_config2
.
default
.
powerIcon
[
Math
.
round
(
data
.
BatteryPercentage
.
value
/
20
)]);
}
}
if
(
data
.
action
.
value
==
'notify'
)
{
if
(
data
.
notify_type
.
value
==
104
)
{
...
...
web/view/login/index.html
View file @
22735af2
...
...
@@ -17,6 +17,7 @@
<script
type=
"text/javascript"
src=
"../../lib/js/start.js"
></script>
<script
type=
"text/javascript"
src=
"../../lib/js/p.js"
></script>
<script
type=
"text/javascript"
src=
"../../lib/js/UIOT.js"
></script>
<script
type=
"text/javascript"
src=
"../../lib/js/SDSPlugin.js"
></script>
</head>
<body
ontouchstart=
""
>
...
...
web/view/login/index.js
View file @
22735af2
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