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
89f60d04
Commit
89f60d04
authored
Sep 20, 2017
by
朱建香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备列表
parent
fedf09d1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
348 additions
and
47 deletions
+348
-47
dev/package.json
+1
-0
dev/src/lang/zh.json
+10
-4
dev/src/public/public.js
+1
-1
dev/src/view/addDevice/v_scanCodeAdd.js
+34
-3
dev/src/view/addDevice/v_wifiAdd.js
+22
-1
dev/src/view/addDevice/v_wifiAddHelp.js
+15
-4
dev/src/view/c_grid-list.vue
+1
-0
dev/src/view/doorlockManage/v_editName.js
+43
-6
dev/src/view/doorlockManage/v_index.js
+175
-22
dev/src/view/doorlockManage/v_qrcode.js
+46
-6
No files found.
dev/package.json
View file @
89f60d04
...
...
@@ -9,6 +9,7 @@
"hammerjs"
:
"2.0.8"
,
"iscroll"
:
"5.2.0"
,
"moment"
:
"^2.18.1"
,
"qrcode"
:
"^0.9.0"
,
"ugen-components"
:
"^0.1.0"
,
"underscore"
:
"1.8.3"
,
"vue"
:
"2.2.6"
,
...
...
dev/src/lang/zh.json
View file @
89f60d04
...
...
@@ -95,7 +95,7 @@
"remoteOpendoor"
:{
"passwordInputTip"
:
"请输入远程开门密码"
,
"error"
:
{
"noPasswordTip"
:
"远程密码不能为空"
}
},
"hijackRecord"
:{
...
...
@@ -104,12 +104,16 @@
"doorlockManage"
:{
"noDeviceTip"
:
"暂无设备"
,
"deleteDialogTip"
:
"<span>{0}</span>将被删除"
,
"logoutDialogTip"
:
"确定要退出系统吗?"
"logoutDialogTip"
:
"确定要退出系统吗?"
,
"deleteSuccess"
:
"删除成功"
,
"deleteFailue"
:
"删除失败"
,
"defaultNickname"
:
"门锁"
},
"editName"
:{
"nameInputTip"
:
"请输入门锁名称"
,
"editNameSuccess"
:
"名字修改成功"
,
"editNameFailue"
:
"名字修改失败"
,
"error"
:
{
}
},
"qrcode"
:{
...
...
@@ -121,7 +125,9 @@
},
"addDevice"
:
{
"scanCodeAdd"
:
"扫描绑定设备"
,
"wifiAdd"
:
"配置Wi-Fi"
"wifiAdd"
:
"配置Wi-Fi"
,
"scanCodeSuccess"
:
"扫描成功"
,
"scanCodeFailue"
:
"扫描失败"
},
"wifiAddHelp"
:
{
"helpTitle"
:
"配置Wi-Fi说明:"
,
...
...
dev/src/public/public.js
View file @
89f60d04
...
...
@@ -16,7 +16,7 @@ const iot = new UIOT({
appId
:
''
},
cloud
:
{
url
:
'http://192.168.2.9
7:20007
'
url
:
'http://192.168.2.9
6:20000
'
},
plugin
:
{
log
:
{
...
...
dev/src/view/addDevice/v_scanCodeAdd.js
View file @
89f60d04
...
...
@@ -18,7 +18,15 @@ function init() {
//配置组件
componentsConfig
:
initComponentsConfig
()
},
mounted
(){
mounted
(){
openScanCode
();
iot
.
utils
.
scanBarcode
({
data
:
{
id
:
'bcid'
},
success
:
(
response
)
=>
{},
error
:
(
error
)
=>
{}
});
},
methods
:{
//tap <
...
...
@@ -48,4 +56,28 @@ function initComponentsConfig() {
//tap <
function
backTap
(){
iot
.
navigator
.
back
();
}
\ No newline at end of file
}
function
openScanCode
(){
iot
.
utils
.
scanBarcode
({
data
:
{
id
:
'scanId'
},
success
:
(
response
)
=>
{
console
.
log
(
response
);
//扫描成功
uComponents
.
openAlert
(
self
,
Vue
.
t
(
'addDevice.scanCodeSuccess'
),
{
text
:
Vue
.
t
(
'btn.confirm'
),
callback
:
function
()
{
}
});
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
//扫描失败
uComponents
.
openAlert
(
self
,
Vue
.
t
(
'addDevice.scanCodeFailue'
),
{
text
:
Vue
.
t
(
'btn.confirm'
),
callback
:
function
()
{
}
});
}
});
}
dev/src/view/addDevice/v_wifiAdd.js
View file @
89f60d04
...
...
@@ -15,6 +15,7 @@ function init() {
uPublic
.
componentsInit
([
'u-text'
,
'u-button'
,
'u-commstatus-loading'
,
'u-dialog'
,
'u-loading'
]);
const
app
=
new
Vue
({
data
:{
textWiFiName
:
null
,
textPassword
:
null
,
textErrorTip
:
null
,
textLoading
:
'loading...'
,
...
...
@@ -22,9 +23,29 @@ function init() {
//配置组件
componentsConfig
:
initComponentsConfig
()
},
mounted
(){
mounted
(){
iot
.
business
.
sds
.
findWifi
({
data
:
{
// model: 'model',
// ssid: 'ssid',
wifiPwd
:
'wifiPwd'
,
timeout
:
20000
},
success
:
(
response
)
=>
{
console
.
log
(
response
);
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
}
});
},
methods
:{
getTextPassword
(){
return
this
.
textPassword
;
},
setTextPassword
(
pwd
){
this
.
textPassword
=
pwd
;
},
getTextLoading
(){
return
this
.
textLoading
;
},
...
...
dev/src/view/addDevice/v_wifiAddHelp.js
View file @
89f60d04
...
...
@@ -63,8 +63,18 @@ function backTap(){
//tap 开始配置Wi-Fi
function
wifiAddButtonTap
(){
iot
.
navigator
.
openWindow
({
url
:
'./wifiAdd.html'
,
id
:
'wifiAdd'
});
// iot.navigator.openWindow({
// url: './wifiAdd.html',
// id: 'wifiAdd'
// });
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/c_grid-list.vue
View file @
89f60d04
...
...
@@ -81,6 +81,7 @@
}
function
changeList
(
self
,
list
)
{
console
.
log
(
list
);
self
.
list
=
list
;
self
.
setLoadShowFlag
(
list
.
length
-
self
.
list
.
length
);
self
.
$nextTick
(
function
()
{
...
...
dev/src/view/doorlockManage/v_editName.js
View file @
89f60d04
...
...
@@ -15,14 +15,22 @@ function init() {
uPublic
.
componentsInit
([
'u-text'
,
'u-button'
,
'u-dialog'
,
'u-loading'
]);
const
app
=
new
Vue
({
data
:{
textName
:
'门锁-001'
,
textName
:
iot
.
navigator
.
getExtras
().
nickName
,
textErrorTip
:
null
,
//配置组件
componentsConfig
:
initComponentsConfig
()
componentsConfig
:
initComponentsConfig
(),
extras
:
{}
},
mounted
(){
mounted
(){
this
.
extras
=
iot
.
navigator
.
getExtras
();
},
methods
:{
getTextName
(){
return
this
.
textName
;
},
setTextName
(
text
){
this
.
textName
=
text
;
},
onNameChange
(
text
){
nameChange
(
this
,
text
);
},
...
...
@@ -32,7 +40,7 @@ function init() {
},
//tap 保存
onSaveButtonTap
(){
saveButtonTap
();
saveButtonTap
(
this
);
}
}
}).
$mount
(
'#app'
);
...
...
@@ -78,6 +86,34 @@ function backTap(){
}
//tap 保存
function
saveButtonTap
(){
iot
.
navigator
.
back
();
function
saveButtonTap
(
self
){
uComponents
.
showLoading
(
self
);
iot
.
business
.
device
.
setNickname
({
data
:
{
sds
:
true
,
uuid
:
self
.
extras
.
uuid
,
model
:
self
.
extras
.
model
,
nickname
:
self
.
textName
},
success
:
(
response
)
=>
{
console
.
log
(
"inn"
);
uComponents
.
hideLoading
(
self
);
uComponents
.
openAlert
(
self
,
Vue
.
t
(
'editName.editNameSuccess'
),
{
text
:
Vue
.
t
(
'btn.confirm'
),
callback
:
function
()
{
iot
.
navigator
.
back
();
}
});
},
error
:
(
error
)
=>
{
uComponents
.
hideLoading
(
self
);
uComponents
.
openAlert
(
self
,
Vue
.
t
(
'editName.editNameFailue'
),
{
text
:
Vue
.
t
(
'btn.confirm'
),
callback
:
function
()
{
iot
.
navigator
.
back
();
}
});
},
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
}
});
}
\ No newline at end of file
dev/src/view/doorlockManage/v_index.js
View file @
89f60d04
...
...
@@ -8,6 +8,7 @@
*/
import
{
iot
,
uPublic
,
uComponents
}
from
'../../public/public.js'
;
import
{
projectMethods
}
from
'../../public/components.js'
;
iot
.
ready
(
init
);
function
init
()
{
...
...
@@ -18,11 +19,71 @@ function init() {
const
app
=
new
Vue
({
data
:{
//配置组件
componentsConfig
:
initComponentsConfig
()
},
mounted
(){
componentsConfig
:
initComponentsConfig
(),
//设备列表
deviceList
:
[],
showDeviceList
:
[]
},
mounted
(){
// iot.business.user.reg({
// data:{
// username: '18679022601',
// pwd: '123',
// vcode: '666666'
// },
// success: (response) => {
// console.log('注册成功');
// console.log(response);
// },
// error: (err) => {
// console.log(err);
// },
// complete: () => {
//
// }
// });
uComponents
.
showLoading
(
this
);
iot
.
business
.
user
.
login
({
data
:
{
// sds: true,
username
:
'18679022601'
,
pwd
:
'123'
// userinfo: {
// username: '"18679022601"',
//// pwd: '123'
// nickname: 'zhu',
// head: 'head',
// utoken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjEwMCwiaWF0IjoxNTA1ODE4NDI5LCJleHAiOjE1MDY2ODI0Mjl9.Bhl9TTcT1PUZZdmcPobE3f4OA2IgSURmtHyT2yluBFA'
// }
},
success
:
(
response
)
=>
{
console
.
log
(
response
);
getDeviceList
(
this
);
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
},
complete
:
()
=>
{}
});
// getDeviceList(this);
// window.addEventListener('returnPage',function(event){
// alert("returnPage");
// });
},
methods
:{
getDeviceList
(){
return
this
.
deviceList
;
},
setDeviceList
(
list
){
this
.
deviceList
=
list
;
},
getShowDeviceList
(){
return
this
.
showDeviceList
;
},
setShowDeviceList
(
list
){
this
.
showDeviceList
=
list
;
},
//tap <
onBackTap
(){
backTap
();
...
...
@@ -53,12 +114,8 @@ function initComponentsConfig() {
doorlockList
:
{
initParam
:
{
class
:
''
,
list
:
[{
value
:
1
,
'leftImage'
:
'../../resources/image/device.png'
,
'title'
:
'门锁-001'
,
'buttons'
:
[{
'icon'
:
''
},{
'icon'
:
''
},{
'icon'
:
''
},{
'icon'
:
''
}]},
{
value
:
2
,
'leftImage'
:
'../../resources/image/device.png'
,
'title'
:
'门锁-002'
,
'buttons'
:
[{
'icon'
:
''
},{
'icon'
:
''
},{
'icon'
:
''
},{
'icon'
:
''
}]},
{
value
:
3
,
'leftImage'
:
'../../resources/image/device.png'
,
'title'
:
'门锁-003'
,
'buttons'
:
[{
'icon'
:
''
},{
'icon'
:
''
},{
'icon'
:
''
},{
'icon'
:
''
}]},
{
value
:
4
,
'leftImage'
:
'../../resources/image/device.png'
,
'title'
:
'门锁-004'
,
'buttons'
:
[{
'icon'
:
''
},{
'icon'
:
''
},{
'icon'
:
''
},{
'icon'
:
''
}]},
{
value
:
5
,
'leftImage'
:
'../../resources/image/device.png'
,
'title'
:
'门锁-005'
,
'buttons'
:
[{
'icon'
:
''
},{
'icon'
:
''
},{
'icon'
:
''
},{
'icon'
:
''
}]}],
tip
:
Vue
.
t
(
'doorlockManage.noDeviceTip'
)
list
:
[],
tip
:
Vue
.
t
(
'doorlockManage.noDeviceTip'
)
}
},
//退出系统 button 参数
...
...
@@ -81,6 +138,45 @@ function initComponentsConfig() {
}
}
//获取所有的设备
function
getDeviceList
(
self
){
console
.
log
(
"innn"
);
iot
.
business
.
device
.
getList
({
data
:
{
sds
:
true
,
// product_id: 'product_id',
// parent_id: 0,
// start_id: 0,
// number: 10
},
success
:
(
response
)
=>
{
console
.
log
(
response
);
let
data
=
response
.
data
;
if
(
data
.
length
==
0
||
data
.
hasOwnProperty
(
'msg'
)){
return
false
;
}
else
{
self
.
setDeviceList
(
data
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
){
self
.
getShowDeviceList
().
push
({
value
:
data
[
i
].
uuid
,
leftImage
:
'../../resources/image/device.png'
,
title
:
(
data
[
i
].
nickName
&&
data
[
i
].
nickName
!=
'null'
)
?
data
[
i
].
nickName
:
Vue
.
t
(
'doorlockManage.defaultNickname'
),
buttons
:
[{
'icon'
:
''
},{
'icon'
:
''
},{
'icon'
:
''
},{
'icon'
:
''
}]
});
}
projectMethods
.
changeGridList
(
self
,
self
.
getShowDeviceList
());
uComponents
.
hideLoading
(
self
);
}
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
},
complete
:
()
=>
{
uComponents
.
hideLoading
(
self
);
}
});
}
//tap <
function
backTap
(){
iot
.
navigator
.
back
();
...
...
@@ -108,14 +204,22 @@ function doorlockListButtonTap(self, value, buttonValue) {
if
(
buttonValue
==
'0'
){
iot
.
navigator
.
openWindow
({
url
:
'./editName.html'
,
id
:
'editName'
id
:
'editName'
,
extras
:
{
uuid
:
self
.
getDeviceList
()[
value
].
uuid
,
model
:
self
.
getDeviceList
()[
value
].
model
,
nickName
:
self
.
getDeviceList
()[
value
].
nickName
}
});
}
//tap 生成绑定二维码
else
if
(
buttonValue
==
'1'
){
iot
.
navigator
.
openWindow
({
url
:
'./qrcode.html'
,
id
:
'qrcode'
id
:
'qrcode'
,
extras
:
{
uuid
:
self
.
getDeviceList
()[
value
].
uuid
}
});
}
//tap ID-姓名绑定
...
...
@@ -128,8 +232,12 @@ function doorlockListButtonTap(self, value, buttonValue) {
//tap 删除门锁
else
if
(
buttonValue
==
'3'
){
uComponents
.
openConfirm
(
self
,
Vue
.
t
(
'doorlockManage.deleteDialogTip'
,
[
'门锁-001'
]),
{
text
:
Vue
.
t
(
'dialog.cancel'
),
callback
:
function
()
{}},
{
text
:
Vue
.
t
(
'dialog.confirm'
),
callback
:
function
()
{}}
{
text
:
Vue
.
t
(
'dialog.cancel'
),
callback
:
function
()
{
}},
{
text
:
Vue
.
t
(
'dialog.confirm'
),
callback
:
function
()
{
deleteDoorlook
(
self
,
value
);
}}
);
}
}
...
...
@@ -137,12 +245,58 @@ function doorlockListButtonTap(self, value, buttonValue) {
//tap 退出系统
function
logoutButtonTap
(
self
){
uComponents
.
openConfirm
(
self
,
Vue
.
t
(
'doorlockManage.logoutDialogTip'
),
{
text
:
Vue
.
t
(
'dialog.cancel'
),
callback
:
function
()
{}},
{
text
:
Vue
.
t
(
'dialog.confirm'
),
callback
:
function
()
{
iot
.
navigator
.
openWindow
({
url
:
'../login/login.html'
,
id
:
'login'
});
}}
{
text
:
Vue
.
t
(
'dialog.cancel'
),
callback
:
function
()
{}},
{
text
:
Vue
.
t
(
'dialog.confirm'
),
callback
:
function
()
{
iot
.
business
.
user
.
logout
({
data
:
{
sds
:
true
},
success
:
(
response
)
=>
{
// iot.navigator.openWindow({
// url: '../login/login.html',
// id: 'login'
// });
},
error
:
(
error
)
=>
{},
complete
:
()
=>
{
console
.
log
(
"complete"
);
}
});
}}
);
}
\ No newline at end of file
}
function
deleteDoorlook
(
self
,
index
){
// 显示loading
let
uuId
=
self
.
getDeviceList
()[
index
].
id
;
uComponents
.
showLoading
(
self
);
iot
.
business
.
device
.
unbind
({
data
:
{
sds
:
true
,
uuid
:
self
.
getDeviceList
()[
index
].
uuid
},
success
:
function
(
response
){
console
.
log
(
response
);
self
.
getDeviceList
().
splice
(
index
,
1
);
self
.
getShowDeviceList
().
splice
(
index
,
1
);
rojectMethods
.
changeGridList
(
self
,
self
.
getDeviceList
());
uComponents
.
openAlert
(
self
,
Vue
.
t
(
'doorlockManage.deleteSuccess'
),
{
text
:
Vue
.
t
(
'btn.confirm'
),
callback
:
function
()
{
projectMethods
.
changeGridList
(
self
,
self
.
getShowDeviceList
());
}
});
},
error
:
function
(
err
){
console
.
log
(
err
);
uComponents
.
openAlert
(
self
,
Vue
.
t
(
'doorlockManage.editNameFailue'
),
{
text
:
Vue
.
t
(
'btn.confirm'
),
callback
:
function
()
{
uComponents
.
hideLoading
(
self
);
}
});
},
complete
:
function
(){
console
.
log
(
"complete"
);
uComponents
.
hideLoading
(
self
);
}
});
}
dev/src/view/doorlockManage/v_qrcode.js
View file @
89f60d04
...
...
@@ -7,8 +7,9 @@
* 生成绑定二维码页面
*/
var
QRCode
=
require
(
'qrcode'
);
console
.
log
(
QRCode
);
import
{
iot
,
uPublic
,
uComponents
}
from
'../../public/public.js'
;
iot
.
ready
(
init
);
function
init
()
{
//通用 按钮、dialog、loading组件
...
...
@@ -16,18 +17,34 @@ function init() {
const
app
=
new
Vue
({
data
:{
//配置组件
componentsConfig
:
initComponentsConfig
()
componentsConfig
:
initComponentsConfig
(),
//页面传递参数
extras
:
[],
uuid
:
null
,
qrCodeDisabled
:
false
},
mounted
(){
mounted
(){
this
.
extras
=
iot
.
navigator
.
getExtras
();
console
.
log
(
this
.
extras
);
this
.
setUuid
(
this
.
extras
.
uuid
);
},
methods
:{
getUuid
(){
return
this
.
uuid
;
},
setUuid
(
id
){
this
.
uuid
=
id
;
},
setQrCodeDisabled
(
boolean
){
this
.
qrCodeDisabled
=
boolean
;
},
//tap <
onBackTap
(){
backTap
();
},
//tap 生成二维码
onQRcodeButtonTap
(){
qrcodeButtonTap
();
qrcodeButtonTap
(
this
);
}
}
}).
$mount
(
'#app'
);
...
...
@@ -62,6 +79,28 @@ function backTap(){
}
//tap 生成二维码
function
qrcodeButtonTap
(){
alert
(
"生成二维码"
);
function
qrcodeButtonTap
(
self
){
iot
.
business
.
sds
.
saveqr
({
data
:
{
uuid
:
self
.
getUuid
()
},
success
:
(
response
)
=>
{
console
.
log
(
response
);
let
qrKey
=
response
.
data
.
qrKey
;
var
qr
=
self
.
$refs
.
qrcode
;
QRCode
.
toCanvas
(
qr
,
qrKey
,
(
error
)
=>
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
console
.
log
(
'success'
)
setTimeout
(()
=>
{
self
.
setQrCodeDisabled
(
true
);
},
1000
*
60
*
10
);
}
});
},
error
:
(
error
)
=>
{
console
.
log
(
error
);
}
});
}
\ No newline at end of file
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