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
314b404f
Commit
314b404f
authored
Dec 22, 2017
by
朱建香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2017/12/22
1.首页代码规范优化
parent
6049e46b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
172 additions
and
303 deletions
+172
-303
dev/src/public/loop.js
+2
-2
dev/src/public/public.js
+11
-6
dev/src/view/addDevice/v_index.js
+1
-8
dev/src/view/addDevice/v_wifiAdd.js
+27
-30
dev/src/view/addDevice/v_wifiAddHelp.js
+0
-12
dev/src/view/device/v_alarmInfo.js
+50
-58
dev/src/view/device/v_hijackRecord.js
+2
-12
dev/src/view/device/v_index.js
+0
-0
dev/src/view/device/v_opendoorRecord.js
+7
-20
dev/src/view/doorlockManage/v_editName.js
+7
-10
dev/src/view/doorlockManage/v_index.js
+63
-144
dev/src/view/myInfo/v_index.js
+1
-1
web/lib/js/UIOT.js
+1
-0
No files found.
dev/src/public/loop.js
View file @
314b404f
...
@@ -90,8 +90,8 @@ class Loop{
...
@@ -90,8 +90,8 @@ class Loop{
this
.
time
=
setTimeout
(()
=>
{
this
.
time
=
setTimeout
(()
=>
{
this
.
clearTime
();
this
.
clearTime
();
this
.
canDo
=
false
;
this
.
canDo
=
false
;
//
this.fincb.error('timeout');
this
.
fincb
.
error
(
'timeout'
);
//
this.fincb.complete();
this
.
fincb
.
complete
();
console
.
log
(
"超时"
);
console
.
log
(
"超时"
);
this
.
intervalcb
=
null
;
this
.
intervalcb
=
null
;
this
.
fincb
=
null
;
this
.
fincb
=
null
;
...
...
dev/src/public/public.js
View file @
314b404f
...
@@ -147,7 +147,8 @@ uPublic.logout = function(opts){
...
@@ -147,7 +147,8 @@ uPublic.logout = function(opts){
});
});
}
}
uPublic
.
upDateRead
=
async
function
(
key
){
// 更新缓存中history存储的isReadFlag 和 time
uPublic
.
upDateRead
=
async
function
(
key
,
time
){
let
oldHistory
=
{
let
oldHistory
=
{
alarm
:
{
alarm
:
{
time
:
null
,
time
:
null
,
...
@@ -163,7 +164,8 @@ uPublic.upDateRead = async function(key){
...
@@ -163,7 +164,8 @@ uPublic.upDateRead = async function(key){
}
}
};
};
try
{
try
{
oldHistory
=
await
iot
.
storage
.
getMap
(
'history'
);
let
history
=
await
iot
.
storage
.
getMap
(
'history'
);
oldHistory
=
history
?
history
:
oldHistory
;
console
.
log
(
oldHistory
);
console
.
log
(
oldHistory
);
}
}
catch
(
error
){
catch
(
error
){
...
@@ -172,12 +174,15 @@ uPublic.upDateRead = async function(key){
...
@@ -172,12 +174,15 @@ uPublic.upDateRead = async function(key){
let
newHistory
=
oldHistory
;
let
newHistory
=
oldHistory
;
newHistory
[
key
].
isReadFlag
=
true
;
newHistory
[
key
].
isReadFlag
=
true
;
iot
.
storage
.
setMap
(
'history'
,
newHistory
,
(
response
)
=>
{
newHistory
[
key
].
time
=
time
;
console
.
log
(
res
);
let
flag
=
await
iot
.
storage
.
setMap
(
'history'
,
newHistory
);
},
()
=>
{
if
(
flag
){
});
return
false
;
}
}
}
iot
.
ready
(()
=>
{
iot
.
ready
(()
=>
{
uPublic
.
recalc
();
uPublic
.
recalc
();
});
});
...
...
dev/src/view/addDevice/v_index.js
View file @
314b404f
...
@@ -61,18 +61,11 @@ function backTap(){
...
@@ -61,18 +61,11 @@ function backTap(){
//tap 扫描绑定设备
//tap 扫描绑定设备
function
scanAddTap
(){
function
scanAddTap
(){
// iot.navigator.openWindow({
iot
.
navigator
.
openWindow
({
// url: './scanCodeAdd.html',
// id: 'scanCodeAdd'
// });
mui
.
openWindow
({
url
:
'./scanCodeAdd.html'
,
url
:
'./scanCodeAdd.html'
,
id
:
'scanCodeAdd'
,
id
:
'scanCodeAdd'
,
show
:
{
show
:
{
aniShow
:
"none"
aniShow
:
"none"
},
waiting
:
{
autoShow
:
false
}
}
});
});
}
}
...
...
dev/src/view/addDevice/v_wifiAdd.js
View file @
314b404f
...
@@ -40,7 +40,7 @@ function init() {
...
@@ -40,7 +40,7 @@ function init() {
setTextPassword
(
pwd
){
setTextPassword
(
pwd
){
this
.
textPassword
=
pwd
;
this
.
textPassword
=
pwd
;
},
},
get
t
TextErrorTip
(){
getTextErrorTip
(){
return
this
.
textErrorTip
;
return
this
.
textErrorTip
;
},
},
setTextErrorTip
(
tip
){
setTextErrorTip
(
tip
){
...
@@ -110,12 +110,12 @@ function initComponentsConfig() {
...
@@ -110,12 +110,12 @@ function initComponentsConfig() {
}
}
}
}
//页面渲染后,获取wifi名称
function
resolve
(
self
){
function
resolve
(
self
){
iot
.
business
.
sds
.
getSSId
({
iot
.
business
.
sds
.
getSSId
({
success
:
(
response
)
=>
{
success
:
(
response
)
=>
{
console
.
log
(
response
);
console
.
log
(
response
);
self
.
textWiFiName
=
response
.
data
.
ssid
;
self
.
textWiFiName
=
response
.
data
.
ssid
;
console
.
log
(
self
.
textWiFiName
);
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
...
@@ -130,11 +130,13 @@ function resolve(self){
...
@@ -130,11 +130,13 @@ function resolve(self){
});
});
}
}
//设置wifi密码
function
passwordChange
(
self
,
text
){
function
passwordChange
(
self
,
text
){
self
.
textPassword
=
text
;
self
.
setTextPassword
(
text
)
;
console
.
log
(
'passwordChange: '
+
self
.
textPassword
);
console
.
log
(
'passwordChange: '
+
self
.
getTextPassword
()
);
}
}
//重新mui.back
mui
.
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{
});
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{
});
iot
.
navigator
.
back
();
iot
.
navigator
.
back
();
...
@@ -147,8 +149,6 @@ function backTap(){
...
@@ -147,8 +149,6 @@ function backTap(){
//tap 连接
//tap 连接
function
connectButtonTap
(
self
){
function
connectButtonTap
(
self
){
// console.log(self.getTextWiFiName());
// console.log(self.getTextPassword());
if
(
self
.
getTextWiFiName
()
==
null
||
self
.
getTextWiFiName
().
trim
()
==
''
){
if
(
self
.
getTextWiFiName
()
==
null
||
self
.
getTextWiFiName
().
trim
()
==
''
){
self
.
setTextErrorTip
(
Vue
.
t
(
'wifiAdd.unbindWifiTip'
));
self
.
setTextErrorTip
(
Vue
.
t
(
'wifiAdd.unbindWifiTip'
));
}
else
if
(
self
.
getTextPassword
()
==
null
||
self
.
getTextPassword
().
trim
()
==
''
){
}
else
if
(
self
.
getTextPassword
()
==
null
||
self
.
getTextPassword
().
trim
()
==
''
){
...
@@ -189,10 +189,6 @@ function connectButtonTap(self){
...
@@ -189,10 +189,6 @@ function connectButtonTap(self){
}
}
//wifi连接成功,停止连接wifi
//wifi连接成功,停止连接wifi
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.wifiBindSuccess'
));
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'wifiAdd.wifiBindSuccess'
));
// iot.business.sds.stopFindWifi({
// success: (response) => {},
// error: (error) => {}
// });
}
}
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
...
@@ -233,7 +229,6 @@ function connectButtonTap(self){
...
@@ -233,7 +229,6 @@ function connectButtonTap(self){
}
}
let
deviceId
=
response
.
info
.
sn
;
let
deviceId
=
response
.
info
.
sn
;
unbind
(
self
,
deviceId
,
productId
);
unbind
(
self
,
deviceId
,
productId
);
// bind(self, deviceId, productId);
}
else
if
(
response
.
data
==
"fail"
){
}
else
if
(
response
.
data
==
"fail"
){
//连接失败
//连接失败
if
(
window
.
iotDebug
){
if
(
window
.
iotDebug
){
...
@@ -280,25 +275,7 @@ function connectButtonTap(self){
...
@@ -280,25 +275,7 @@ function connectButtonTap(self){
},
config
.
wifi_add_timeout
);
},
config
.
wifi_add_timeout
);
}
}
//tap loading button
//云端绑定之前先解绑
function
commLoadingButtonTap
(
self
)
{
if
(
self
.
getStatus
()
==
1
){
//绑定成功
uComponents
.
hideCommLoading
(
self
);
iot
.
navigator
.
fire
(
plus
.
webview
.
getWebviewById
(
'device'
),
'returnPage'
,{});
iot
.
navigator
.
openWindow
({
url
:
'../device/index.html'
,
id
:
'device'
});
}
else
if
(
self
.
getStatus
()
==
2
){
//绑定失败
uComponents
.
hideCommLoading
(
self
);
self
.
setStatus
(
0
);
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'addDevice.loading'
));
}
}
function
unbind
(
self
,
deviceId
,
productId
){
function
unbind
(
self
,
deviceId
,
productId
){
console
.
log
(
deviceId
);
console
.
log
(
deviceId
);
iot
.
business
.
api
.
sendCustom
(
'lock/unbindDevice'
,{
iot
.
business
.
api
.
sendCustom
(
'lock/unbindDevice'
,{
...
@@ -332,6 +309,7 @@ function unbind(self, deviceId, productId){
...
@@ -332,6 +309,7 @@ function unbind(self, deviceId, productId){
});
});
}
}
//云端绑定
function
bind
(
self
,
deviceId
,
productId
){
function
bind
(
self
,
deviceId
,
productId
){
iot
.
business
.
api
.
sendCustom
(
'lock/bind'
,{
iot
.
business
.
api
.
sendCustom
(
'lock/bind'
,{
data
:
{
data
:
{
...
@@ -370,3 +348,21 @@ function bind(self, deviceId, productId){
...
@@ -370,3 +348,21 @@ function bind(self, deviceId, productId){
complete
:
()
=>
{}
complete
:
()
=>
{}
});
});
}
}
//tap loading button
function
commLoadingButtonTap
(
self
)
{
if
(
self
.
getStatus
()
==
1
){
//绑定成功
uComponents
.
hideCommLoading
(
self
);
iot
.
navigator
.
fire
(
plus
.
webview
.
getWebviewById
(
'device'
),
'returnPage'
,{});
iot
.
navigator
.
openWindow
({
url
:
'../device/index.html'
,
id
:
'device'
});
}
else
if
(
self
.
getStatus
()
==
2
){
//绑定失败
uComponents
.
hideCommLoading
(
self
);
self
.
setStatus
(
0
);
uComponents
.
changeCommLoadingStatusAndText
(
self
,
0
,
Vue
.
t
(
'addDevice.loading'
));
}
}
\ No newline at end of file
dev/src/view/addDevice/v_wifiAddHelp.js
View file @
314b404f
...
@@ -79,15 +79,4 @@ function wifiAddButtonTap(){
...
@@ -79,15 +79,4 @@ function wifiAddButtonTap(){
url
:
'./wifiAdd.html'
,
url
:
'./wifiAdd.html'
,
id
:
'wifiAdd'
id
:
'wifiAdd'
});
});
console
.
log
(
"in"
);
// iot.business.sds.wifiDeviceConfig({
// success: function (response) {
// console.log('wifiDeviceConfig success');
// console.log(response);
// },
// error: function (error) {
// console.log('wifiDeviceConfig error');
// console.log(error);
// }
// });
}
}
\ No newline at end of file
dev/src/view/device/v_alarmInfo.js
View file @
314b404f
...
@@ -47,6 +47,7 @@ function init() {
...
@@ -47,6 +47,7 @@ function init() {
setDeviceId
(
id
){
setDeviceId
(
id
){
this
.
deviceId
=
id
;
this
.
deviceId
=
id
;
},
},
//tap 点击加载更多
onListLoadTap
(){
onListLoadTap
(){
listLoadTap
(
this
);
listLoadTap
(
this
);
},
},
...
@@ -82,74 +83,65 @@ function initComponentsConfig() {
...
@@ -82,74 +83,65 @@ function initComponentsConfig() {
}
}
}
}
function
resolve
(
self
)
{
// 获取历史记录
self
.
setDeviceId
(
iot
.
navigator
.
getExtras
().
deviceId
);
function
resolve
(
self
)
{
uComponents
.
showLoading
(
self
);
self
.
setDeviceId
(
iot
.
navigator
.
getExtras
().
deviceId
);
iot
.
business
.
api
.
sendCustom
(
'lock/getHistoryRecord'
,
uComponents
.
showLoading
(
self
);
{
iot
.
business
.
api
.
sendCustom
(
'lock/getHistoryRecord'
,
data
:
{
{
device_id
:
self
.
getDeviceId
(),
data
:
{
action
:
2
,
device_id
:
self
.
getDeviceId
(),
start_id
:
self
.
getStartId
(),
action
:
2
,
page_size
:
PAGE_SIZE
start_id
:
self
.
getStartId
(),
},
page_size
:
PAGE_SIZE
success
:
(
response
)
=>
{
},
console
.
log
(
response
);
success
:
async
(
response
)
=>
{
if
(
self
.
flag
){
console
.
log
(
response
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
self
.
flag
){
if
(
data
&&
data
.
record
.
length
>
0
){
let
record
=
data
.
record
;
// iot.storage.setMap('notifyTime', moment(record[0].time).unix(), (res) => {
// console.log(res);
// self.flag = false;
// }, () => {
// });
uPublic
.
upDateRead
(
'notify'
);
}
}
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
if
(
data
&&
data
.
record
.
length
>
0
){
let
list
=
[];
let
record
=
data
.
record
;
let
record
=
data
.
record
;
for
(
let
i
=
0
;
i
<
record
.
length
;
i
++
){
self
.
flag
=
await
uPublic
.
upDateRead
(
'notify'
,
moment
(
record
[
0
].
time
).
unix
());
list
[
i
]
=
{
value
:
record
[
i
].
openId
,
leftImage
:
'../../resources/image/green_alarmInfo'
+
record
[
i
].
mode
+
'_icon.png'
,
subtitle
:
Vue
.
t
(
'alarmInfo.'
+
config
.
alarmMode
[
record
[
i
].
mode
]
+
''
),
rightText
:
moment
(
record
[
i
].
time
).
format
(
"YYYY.MM.DD HH:mm:ss"
)
};
}
self
.
setList
(
self
.
getList
().
concat
(
list
));
if
(
record
.
length
>
0
){
self
.
setStartId
(
record
[
record
.
length
-
1
].
id
);
}
//更新列表数据
uComponents
.
changeList
(
self
,
self
.
getList
());
}
else
{
}
}
uComponents
.
hideLoading
(
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
:
()
=>
{
uComponents
.
hideLoading
(
self
);
}
}
});
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
}
if
(
data
){
let
list
=
[];
let
record
=
data
.
record
;
for
(
let
i
=
0
;
i
<
record
.
length
;
i
++
){
list
[
i
]
=
{
value
:
record
[
i
].
openId
,
leftImage
:
'../../resources/image/green_alarmInfo'
+
record
[
i
].
mode
+
'_icon.png'
,
subtitle
:
Vue
.
t
(
'alarmInfo.'
+
config
.
alarmMode
[
record
[
i
].
mode
]
+
''
),
rightText
:
moment
(
record
[
i
].
time
).
format
(
"YYYY.MM.DD HH:mm:ss"
)
};
}
self
.
setList
(
self
.
getList
().
concat
(
list
));
if
(
record
.
length
>
0
){
self
.
setStartId
(
record
[
record
.
length
-
1
].
id
);
}
//更新列表数据
uComponents
.
changeList
(
self
,
self
.
getList
());
}
else
{
}
uComponents
.
hideLoading
(
self
);
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
uPublic
.
openRequestErrorAlert
(
self
);
},
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
}
});
}
//tap <
//tap <
function
backTap
(){
function
backTap
(){
iot
.
navigator
.
aback
();
iot
.
navigator
.
aback
();
}
}
//重写mui.back
mui
.
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
console
.
log
(
"fire"
);
...
...
dev/src/view/device/v_hijackRecord.js
View file @
314b404f
...
@@ -106,12 +106,7 @@ function initComponentsConfig() {
...
@@ -106,12 +106,7 @@ function initComponentsConfig() {
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
&&
data
.
record
.
length
>
0
){
if
(
data
&&
data
.
record
.
length
>
0
){
let
record
=
data
.
record
;
let
record
=
data
.
record
;
// iot.storage.setMap('alarmTime', moment(record[0].time).unix(), (res) => {
self
.
flag
=
await
uPublic
.
upDateRead
(
'alarm'
,
moment
(
record
[
0
].
time
).
unix
());
// console.log(res);
// self.flag = false;
// }, () => {
// });
uPublic
.
upDateRead
(
'alarm'
);
}
}
}
}
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
...
@@ -152,12 +147,6 @@ function initComponentsConfig() {
...
@@ -152,12 +147,6 @@ function initComponentsConfig() {
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 获取劫持报警信息'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'获取劫持报警信息');
// }
uPublic
.
openRequestErrorAlert
(
self
);
uPublic
.
openRequestErrorAlert
(
self
);
},
},
complete
:
()
=>
{
complete
:
()
=>
{
...
@@ -171,6 +160,7 @@ function backTap(){
...
@@ -171,6 +160,7 @@ function backTap(){
iot
.
navigator
.
aback
();
iot
.
navigator
.
aback
();
}
}
//重写mui.back
mui
.
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
console
.
log
(
"fire"
);
...
...
dev/src/view/device/v_index.js
View file @
314b404f
This diff is collapsed.
Click to expand it.
dev/src/view/device/v_opendoorRecord.js
View file @
314b404f
...
@@ -107,6 +107,7 @@ function backTap(){
...
@@ -107,6 +107,7 @@ function backTap(){
iot
.
navigator
.
aback
();
iot
.
navigator
.
aback
();
}
}
//重写mui.back
mui
.
back
=
function
(){
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
console
.
log
(
"fire"
);
...
@@ -118,6 +119,7 @@ function listLoadTap(self) {
...
@@ -118,6 +119,7 @@ function listLoadTap(self) {
resolve
(
self
);
resolve
(
self
);
}
}
//获取历史记录(整个设备)
function
getHistoryRecord
(
self
){
function
getHistoryRecord
(
self
){
iot
.
business
.
api
.
sendCustom
(
'lock/getHistoryRecord'
,
iot
.
business
.
api
.
sendCustom
(
'lock/getHistoryRecord'
,
{
{
...
@@ -127,29 +129,18 @@ function getHistoryRecord(self){
...
@@ -127,29 +129,18 @@ function getHistoryRecord(self){
start_id
:
self
.
getStartId
(),
start_id
:
self
.
getStartId
(),
page_size
:
PAGE_SIZE
page_size
:
PAGE_SIZE
},
},
success
:
(
response
)
=>
{
success
:
async
(
response
)
=>
{
setListData
(
self
,
response
);
setListData
(
self
,
response
);
if
(
self
.
flag
){
if
(
self
.
flag
){
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
&&
data
.
record
.
length
>
0
){
if
(
data
&&
data
.
record
.
length
>
0
){
let
record
=
data
.
record
;
let
record
=
data
.
record
;
// iot.storage.setMap('openTime', moment(record[0].time).unix(), (res) => {
self
.
flag
=
await
uPublic
.
upDateRead
(
'open'
,
moment
(
record
[
0
].
time
).
unix
());
// console.log(res);
// self.flag = false;
// }, () => {
// });
uPublic
.
upDateRead
(
'open'
);
}
}
}
}
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 获取开门记录失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'获取开门记录失败');
// }
uPublic
.
openRequestErrorAlert
(
self
);
uPublic
.
openRequestErrorAlert
(
self
);
},
},
complete
:
()
=>
{
complete
:
()
=>
{
...
@@ -158,6 +149,7 @@ function getHistoryRecord(self){
...
@@ -158,6 +149,7 @@ function getHistoryRecord(self){
});
});
}
}
//获取个人历史记录
function
getPersonalHistory
(
self
,
id
){
function
getPersonalHistory
(
self
,
id
){
iot
.
business
.
api
.
sendCustom
(
'lock/getPersonalHistory'
,
iot
.
business
.
api
.
sendCustom
(
'lock/getPersonalHistory'
,
{
{
...
@@ -173,13 +165,7 @@ function getPersonalHistory(self, id){
...
@@ -173,13 +165,7 @@ function getPersonalHistory(self, id){
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
// if(window.iotDebug){
uPublic
.
openRequestErrorAlert
(
self
);
// iotDebug.push('end: 获取个人开门历史记录'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'获取个人开门历史记录');
// }
uPublic
.
openRequestErrorAlert
(
self
);
},
},
complete
:
()
=>
{
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
uComponents
.
hideLoading
(
self
);
...
@@ -187,6 +173,7 @@ function getPersonalHistory(self, id){
...
@@ -187,6 +173,7 @@ function getPersonalHistory(self, id){
});
});
}
}
//设置历史记录渲染列表
function
setListData
(
self
,
response
){
function
setListData
(
self
,
response
){
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
if
(
data
){
...
...
dev/src/view/doorlockManage/v_editName.js
View file @
314b404f
...
@@ -82,10 +82,6 @@ function initComponentsConfig() {
...
@@ -82,10 +82,6 @@ function initComponentsConfig() {
}
}
}
}
function
alert
(){
alert
(
'aaa'
);
}
function
nameChange
(
self
,
text
){
function
nameChange
(
self
,
text
){
self
.
setTextName
(
text
);
self
.
setTextName
(
text
);
self
.
setTextErrorTip
(
''
);
self
.
setTextErrorTip
(
''
);
...
@@ -97,6 +93,13 @@ function backTap(){
...
@@ -97,6 +93,13 @@ function backTap(){
iot
.
navigator
.
back
();
iot
.
navigator
.
back
();
}
}
//重写mui.back
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
iot
.
navigator
.
back
();
}
//tap 保存
//tap 保存
function
saveTap
(
self
){
function
saveTap
(
self
){
if
(
self
.
getTextName
()
==
null
||
self
.
getTextName
().
trim
()
==
''
){
if
(
self
.
getTextName
()
==
null
||
self
.
getTextName
().
trim
()
==
''
){
...
@@ -123,12 +126,6 @@ function saveTap(self){
...
@@ -123,12 +126,6 @@ function saveTap(self){
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 修改设备名称失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'修改设备名称失败');
// }
uComponents
.
openAlert
(
self
,
Vue
.
t
(
'editName.editNameFailue'
),
{
uComponents
.
openAlert
(
self
,
Vue
.
t
(
'editName.editNameFailue'
),
{
text
:
Vue
.
t
(
'btn.confirm'
),
callback
:
function
()
{
text
:
Vue
.
t
(
'btn.confirm'
),
callback
:
function
()
{
let
opener
=
plus
.
webview
.
currentWebview
().
opener
();
let
opener
=
plus
.
webview
.
currentWebview
().
opener
();
...
...
dev/src/view/doorlockManage/v_index.js
View file @
314b404f
...
@@ -18,6 +18,7 @@ function init() {
...
@@ -18,6 +18,7 @@ function init() {
//项目 list组件
//项目 list组件
uPublic
.
componentsExtend
([
'grid-list'
]);
uPublic
.
componentsExtend
([
'grid-list'
]);
uPublic
.
closeSlideBack
();
uPublic
.
closeSlideBack
();
console
.
log
(
iot
.
navigator
.
getExtras
());
const
app
=
new
Vue
({
const
app
=
new
Vue
({
data
:{
data
:{
//配置组件
//配置组件
...
@@ -197,6 +198,7 @@ function initComponentsConfig() {
...
@@ -197,6 +198,7 @@ function initComponentsConfig() {
}
}
}
}
//获取设备信息
function
getDoorlockInfo
(
self
){
function
getDoorlockInfo
(
self
){
uComponents
.
showLoading
(
self
);
uComponents
.
showLoading
(
self
);
let
productId
=
config
.
model
;
let
productId
=
config
.
model
;
...
@@ -216,57 +218,14 @@ function getDoorlockInfo(self){
...
@@ -216,57 +218,14 @@ function getDoorlockInfo(self){
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 获取门锁信息失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'获取门锁信息失败');
// }
uPublic
.
openRequestErrorAlert
(
self
);
uPublic
.
openRequestErrorAlert
(
self
);
},
},
complete
:
()
=>
{
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
uComponents
.
hideLoading
(
self
);
}
}
});
});
// iot.business.api.send('device/getList',{
// data: {
// sds: false,
// device_id: self.extras.deviceId,
// product_id: productId,
// parent_id: 0,
// start_id: 0,
// number: 10
// },
// success: (response) => {
// console.log(response);
// let data = uPublic.checkResponseData(response.data);
// if(data){
// self.setDoorlock(response.data[0]);
// self.setTextNickname(self.getDoorlock().nickname);
// console.log(self.getDoorlock());
// }
// },
// error: (error) => {
// //请求失败
// uPublic.openRequestErrorAlert(self);
// console.log(error);
// },
// complete: () => {
// uComponents.hideLoading(self);
// }
// },true);
}
}
//tap <
function
backTap
(){
iot
.
navigator
.
aback
();
}
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
iot
.
navigator
.
back
();
}
//tap 修改设备昵称
//tap 修改设备昵称
function
editNameTap
(
self
){
function
editNameTap
(
self
){
...
@@ -282,44 +241,40 @@ function editNameTap(self){
...
@@ -282,44 +241,40 @@ function editNameTap(self){
}
}
}
}
//tap
解绑门锁
//tap
‘解绑门锁’ 显示解绑门锁弹框
function
unbindDoorlockButtonTap
(
self
){
function
unbindDoorlockButtonTap
(
self
){
self
.
setUnbindShowDialog
(
true
);
self
.
setUnbindShowDialog
(
true
);
//uComponents.openConfirm(self, Vue.t('doorlockManage.unbindDialogTip'),
// {text: Vue.t('dialog.cancel'), callback: function () {}},
// {text: Vue.t('dialog.unbind'), callback: function () {
// uComponents.showLoading(self);
// iot.business.sds.unbindDevice({
// data: {
// uuid: self.extras.uuid
// },
// success: (response) => {
// console.log(response);
// unbind(self);
// },
// error: (error) => {
// console.log(error)
// },
// complete: () => {
//
// }
// });
// }}
// );
}
}
//tap 隐藏提示框
//tap 确认解绑门锁
function
unbindStateDialogTap
(
self
){
function
confirmTap
(
self
){
self
.
setStateShowFlag
(
false
);
self
.
setUnbindShowDialog
(
false
);
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
// sds解绑门锁
if
(
self
.
getUnbindSucceess
){
iot
.
business
.
sds
.
unbindDevice
({
iot
.
navigator
.
openWindow
({
data
:
{
url
:
'../device/index.html'
,
uuid
:
self
.
extras
.
uuid
id
:
'device'
},
});
success
:
(
response
)
=>
{
}
console
.
log
(
response
);
unbind
(
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
:
()
=>
{
}
});
}
}
// 云端解绑门锁
function
unbind
(
self
){
function
unbind
(
self
){
iot
.
business
.
api
.
sendCustom
(
'lock/unbind'
,{
iot
.
business
.
api
.
sendCustom
(
'lock/unbind'
,{
data
:
{
data
:
{
...
@@ -335,12 +290,6 @@ function unbind(self){
...
@@ -335,12 +290,6 @@ function unbind(self){
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 云端解绑失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'云端解绑失败');
// }
self
.
setStateShowFlag
(
false
);
self
.
setStateShowFlag
(
false
);
self
.
setShowMsg
(
Vue
.
t
(
'doorlockManage.unbindFailue'
));
self
.
setShowMsg
(
Vue
.
t
(
'doorlockManage.unbindFailue'
));
self
.
setUnbindSucceess
(
false
);
self
.
setUnbindSucceess
(
false
);
...
@@ -351,46 +300,44 @@ function unbind(self){
...
@@ -351,46 +300,44 @@ function unbind(self){
});
});
}
}
//function unbindUser(self){
//选择是否清除所有信息,默认选择为‘清除所有信息’
// iot.business.api.sendCustom('lock/unbindUser',{
function
isClearSwitchTap
(
self
,
value
){
// data: {
self
.
setValueIsClear
(
value
);
// rel_id: self.getDoorlock().id,
console
.
log
(
self
.
getValueIsClear
());
// device_id: self.getDoorlock().device_id,
}
// user_id: self.getDoorlock().user_device_id
// },
// success: (response) => {
// self.setStateShowFlag(true);
// self.setShowMsg(Vue.t('doorlockUser.unbindSuccess'));
// self.setUnbindSucceess(true);
// },
// error: (error) => {
// console.log(error);
// self.setStateShowFlag(false);
// self.setShowMsg(Vue.t('doorlockUser.unbindFailue'));
// self.setUnbindSucceess(false);
// },
// complete: () => {
// uComponents.hideLoading(self);
// }
// });
//}
//tap <
function
backTap
(){
iot
.
navigator
.
aback
();
}
//重写mui.back
mui
.
back
=
function
(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
"fire"
);
iot
.
navigator
.
back
();
}
// 选择: 是否接收门铃消息推送
function
doorbellSwitchTap
(
self
,
value
){
function
doorbellSwitchTap
(
self
,
value
){
self
.
setValueDoorbell
(
value
);
self
.
setValueDoorbell
(
value
);
setOption
(
self
);
setOption
(
self
);
}
}
// 选择: 是否接收报警消息推送
function
alarmSwitchTap
(
self
,
value
){
function
alarmSwitchTap
(
self
,
value
){
self
.
setValueAlarm
(
value
);
self
.
setValueAlarm
(
value
);
setOption
(
self
);
setOption
(
self
);
}
}
// 选择: 是否接收开门消息推送
function
opendoorSwitchTap
(
self
,
value
){
function
opendoorSwitchTap
(
self
,
value
){
self
.
setValueOpendoor
(
value
);
self
.
setValueOpendoor
(
value
);
setOption
(
self
);
setOption
(
self
);
}
}
// 调用设置推送接口
function
setOption
(
self
){
function
setOption
(
self
){
// uComponents.showLoading(self);
iot
.
business
.
api
.
sendCustom
(
'lock/setPushOption'
,
iot
.
business
.
api
.
sendCustom
(
'lock/setPushOption'
,
{
{
data
:
{
data
:
{
...
@@ -404,54 +351,26 @@ function setOption(self){
...
@@ -404,54 +351,26 @@ function setOption(self){
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
// if(window.iotDebug){
// iotDebug.push('end: 设置推送失败'+JSON.stringify(error));
// }
// if (window.iotDebug) {
// iotDebug.upload(iot,'设置推送失败');
// }
uPublic
.
openRequestErrorAlert
(
self
);
uPublic
.
openRequestErrorAlert
(
self
);
},
},
complete
:
()
=>
{
complete
:
()
=>
{
// uComponents.hideLoading(self);
}
}
});
});
}
}
//tap 取消解绑门锁
function
cancelTap
(
self
){
function
cancelTap
(
self
){
self
.
setUnbindShowDialog
(
false
);
self
.
setUnbindShowDialog
(
false
);
}
}
function
confirmTap
(
self
){
//tap 绑定成功弹框提示-->回到首页
self
.
setUnbindShowDialog
(
false
);
function
unbindStateDialogTap
(
self
){
iot
.
business
.
sds
.
unbindDevice
({
self
.
setStateShowFlag
(
false
);
data
:
{
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
uuid
:
self
.
extras
.
uuid
if
(
self
.
getUnbindSucceess
){
},
iot
.
navigator
.
openWindow
({
success
:
(
response
)
=>
{
url
:
'../device/index.html'
,
console
.
log
(
response
);
id
:
'device'
unbind
(
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
:
()
=>
{
}
});
// unbind(self);
}
function
isClearSwitchTap
(
self
,
value
){
self
.
setValueIsClear
(
value
);
console
.
log
(
self
.
getValueIsClear
());
}
}
dev/src/view/myInfo/v_index.js
View file @
314b404f
...
@@ -144,7 +144,7 @@ function logoutButtonTap(self){
...
@@ -144,7 +144,7 @@ function logoutButtonTap(self){
console
.
log
(
"sdsLogout:"
+
response
);
console
.
log
(
"sdsLogout:"
+
response
);
let
sdsResponse
=
response
;
let
sdsResponse
=
response
;
iot
.
business
.
websql
.
delMaps
([
'utoken'
,
'userinfo'
],
(
response
)
=>
{
iot
.
business
.
websql
.
delMaps
([
'utoken'
,
'userinfo'
],
(
response
)
=>
{
iot
.
storage
.
delMaps
([
'
notifyTime'
,
'alarmTime'
,
'openTime
'
],
(
response
)
=>
{
iot
.
storage
.
delMaps
([
'
historyId'
,
'history
'
],
(
response
)
=>
{
console
.
log
(
"clearMap"
+
response
);
console
.
log
(
"clearMap"
+
response
);
//打开首页
//打开首页
iot
.
navigator
.
openWindow
({
iot
.
navigator
.
openWindow
({
...
...
web/lib/js/UIOT.js
View file @
314b404f
...
@@ -4928,6 +4928,7 @@ var App = function (_Base) {
...
@@ -4928,6 +4928,7 @@ var App = function (_Base) {
url
:
params
.
url
,
url
:
params
.
url
,
id
:
params
.
id
,
id
:
params
.
id
,
styles
:
params
.
styles
||
{},
styles
:
params
.
styles
||
{},
show
:
params
.
show
,
extras
:
{
IOTData
:
params
.
extras
},
extras
:
{
IOTData
:
params
.
extras
},
waiting
:
params
.
waiting
||
{
autoShow
:
false
}
waiting
:
params
.
waiting
||
{
autoShow
:
false
}
});
});
...
...
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