Commit 25f89540 by 朱建香

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

          2.扫一扫绑定设备
          3.查看开门记录、安全报警、劫持报警
          4.查看门锁用户列表
          5.查看已绑定的开锁信息、添加绑定开锁信息
          6.查看个人开门历史记录、管理员修改用户名称
          7.管理邀请普通用户绑定、管理员解绑普通用户、管理员删除用户
          8.远程开门下发信息
          9.门锁管理:更改设备昵称、解绑门锁
          10.个人信息:修改用户昵称、退出系统
parent 0b2f0ad1
...@@ -136,21 +136,7 @@ function backTap(){ ...@@ -136,21 +136,7 @@ function backTap(){
//tap 连接 //tap 连接
function connectButtonTap(self){ 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()); console.log(self.getTextWiFiName());
// self.setTextPassword('macro_scope00'); // self.setTextPassword('macro_scope00');
console.log(self.getTextPassword()); console.log(self.getTextPassword());
if(self.getTextPassword() == null || self.getTextPassword().trim() == ''){ if(self.getTextPassword() == null || self.getTextPassword().trim() == ''){
...@@ -226,8 +212,6 @@ function connectButtonTap(self){ ...@@ -226,8 +212,6 @@ function connectButtonTap(self){
} }
} }
//tap loading button //tap loading button
function commLoadingButtonTap(self) { function commLoadingButtonTap(self) {
if(self.getStatus() == 1){ if(self.getStatus() == 1){
...@@ -243,47 +227,22 @@ function commLoadingButtonTap(self) { ...@@ -243,47 +227,22 @@ function commLoadingButtonTap(self) {
} }
} }
function unbind(self, deviceId, productId){ function unbind(self, deviceId, productId){
iot.business.api.sendCustom('lock/getLockInfo',{ console.log(deviceId);
data: { iot.business.api.sendCustom('lock/unbindDevice',{
device_id: self.deviceId data: {
}, device_sn: deviceId
success: (response) => { },
console.log(response); success: (response) => {
let data = uPublic.checkResponseData(response.data); console.log(response);
if(data){ bind(self, deviceId, productId);
if(data.lock_id){ },
iot.business.api.sendCustom('lock/unbind',{ error: (error) => {
data: { console.log(error);
device_sn: self.getDoorlock().device_id, },
device_id: self.getDoorlock().id complete: () => {
}, }
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: () => {
}
}); });
} }
function bind(self, deviceId, productId){ function bind(self, deviceId, productId){
......
...@@ -518,7 +518,8 @@ function remoteOpendoorTap(self){ ...@@ -518,7 +518,8 @@ function remoteOpendoorTap(self){
url: './remoteOpendoor.html', url: './remoteOpendoor.html',
id: 'remoteOpendoor', id: 'remoteOpendoor',
extras: { extras: {
uuid: self.getUuid() uuid: self.getUuid(),
deviceId: self.deviceId,
} }
}); });
} }
......
...@@ -24,29 +24,12 @@ function init() { ...@@ -24,29 +24,12 @@ function init() {
//配置组件 //配置组件
componentsConfig: initComponentsConfig(), componentsConfig: initComponentsConfig(),
//设备uuid //设备uuid
uuid: null uuid: null,
deviceId: null
}, },
mounted(){ mounted(){
resolve(this); resolve(this);
let a = {"mac":"B0F89310DDF2","productId":"10002","productSecret":"WABK8XXEEKKLL5MM"}; 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:{ methods:{
getTextPassword(){ getTextPassword(){
...@@ -82,6 +65,12 @@ function init() { ...@@ -82,6 +65,12 @@ function init() {
setUuid(id){ setUuid(id){
this.uuid = id; this.uuid = id;
}, },
getDeviceId(){
return this.deviceId;
},
setDeviceId(id){
this.deviceId = id;
},
//tap < //tap <
onBackTap(){ onBackTap(){
backTap(); backTap();
...@@ -133,6 +122,7 @@ function initComponentsConfig() { ...@@ -133,6 +122,7 @@ function initComponentsConfig() {
function resolve(self){ function resolve(self){
let extras = iot.navigator.getExtras(); let extras = iot.navigator.getExtras();
self.setUuid(extras.uuid); self.setUuid(extras.uuid);
self.setDeviceId(extras.deviceId);
console.log(self.getUuid()); console.log(self.getUuid());
} }
...@@ -154,6 +144,13 @@ function confirmButtonTap(self){ ...@@ -154,6 +144,13 @@ function confirmButtonTap(self){
self.setTextErrorTip(Vue.t('remoteOpendoor.error.noPasswordTip')); self.setTextErrorTip(Vue.t('remoteOpendoor.error.noPasswordTip'));
}else{ }else{
uComponents.showLoading(self); 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({ iot.business.sds.setDeviceStatus({
data: { data: {
uuid: self.getUuid(), uuid: self.getUuid(),
...@@ -162,7 +159,7 @@ function confirmButtonTap(self){ ...@@ -162,7 +159,7 @@ function confirmButtonTap(self){
'value': 'openDoor' 'value': 'openDoor'
}, },
'remote_open_door': { 'remote_open_door': {
'value': self.getTextPassword() 'value': pwd
} }
} }
}, },
......
...@@ -41,8 +41,7 @@ function init() { ...@@ -41,8 +41,7 @@ function init() {
getUserInfo(self); getUserInfo(self);
}); });
getUserInfo(this); getUserInfo(this);
// showGuide(this); checkFirstAddUser(this);
}, },
methods:{ methods:{
getBindShowFlag(){ getBindShowFlag(){
...@@ -412,6 +411,11 @@ function nextButtonTap(self){ ...@@ -412,6 +411,11 @@ function nextButtonTap(self){
//tap 我知道了 //tap 我知道了
function iSeeButtonTap(self){ function iSeeButtonTap(self){
self.setGuideShowFlag(false); self.setGuideShowFlag(false);
iot.storage.setMap('isFirstAddUser', true,() => {
}, () => {
});
} }
//删除用户 //删除用户
......
...@@ -22,7 +22,7 @@ function init() { ...@@ -22,7 +22,7 @@ function init() {
userListIndex: null, userListIndex: null,
loadShowFlag: false, loadShowFlag: false,
loadFlag: false, loadFlag: false,
loadText: 'loading', loadText: '',
pagesize: 10, pagesize: 10,
tip: '无数据', tip: '无数据',
extras: {}, extras: {},
...@@ -83,17 +83,14 @@ function init() { ...@@ -83,17 +83,14 @@ function init() {
swipeRightRow(this); swipeRightRow(this);
}, },
onTapLoad(){ onTapLoad(){
tapLoad(); // tapLoad();
}, },
onTapUserList(index){ onTapUserList(index){
onTapUserList(this, index); onTapUserList(this, index);
}, },
onTapButton(index){ onTapButton(index){
tapButton(this, index); tapButton(this, index);
}, }
changeUserList(list){
changeUserList(this, list);
}
} }
}).$mount('#app'); }).$mount('#app');
...@@ -117,7 +114,6 @@ function initComponentsConfig() { ...@@ -117,7 +114,6 @@ function initComponentsConfig() {
//获取用户列表 //获取用户列表
function getUserList(self){ function getUserList(self){
console.log(self.extras);
uComponents.showLoading(self); uComponents.showLoading(self);
iot.business.api.sendCustom('lock/getLockUser',{ iot.business.api.sendCustom('lock/getLockUser',{
data: { data: {
...@@ -128,12 +124,7 @@ function getUserList(self){ ...@@ -128,12 +124,7 @@ function getUserList(self){
let data = uPublic.checkResponseData(response.data); let data = uPublic.checkResponseData(response.data);
console.log(data); console.log(data);
if(data){ if(data){
if(self.extras.role){ sortUsers(self,data);
sortUsers(self,data);
}else{
data = data.sort(sortRule);
setUserData(self, data);
}
} }
}, },
error: (error) => { error: (error) => {
...@@ -183,6 +174,7 @@ async function sortUsers(self, data){ ...@@ -183,6 +174,7 @@ async function sortUsers(self, data){
} }
} }
manage = manage.sort(sortRule); manage = manage.sort(sortRule);
console.log(manage);
data = manage.concat(users); data = manage.concat(users);
setUserData(self, data); setUserData(self, data);
} }
...@@ -246,14 +238,6 @@ function onTapUserList(self, listIndex) { ...@@ -246,14 +238,6 @@ function onTapUserList(self, listIndex) {
self.userListIndex = null; self.userListIndex = null;
} }
} }
//点击加载更多
function tapLoad(){
if (!self.loadFlag) {
self.loadText = 'loading';
self.loadFlag = true;
//再次发送获取用户列表请求
}
}
//点击按钮 //点击按钮
function tapButton(self, index){ function tapButton(self, index){
...@@ -267,16 +251,6 @@ 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){ function deleteUser(self, index){
uComponents.showLoading(self); uComponents.showLoading(self);
......
...@@ -25,299 +25,264 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de ...@@ -25,299 +25,264 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
_public.iot.ready(init); _public.iot.ready(init);
function init() { function init() {
//通用 input、按钮、dialog、loading组件 //通用 input、按钮、dialog、loading组件
_public.uPublic.componentsInit(['u-text', 'u-button', 'u-comm-loading', 'u-dialog', 'u-loading']); _public.uPublic.componentsInit(['u-text', 'u-button', 'u-comm-loading', 'u-dialog', 'u-loading']);
var app = new Vue({ var app = new Vue({
data: { data: {
textWiFiName: null, textWiFiName: null,
textPassword: null, textPassword: null,
textErrorTip: null, textErrorTip: null,
//配置组件 //配置组件
componentsConfig: initComponentsConfig(), componentsConfig: initComponentsConfig(),
status: 0 status: 0
}, },
mounted: function mounted() { mounted: function mounted() {
resolve(this); resolve(this);
}, },
methods: { methods: {
getTextWiFiName: function getTextWiFiName() { getTextWiFiName: function getTextWiFiName() {
return this.textWiFiName; return this.textWiFiName;
}, },
setTextWiFiName: function setTextWiFiName(text) { setTextWiFiName: function setTextWiFiName(text) {
this.textWiFiName = text; this.textWiFiName = text;
}, },
getTextPassword: function getTextPassword() { getTextPassword: function getTextPassword() {
return this.textPassword; return this.textPassword;
}, },
setTextPassword: function setTextPassword(pwd) { setTextPassword: function setTextPassword(pwd) {
this.textPassword = pwd; this.textPassword = pwd;
}, },
gettTextErrorTip: function gettTextErrorTip() { gettTextErrorTip: function gettTextErrorTip() {
return this.textErrorTip; return this.textErrorTip;
}, },
setTextErrorTip: function setTextErrorTip(tip) { setTextErrorTip: function setTextErrorTip(tip) {
this.textErrorTip = tip; this.textErrorTip = tip;
}, },
getStatus: function getStatus() { getStatus: function getStatus() {
return this.status; return this.status;
}, },
setStatus: function setStatus(status) { setStatus: function setStatus(status) {
this.status = status; this.status = status;
}, },
onPasswordChange: function onPasswordChange(text) { onPasswordChange: function onPasswordChange(text) {
passwordChange(this, text); passwordChange(this, text);
}, },
//tap < //tap <
onBackTap: function onBackTap() { onBackTap: function onBackTap() {
backTap(); backTap();
}, },
//tap 连接 //tap 连接
onConnectButtonTap: function onConnectButtonTap() { onConnectButtonTap: function onConnectButtonTap() {
connectButtonTap(this); connectButtonTap(this);
}, },
//tap loading button //tap loading button
onCommLoadingButtonTap: function onCommLoadingButtonTap() { onCommLoadingButtonTap: function onCommLoadingButtonTap() {
commLoadingButtonTap(this); commLoadingButtonTap(this);
} }
} }
}).$mount('#app'); }).$mount('#app');
} }
//配置组件参数 //配置组件参数
function initComponentsConfig() { function initComponentsConfig() {
return { return {
passwordInput: { passwordInput: {
initParam: { initParam: {
class: 'custom-password-text', class: 'custom-password-text',
icon: '&#xe64d;', icon: '&#xe64d;',
placeholder: Vue.t('wifiAdd.passwordInputTip'), placeholder: Vue.t('wifiAdd.passwordInputTip'),
type: 'password' type: 'password'
} }
}, },
//连接 button 参数 //连接 button 参数
connectButton: { connectButton: {
initParam: { initParam: {
class: 'custom-button', class: 'custom-button',
text: Vue.t('btn.connect') text: Vue.t('btn.connect')
} }
}, },
dialog: { dialog: {
initParam: { initParam: {
class: 'custom-dialog' class: 'custom-dialog'
} }
}, },
loading: { loading: {
initParam: { initParam: {
class: 'custom-loading' class: 'custom-loading'
} }
}, },
ucommloading: { ucommloading: {
initParam: { initParam: {
class: 'custom-comm-loading', class: 'custom-comm-loading',
buttonText: Vue.t('btn.confirm'), buttonText: Vue.t('btn.confirm'),
text: 'loading', text: 'loading',
status: 0 status: 0
} }
} }
}; };
} }
function resolve(self) { function resolve(self) {
_public.iot.business.sds.getSSId({ _public.iot.business.sds.getSSId({
success: function success(response) { success: function success(response) {
console.log(response); console.log(response);
self.textWiFiName = response.data.ssid; self.textWiFiName = response.data.ssid;
console.log(self.textWiFiName); console.log(self.textWiFiName);
}, },
error: function error(_error) { error: function error(_error) {
console.log(_error); console.log(_error);
_public.uPublic.openRequestErrorAlert(self); _public.uPublic.openRequestErrorAlert(self);
} }
}); });
} }
function passwordChange(self, text) { function passwordChange(self, text) {
self.textPassword = text; self.textPassword = text;
console.log('passwordChange: ' + self.textPassword); console.log('passwordChange: ' + self.textPassword);
} }
//tap < //tap <
function backTap() { function backTap() {
_public.iot.navigator.back(); _public.iot.navigator.back();
} }
//tap 连接 //tap 连接
function connectButtonTap(self) { function connectButtonTap(self) {
// uComponents.showCommstatusloading(self); console.log(self.getTextWiFiName());
// setTimeout(function(){ // self.setTextPassword('macro_scope00');
// self.setTextLoading(Vue.t('commstatusLoading.connectSuccess')); console.log(self.getTextPassword());
// setTimeout(function(){ if (self.getTextPassword() == null || self.getTextPassword().trim() == '') {
// //绑定成功 self.setTextErrorTip(Vue.t('wifiAdd.passwordInputTip'));
// self.setStatus(1); } else {
// self.setTextLoading(Vue.t('commstatusLoading.bindSuccess')); _public.iot.business.sds.findWifi({
// //绑定失败 data: {
// //self.setStatus(2); model: _config2.default.mode,
// //self.setTextLoading(Vue.t('commstatusLoading.bindFailed')); ssid: self.getTextWiFiName(),
// //uComponents.changeCommstatusButtonText(self,Vue.t('btn.reBound')); wifiPwd: self.getTextPassword(),
// },3000); timeout: 20000
// },3000); },
console.log(self.getTextWiFiName()); success: function success(response) {
console.log("findWifi");
// self.setTextPassword('macro_scope00'); console.log(response);
console.log(self.getTextPassword()); if (response.data == 'onProvisioning') {
if (self.getTextPassword() == null || self.getTextPassword().trim() == '') { //wifi链接中
self.setTextErrorTip(Vue.t('wifiAdd.passwordInputTip')); _public.uComponents.showCommLoading(self);
} else { } else if (response.data == 'provisioned success') {
_public.iot.business.sds.findWifi({ //wifi连接成功,停止连接wifi
data: { // iot.business.sds.stopFindWifi({
model: _config2.default.mode, // success: (response) => {},
ssid: self.getTextWiFiName(), // error: (error) => {}
wifiPwd: self.getTextPassword(), // });
timeout: 20000 }
}, },
success: function success(response) { error: function error(_error2) {
console.log("findWifi"); console.log(_error2);
console.log(response); }
if (response.data == 'onProvisioning') { });
//wifi链接中 var deviceId = null;
_public.uComponents.showCommLoading(self); _public.iot.business.sds.findDevices({
} else if (response.data == 'provisioned success') { success: function success(response) {
//wifi连接成功,停止连接wifi console.log("findDevices");
// iot.business.sds.stopFindWifi({ console.log(response);
// success: (response) => {}, var parameters = {};
// error: (error) => {} if (response.data) {
// }); var info = response.data.split(':[');
} if (info[1]) {
}, var query = info[1].split(',');
error: function error(_error2) { console.log(query);
console.log(_error2); for (var i = 0; i < query.length; i++) {
} var pari = query[i].split(' = ');
}); console.log(pari);
var deviceId = null; parameters[pari[0]] = pari[1];
_public.iot.business.sds.findDevices({ }
success: function success(response) { console.log(parameters.sn);
console.log("findDevices"); }
console.log(response); }
var parameters = {}; if (parameters.sn) {
if (response.data) { deviceId = parameters.sn;
var info = response.data.split(':['); }
if (info[1]) { var productId = _config2.default.mode.substr(_config2.default.mode_type.length, 6);
var query = info[1].split(','); if (response.data == "joined success") {
console.log(query); unbind(self, deviceId, productId);
for (var i = 0; i < query.length; i++) { // bind(self, deviceId, productId);
var pari = query[i].split(' = '); } else if (response.data == "fail") {
console.log(pari); //连接失败
parameters[pari[0]] = pari[1]; _public.uComponents.changeCommLoadingStatusAndText(self, 2, Vue.t('addDevice.bindFailure'));
} self.setStatus(2);
console.log(parameters.sn); _public.uComponents.changeCommButtonText(Vue.t('addDevice.reBindDevice'));
} //停止查找设备
} _public.iot.business.sds.stopFindDevices({
if (parameters.sn) { success: function success(response) {},
deviceId = parameters.sn; error: function error(_error3) {}
} });
var productId = _config2.default.mode.substr(_config2.default.mode_type.length, 6); }
if (response.data == "joined success") { },
unbind(self, deviceId, productId); error: function error(_error4) {
// bind(self, deviceId, productId); console.log(_error4);
} else if (response.data == "fail") { }
//连接失败 });
_public.uComponents.changeCommLoadingStatusAndText(self, 2, Vue.t('addDevice.bindFailure'));
self.setStatus(2);
_public.uComponents.changeCommButtonText(Vue.t('addDevice.reBindDevice'));
//停止查找设备
_public.iot.business.sds.stopFindDevices({
success: function success(response) {},
error: function error(_error3) {}
});
} }
},
error: function error(_error4) {
console.log(_error4);
}
});
}
} }
//tap loading button //tap loading button
function commLoadingButtonTap(self) { function commLoadingButtonTap(self) {
if (self.getStatus() == 1) { if (self.getStatus() == 1) {
//绑定成功 //绑定成功
_public.uComponents.hideCommLoading(self); _public.uComponents.hideCommLoading(self);
_public.iot.navigator.openWindow({ _public.iot.navigator.openWindow({
url: '../device/index.html', url: '../device/index.html',
id: 'device' id: 'device'
}); });
} else if (self.getStatus() == 2) { } else if (self.getStatus() == 2) {
//绑定失败 //绑定失败
_public.uComponents.hideCommLoading(self); _public.uComponents.hideCommLoading(self);
} }
} }
function unbind(self, deviceId, productId) { function unbind(self, deviceId, productId) {
_public.iot.business.api.sendCustom('lock/getLockInfo', { console.log(deviceId);
data: { _public.iot.business.api.sendCustom('lock/unbindDevice', {
device_id: self.deviceId data: {
}, device_sn: deviceId
success: function success(response) { },
console.log(response); success: function success(response) {
var data = _public.uPublic.checkResponseData(response.data); console.log(response);
if (data) { bind(self, deviceId, productId);
if (data.lock_id) { },
_public.iot.business.api.sendCustom('lock/unbind', { error: function error(_error5) {
data: { console.log(_error5);
device_sn: self.getDoorlock().device_id, },
device_id: self.getDoorlock().id complete: function complete() {}
}, });
success: function success(response) {
console.log(response);
bind(self, deviceId, productId);
},
error: function error(_error5) {
console.log(_error5);
},
complete: function complete() {}
});
} else {
bind(self, deviceId, productId);
}
} else {
bind(self, deviceId, productId);
}
},
error: function error(_error6) {
console.log(_error6);
},
complete: function complete() {}
});
} }
function bind(self, deviceId, productId) { function bind(self, deviceId, productId) {
_public.iot.business.api.sendCustom('lock/bind', { _public.iot.business.api.sendCustom('lock/bind', {
data: { data: {
product_id: productId, product_id: productId,
device_id: deviceId, device_id: deviceId,
// mac: parameters.mac, // mac: parameters.mac,
nickname: '' nickname: ''
}, },
success: function success(response) { success: function success(response) {
console.log(response); console.log(response);
var data = response.data; var data = response.data;
if (data.success) { if (data.success) {
_public.uComponents.changeCommLoadingStatusAndText(self, 1, Vue.t('addDevice.bindSuccess')); _public.uComponents.changeCommLoadingStatusAndText(self, 1, Vue.t('addDevice.bindSuccess'));
self.setStatus(1); self.setStatus(1);
} }
}, },
error: function error(_error7) { error: function error(_error6) {
console.log(_error7); console.log(_error6);
_public.uComponents.changeCommLoadingStatusAndText(self, 2, Vue.t('addDevice.bindFailure')); _public.uComponents.changeCommLoadingStatusAndText(self, 2, Vue.t('addDevice.bindFailure'));
self.setStatus(2); self.setStatus(2);
}, },
complete: function complete() {} complete: function complete() {}
}); });
} }
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)["default"])) /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)["default"]))
......
...@@ -16427,7 +16427,8 @@ function remoteOpendoorTap(self) { ...@@ -16427,7 +16427,8 @@ function remoteOpendoorTap(self) {
url: './remoteOpendoor.html', url: './remoteOpendoor.html',
id: 'remoteOpendoor', id: 'remoteOpendoor',
extras: { extras: {
uuid: self.getUuid() uuid: self.getUuid(),
deviceId: self.deviceId
} }
}); });
} }
......
...@@ -1808,28 +1808,12 @@ function init() { ...@@ -1808,28 +1808,12 @@ function init() {
//配置组件 //配置组件
componentsConfig: initComponentsConfig(), componentsConfig: initComponentsConfig(),
//设备uuid //设备uuid
uuid: null uuid: null,
deviceId: null
}, },
mounted: function mounted() { mounted: function mounted() {
resolve(this); resolve(this);
var a = { "mac": "B0F89310DDF2", "productId": "10002", "productSecret": "WABK8XXEEKKLL5MM" }; 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 = { methods: (_methods = {
...@@ -1863,6 +1847,10 @@ function init() { ...@@ -1863,6 +1847,10 @@ function init() {
return this.uuid; return this.uuid;
}), _defineProperty(_methods, 'setUuid', function setUuid(id) { }), _defineProperty(_methods, 'setUuid', function setUuid(id) {
this.uuid = 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() { }), _defineProperty(_methods, 'onBackTap', function onBackTap() {
backTap(); backTap();
}), _defineProperty(_methods, 'onConfirmButtonTap', function onConfirmButtonTap() { }), _defineProperty(_methods, 'onConfirmButtonTap', function onConfirmButtonTap() {
...@@ -1910,6 +1898,7 @@ function initComponentsConfig() { ...@@ -1910,6 +1898,7 @@ function initComponentsConfig() {
function resolve(self) { function resolve(self) {
var extras = _public.iot.navigator.getExtras(); var extras = _public.iot.navigator.getExtras();
self.setUuid(extras.uuid); self.setUuid(extras.uuid);
self.setDeviceId(extras.deviceId);
console.log(self.getUuid()); console.log(self.getUuid());
} }
...@@ -1931,6 +1920,13 @@ function confirmButtonTap(self) { ...@@ -1931,6 +1920,13 @@ function confirmButtonTap(self) {
self.setTextErrorTip(Vue.t('remoteOpendoor.error.noPasswordTip')); self.setTextErrorTip(Vue.t('remoteOpendoor.error.noPasswordTip'));
} else { } else {
_public.uComponents.showLoading(self); _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({ _public.iot.business.sds.setDeviceStatus({
data: { data: {
uuid: self.getUuid(), uuid: self.getUuid(),
...@@ -1939,7 +1935,7 @@ function confirmButtonTap(self) { ...@@ -1939,7 +1935,7 @@ function confirmButtonTap(self) {
'value': 'openDoor' 'value': 'openDoor'
}, },
'remote_open_door': { 'remote_open_door': {
'value': self.getTextPassword() 'value': pwd
} }
} }
}, },
......
...@@ -835,7 +835,7 @@ function init() { ...@@ -835,7 +835,7 @@ function init() {
getUserInfo(self); getUserInfo(self);
}); });
getUserInfo(this); getUserInfo(this);
// showGuide(this); checkFirstAddUser(this);
}, },
methods: { methods: {
...@@ -1255,6 +1255,7 @@ function nextButtonTap(self) { ...@@ -1255,6 +1255,7 @@ function nextButtonTap(self) {
//tap 我知道了 //tap 我知道了
function iSeeButtonTap(self) { function iSeeButtonTap(self) {
self.setGuideShowFlag(false); self.setGuideShowFlag(false);
_public.iot.storage.setMap('isFirstAddUser', true, function () {}, function () {});
} }
//删除用户 //删除用户
......
...@@ -820,7 +820,7 @@ function init() { ...@@ -820,7 +820,7 @@ function init() {
userListIndex: null, userListIndex: null,
loadShowFlag: false, loadShowFlag: false,
loadFlag: false, loadFlag: false,
loadText: 'loading', loadText: '',
pagesize: 10, pagesize: 10,
tip: '无数据', tip: '无数据',
extras: {}, extras: {},
...@@ -882,16 +882,13 @@ function init() { ...@@ -882,16 +882,13 @@ function init() {
swipeRightRow(this); swipeRightRow(this);
}, },
onTapLoad: function onTapLoad() { onTapLoad: function onTapLoad() {
tapLoad(); // tapLoad();
}, },
onTapUserList: function onTapUserList(index) { onTapUserList: function onTapUserList(index) {
_onTapUserList(this, index); _onTapUserList(this, index);
}, },
onTapButton: function onTapButton(index) { onTapButton: function onTapButton(index) {
tapButton(this, index); tapButton(this, index);
},
changeUserList: function changeUserList(list) {
_changeUserList(this, list);
} }
} }
...@@ -916,7 +913,6 @@ function initComponentsConfig() { ...@@ -916,7 +913,6 @@ function initComponentsConfig() {
//获取用户列表 //获取用户列表
function getUserList(self) { function getUserList(self) {
console.log(self.extras);
_public.uComponents.showLoading(self); _public.uComponents.showLoading(self);
_public.iot.business.api.sendCustom('lock/getLockUser', { _public.iot.business.api.sendCustom('lock/getLockUser', {
data: { data: {
...@@ -927,12 +923,7 @@ function getUserList(self) { ...@@ -927,12 +923,7 @@ function getUserList(self) {
var data = _public.uPublic.checkResponseData(response.data); var data = _public.uPublic.checkResponseData(response.data);
console.log(data); console.log(data);
if (data) { if (data) {
if (self.extras.role) { sortUsers(self, data);
sortUsers(self, data);
} else {
data = data.sort(sortRule);
setUserData(self, data);
}
} }
}, },
error: function error(_error) { error: function error(_error) {
...@@ -998,10 +989,11 @@ function sortUsers(self, data) { ...@@ -998,10 +989,11 @@ function sortUsers(self, data) {
} }
} }
manage = manage.sort(sortRule); manage = manage.sort(sortRule);
console.log(manage);
data = manage.concat(users); data = manage.concat(users);
setUserData(self, data); setUserData(self, data);
case 16: case 17:
case 'end': case 'end':
return _context.stop(); return _context.stop();
} }
...@@ -1068,14 +1060,6 @@ function _onTapUserList(self, listIndex) { ...@@ -1068,14 +1060,6 @@ function _onTapUserList(self, listIndex) {
self.userListIndex = null; self.userListIndex = null;
} }
} }
//点击加载更多
function tapLoad() {
if (!self.loadFlag) {
self.loadText = 'loading';
self.loadFlag = true;
//再次发送获取用户列表请求
}
}
//点击按钮 //点击按钮
function tapButton(self, index) { function tapButton(self, index) {
...@@ -1086,16 +1070,6 @@ 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) { function deleteUser(self, index) {
_public.uComponents.showLoading(self); _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