Commit 25f89540 by 朱建香

基本功能:1.wifi绑定设备

          2.扫一扫绑定设备
          3.查看开门记录、安全报警、劫持报警
          4.查看门锁用户列表
          5.查看已绑定的开锁信息、添加绑定开锁信息
          6.查看个人开门历史记录、管理员修改用户名称
          7.管理邀请普通用户绑定、管理员解绑普通用户、管理员删除用户
          8.远程开门下发信息
          9.门锁管理:更改设备昵称、解绑门锁
          10.个人信息:修改用户昵称、退出系统
parent 0b2f0ad1
......@@ -136,21 +136,7 @@ function backTap(){
//tap 连接
function connectButtonTap(self){
// uComponents.showCommstatusloading(self);
// setTimeout(function(){
// self.setTextLoading(Vue.t('commstatusLoading.connectSuccess'));
// setTimeout(function(){
// //绑定成功
// self.setStatus(1);
// self.setTextLoading(Vue.t('commstatusLoading.bindSuccess'));
// //绑定失败
// //self.setStatus(2);
// //self.setTextLoading(Vue.t('commstatusLoading.bindFailed'));
// //uComponents.changeCommstatusButtonText(self,Vue.t('btn.reBound'));
// },3000);
// },3000);
console.log(self.getTextWiFiName());
// self.setTextPassword('macro_scope00');
console.log(self.getTextPassword());
if(self.getTextPassword() == null || self.getTextPassword().trim() == ''){
......@@ -226,8 +212,6 @@ function connectButtonTap(self){
}
}
//tap loading button
function commLoadingButtonTap(self) {
if(self.getStatus() == 1){
......@@ -243,47 +227,22 @@ function commLoadingButtonTap(self) {
}
}
function unbind(self, deviceId, productId){
iot.business.api.sendCustom('lock/getLockInfo',{
data: {
device_id: self.deviceId
},
success: (response) => {
console.log(response);
let data = uPublic.checkResponseData(response.data);
if(data){
if(data.lock_id){
iot.business.api.sendCustom('lock/unbind',{
data: {
device_sn: self.getDoorlock().device_id,
device_id: self.getDoorlock().id
},
success: (response) => {
console.log(response);
bind(self, deviceId, productId);
},
error: (error) => {
console.log(error);
},
complete: () => {
}
});
}else{
bind(self, deviceId, productId);
}
}else{
bind(self, deviceId, productId);
}
},
error: (error) => {
console.log(error);
},
complete: () => {
}
console.log(deviceId);
iot.business.api.sendCustom('lock/unbindDevice',{
data: {
device_sn: deviceId
},
success: (response) => {
console.log(response);
bind(self, deviceId, productId);
},
error: (error) => {
console.log(error);
},
complete: () => {
}
});
}
function bind(self, deviceId, productId){
......
......@@ -518,7 +518,8 @@ function remoteOpendoorTap(self){
url: './remoteOpendoor.html',
id: 'remoteOpendoor',
extras: {
uuid: self.getUuid()
uuid: self.getUuid(),
deviceId: self.deviceId,
}
});
}
......
......@@ -24,29 +24,12 @@ function init() {
//配置组件
componentsConfig: initComponentsConfig(),
//设备uuid
uuid: null
uuid: null,
deviceId: null
},
mounted(){
resolve(this);
let a = {"mac":"B0F89310DDF2","productId":"10002","productSecret":"WABK8XXEEKKLL5MM"};
// let message = JSON.stringify(a);
// let key = CryptoJS.enc.Utf8.parse('9y5Yj3h8f3790cs6');
// let iv = CryptoJS.enc.Utf8.parse('e36de93cf0e08873');
// let b = CryptoJS.AES.encrypt(message, key, { iv: iv},{ mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.nopadding });
// console.log(b.toString());
// let c = new crypto('B0:F8:93:10:D5:09');
// c.enkey();
// let code = c.encode(a);
// console.log(code);
// let msg = c.decode(code);
// console.log(msg);
let keyIv = crypto.enkey('B0:F8:93:10:D5:09'.replace(/:/g,''));
console.log(keyIv);
let code = crypto.encode(a, keyIv);
console.log(code);
let msg = crypto.decode(code, keyIv);
console.log(msg);
},
methods:{
getTextPassword(){
......@@ -82,6 +65,12 @@ function init() {
setUuid(id){
this.uuid = id;
},
getDeviceId(){
return this.deviceId;
},
setDeviceId(id){
this.deviceId = id;
},
//tap <
onBackTap(){
backTap();
......@@ -133,6 +122,7 @@ function initComponentsConfig() {
function resolve(self){
let extras = iot.navigator.getExtras();
self.setUuid(extras.uuid);
self.setDeviceId(extras.deviceId);
console.log(self.getUuid());
}
......@@ -154,6 +144,13 @@ function confirmButtonTap(self){
self.setTextErrorTip(Vue.t('remoteOpendoor.error.noPasswordTip'));
}else{
uComponents.showLoading(self);
console.log(self.getDeviceId());
let keyIv = crypto.enkey(self.getDeviceId().replace(/:/g,''));
console.log(keyIv);
let pwd = crypto.encode(self.getTextPassword(), keyIv);
console.log(pwd);
// let msg = crypto.decode(pwd, keyIv);
// console.log(msg);
iot.business.sds.setDeviceStatus({
data: {
uuid: self.getUuid(),
......@@ -162,7 +159,7 @@ function confirmButtonTap(self){
'value': 'openDoor'
},
'remote_open_door': {
'value': self.getTextPassword()
'value': pwd
}
}
},
......
......@@ -41,8 +41,7 @@ function init() {
getUserInfo(self);
});
getUserInfo(this);
// showGuide(this);
checkFirstAddUser(this);
},
methods:{
getBindShowFlag(){
......@@ -412,6 +411,11 @@ function nextButtonTap(self){
//tap 我知道了
function iSeeButtonTap(self){
self.setGuideShowFlag(false);
iot.storage.setMap('isFirstAddUser', true,() => {
}, () => {
});
}
//删除用户
......
......@@ -22,7 +22,7 @@ function init() {
userListIndex: null,
loadShowFlag: false,
loadFlag: false,
loadText: 'loading',
loadText: '',
pagesize: 10,
tip: '无数据',
extras: {},
......@@ -83,17 +83,14 @@ function init() {
swipeRightRow(this);
},
onTapLoad(){
tapLoad();
// tapLoad();
},
onTapUserList(index){
onTapUserList(this, index);
},
onTapButton(index){
tapButton(this, index);
},
changeUserList(list){
changeUserList(this, list);
}
}
}
}).$mount('#app');
......@@ -117,7 +114,6 @@ function initComponentsConfig() {
//获取用户列表
function getUserList(self){
console.log(self.extras);
uComponents.showLoading(self);
iot.business.api.sendCustom('lock/getLockUser',{
data: {
......@@ -128,12 +124,7 @@ function getUserList(self){
let data = uPublic.checkResponseData(response.data);
console.log(data);
if(data){
if(self.extras.role){
sortUsers(self,data);
}else{
data = data.sort(sortRule);
setUserData(self, data);
}
sortUsers(self,data);
}
},
error: (error) => {
......@@ -183,6 +174,7 @@ async function sortUsers(self, data){
}
}
manage = manage.sort(sortRule);
console.log(manage);
data = manage.concat(users);
setUserData(self, data);
}
......@@ -246,14 +238,6 @@ function onTapUserList(self, listIndex) {
self.userListIndex = null;
}
}
//点击加载更多
function tapLoad(){
if (!self.loadFlag) {
self.loadText = 'loading';
self.loadFlag = true;
//再次发送获取用户列表请求
}
}
//点击按钮
function tapButton(self, index){
......@@ -267,16 +251,6 @@ function tapButton(self, index){
);
}
// 修改userList列表
function changeUserList(self, list) {
self.setLoadShowFlag(list.length - self.swipeList.length);
self.userList = list;
self.$nextTick(function () {
self.loadText = '点击加载更多';
self.loadFlag = false;
});
}
//删除用户
function deleteUser(self, index){
uComponents.showLoading(self);
......
......@@ -16427,7 +16427,8 @@ function remoteOpendoorTap(self) {
url: './remoteOpendoor.html',
id: 'remoteOpendoor',
extras: {
uuid: self.getUuid()
uuid: self.getUuid(),
deviceId: self.deviceId
}
});
}
......
......@@ -1808,28 +1808,12 @@ function init() {
//配置组件
componentsConfig: initComponentsConfig(),
//设备uuid
uuid: null
uuid: null,
deviceId: null
},
mounted: function mounted() {
resolve(this);
var a = { "mac": "B0F89310DDF2", "productId": "10002", "productSecret": "WABK8XXEEKKLL5MM" };
// let message = JSON.stringify(a);
// let key = CryptoJS.enc.Utf8.parse('9y5Yj3h8f3790cs6');
// let iv = CryptoJS.enc.Utf8.parse('e36de93cf0e08873');
// let b = CryptoJS.AES.encrypt(message, key, { iv: iv},{ mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.nopadding });
// console.log(b.toString());
// let c = new crypto('B0:F8:93:10:D5:09');
// c.enkey();
// let code = c.encode(a);
// console.log(code);
// let msg = c.decode(code);
// console.log(msg);
var keyIv = _crypto2.default.enkey('B0:F8:93:10:D5:09'.replace(/:/g, ''));
console.log(keyIv);
var code = _crypto2.default.encode(a, keyIv);
console.log(code);
var msg = _crypto2.default.decode(code, keyIv);
console.log(msg);
},
methods: (_methods = {
......@@ -1863,6 +1847,10 @@ function init() {
return this.uuid;
}), _defineProperty(_methods, 'setUuid', function setUuid(id) {
this.uuid = id;
}), _defineProperty(_methods, 'getDeviceId', function getDeviceId() {
return this.deviceId;
}), _defineProperty(_methods, 'setDeviceId', function setDeviceId(id) {
this.deviceId = id;
}), _defineProperty(_methods, 'onBackTap', function onBackTap() {
backTap();
}), _defineProperty(_methods, 'onConfirmButtonTap', function onConfirmButtonTap() {
......@@ -1910,6 +1898,7 @@ function initComponentsConfig() {
function resolve(self) {
var extras = _public.iot.navigator.getExtras();
self.setUuid(extras.uuid);
self.setDeviceId(extras.deviceId);
console.log(self.getUuid());
}
......@@ -1931,6 +1920,13 @@ function confirmButtonTap(self) {
self.setTextErrorTip(Vue.t('remoteOpendoor.error.noPasswordTip'));
} else {
_public.uComponents.showLoading(self);
console.log(self.getDeviceId());
var keyIv = _crypto2.default.enkey(self.getDeviceId().replace(/:/g, ''));
console.log(keyIv);
var pwd = _crypto2.default.encode(self.getTextPassword(), keyIv);
console.log(pwd);
// let msg = crypto.decode(pwd, keyIv);
// console.log(msg);
_public.iot.business.sds.setDeviceStatus({
data: {
uuid: self.getUuid(),
......@@ -1939,7 +1935,7 @@ function confirmButtonTap(self) {
'value': 'openDoor'
},
'remote_open_door': {
'value': self.getTextPassword()
'value': pwd
}
}
},
......
......@@ -835,7 +835,7 @@ function init() {
getUserInfo(self);
});
getUserInfo(this);
// showGuide(this);
checkFirstAddUser(this);
},
methods: {
......@@ -1255,6 +1255,7 @@ function nextButtonTap(self) {
//tap 我知道了
function iSeeButtonTap(self) {
self.setGuideShowFlag(false);
_public.iot.storage.setMap('isFirstAddUser', true, function () {}, function () {});
}
//删除用户
......
......@@ -820,7 +820,7 @@ function init() {
userListIndex: null,
loadShowFlag: false,
loadFlag: false,
loadText: 'loading',
loadText: '',
pagesize: 10,
tip: '无数据',
extras: {},
......@@ -882,16 +882,13 @@ function init() {
swipeRightRow(this);
},
onTapLoad: function onTapLoad() {
tapLoad();
// tapLoad();
},
onTapUserList: function onTapUserList(index) {
_onTapUserList(this, index);
},
onTapButton: function onTapButton(index) {
tapButton(this, index);
},
changeUserList: function changeUserList(list) {
_changeUserList(this, list);
}
}
......@@ -916,7 +913,6 @@ function initComponentsConfig() {
//获取用户列表
function getUserList(self) {
console.log(self.extras);
_public.uComponents.showLoading(self);
_public.iot.business.api.sendCustom('lock/getLockUser', {
data: {
......@@ -927,12 +923,7 @@ function getUserList(self) {
var data = _public.uPublic.checkResponseData(response.data);
console.log(data);
if (data) {
if (self.extras.role) {
sortUsers(self, data);
} else {
data = data.sort(sortRule);
setUserData(self, data);
}
sortUsers(self, data);
}
},
error: function error(_error) {
......@@ -998,10 +989,11 @@ function sortUsers(self, data) {
}
}
manage = manage.sort(sortRule);
console.log(manage);
data = manage.concat(users);
setUserData(self, data);
case 16:
case 17:
case 'end':
return _context.stop();
}
......@@ -1068,14 +1060,6 @@ function _onTapUserList(self, listIndex) {
self.userListIndex = null;
}
}
//点击加载更多
function tapLoad() {
if (!self.loadFlag) {
self.loadText = 'loading';
self.loadFlag = true;
//再次发送获取用户列表请求
}
}
//点击按钮
function tapButton(self, index) {
......@@ -1086,16 +1070,6 @@ function tapButton(self, index) {
} });
}
// 修改userList列表
function _changeUserList(self, list) {
self.setLoadShowFlag(list.length - self.swipeList.length);
self.userList = list;
self.$nextTick(function () {
self.loadText = '点击加载更多';
self.loadFlag = false;
});
}
//删除用户
function deleteUser(self, index) {
_public.uComponents.showLoading(self);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment