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);
......
......@@ -25,299 +25,264 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
_public.iot.ready(init);
function init() {
//通用 input、按钮、dialog、loading组件
_public.uPublic.componentsInit(['u-text', 'u-button', 'u-comm-loading', 'u-dialog', 'u-loading']);
var app = new Vue({
data: {
textWiFiName: null,
textPassword: null,
textErrorTip: null,
//配置组件
componentsConfig: initComponentsConfig(),
status: 0
},
mounted: function mounted() {
resolve(this);
},
//通用 input、按钮、dialog、loading组件
_public.uPublic.componentsInit(['u-text', 'u-button', 'u-comm-loading', 'u-dialog', 'u-loading']);
var app = new Vue({
data: {
textWiFiName: null,
textPassword: null,
textErrorTip: null,
//配置组件
componentsConfig: initComponentsConfig(),
status: 0
},
mounted: function mounted() {
resolve(this);
},
methods: {
getTextWiFiName: function getTextWiFiName() {
return this.textWiFiName;
},
setTextWiFiName: function setTextWiFiName(text) {
this.textWiFiName = text;
},
getTextPassword: function getTextPassword() {
return this.textPassword;
},
setTextPassword: function setTextPassword(pwd) {
this.textPassword = pwd;
},
gettTextErrorTip: function gettTextErrorTip() {
return this.textErrorTip;
},
setTextErrorTip: function setTextErrorTip(tip) {
this.textErrorTip = tip;
},
getStatus: function getStatus() {
return this.status;
},
setStatus: function setStatus(status) {
this.status = status;
},
onPasswordChange: function onPasswordChange(text) {
passwordChange(this, text);
},
methods: {
getTextWiFiName: function getTextWiFiName() {
return this.textWiFiName;
},
setTextWiFiName: function setTextWiFiName(text) {
this.textWiFiName = text;
},
getTextPassword: function getTextPassword() {
return this.textPassword;
},
setTextPassword: function setTextPassword(pwd) {
this.textPassword = pwd;
},
gettTextErrorTip: function gettTextErrorTip() {
return this.textErrorTip;
},
setTextErrorTip: function setTextErrorTip(tip) {
this.textErrorTip = tip;
},
getStatus: function getStatus() {
return this.status;
},
setStatus: function setStatus(status) {
this.status = status;
},
onPasswordChange: function onPasswordChange(text) {
passwordChange(this, text);
},
//tap <
onBackTap: function onBackTap() {
backTap();
},
//tap <
onBackTap: function onBackTap() {
backTap();
},
//tap 连接
onConnectButtonTap: function onConnectButtonTap() {
connectButtonTap(this);
},
//tap 连接
onConnectButtonTap: function onConnectButtonTap() {
connectButtonTap(this);
},
//tap loading button
onCommLoadingButtonTap: function onCommLoadingButtonTap() {
commLoadingButtonTap(this);
}
}
}).$mount('#app');
//tap loading button
onCommLoadingButtonTap: function onCommLoadingButtonTap() {
commLoadingButtonTap(this);
}
}
}).$mount('#app');
}
//配置组件参数
function initComponentsConfig() {
return {
passwordInput: {
initParam: {
class: 'custom-password-text',
icon: '&#xe64d;',
placeholder: Vue.t('wifiAdd.passwordInputTip'),
type: 'password'
}
},
//连接 button 参数
connectButton: {
initParam: {
class: 'custom-button',
text: Vue.t('btn.connect')
}
},
dialog: {
initParam: {
class: 'custom-dialog'
}
},
loading: {
initParam: {
class: 'custom-loading'
}
},
ucommloading: {
initParam: {
class: 'custom-comm-loading',
buttonText: Vue.t('btn.confirm'),
text: 'loading',
status: 0
}
}
};
return {
passwordInput: {
initParam: {
class: 'custom-password-text',
icon: '&#xe64d;',
placeholder: Vue.t('wifiAdd.passwordInputTip'),
type: 'password'
}
},
//连接 button 参数
connectButton: {
initParam: {
class: 'custom-button',
text: Vue.t('btn.connect')
}
},
dialog: {
initParam: {
class: 'custom-dialog'
}
},
loading: {
initParam: {
class: 'custom-loading'
}
},
ucommloading: {
initParam: {
class: 'custom-comm-loading',
buttonText: Vue.t('btn.confirm'),
text: 'loading',
status: 0
}
}
};
}
function resolve(self) {
_public.iot.business.sds.getSSId({
success: function success(response) {
console.log(response);
self.textWiFiName = response.data.ssid;
console.log(self.textWiFiName);
},
error: function error(_error) {
console.log(_error);
_public.uPublic.openRequestErrorAlert(self);
}
});
_public.iot.business.sds.getSSId({
success: function success(response) {
console.log(response);
self.textWiFiName = response.data.ssid;
console.log(self.textWiFiName);
},
error: function error(_error) {
console.log(_error);
_public.uPublic.openRequestErrorAlert(self);
}
});
}
function passwordChange(self, text) {
self.textPassword = text;
console.log('passwordChange: ' + self.textPassword);
self.textPassword = text;
console.log('passwordChange: ' + self.textPassword);
}
//tap <
function backTap() {
_public.iot.navigator.back();
_public.iot.navigator.back();
}
//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() == '') {
self.setTextErrorTip(Vue.t('wifiAdd.passwordInputTip'));
} else {
_public.iot.business.sds.findWifi({
data: {
model: _config2.default.mode,
ssid: self.getTextWiFiName(),
wifiPwd: self.getTextPassword(),
timeout: 20000
},
success: function success(response) {
console.log("findWifi");
console.log(response);
if (response.data == 'onProvisioning') {
//wifi链接中
_public.uComponents.showCommLoading(self);
} else if (response.data == 'provisioned success') {
//wifi连接成功,停止连接wifi
// iot.business.sds.stopFindWifi({
// success: (response) => {},
// error: (error) => {}
// });
}
},
error: function error(_error2) {
console.log(_error2);
}
});
var deviceId = null;
_public.iot.business.sds.findDevices({
success: function success(response) {
console.log("findDevices");
console.log(response);
var parameters = {};
if (response.data) {
var info = response.data.split(':[');
if (info[1]) {
var query = info[1].split(',');
console.log(query);
for (var i = 0; i < query.length; i++) {
var pari = query[i].split(' = ');
console.log(pari);
parameters[pari[0]] = pari[1];
}
console.log(parameters.sn);
}
}
if (parameters.sn) {
deviceId = parameters.sn;
}
var productId = _config2.default.mode.substr(_config2.default.mode_type.length, 6);
if (response.data == "joined success") {
unbind(self, deviceId, productId);
// bind(self, deviceId, productId);
} 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) {}
});
console.log(self.getTextWiFiName());
// self.setTextPassword('macro_scope00');
console.log(self.getTextPassword());
if (self.getTextPassword() == null || self.getTextPassword().trim() == '') {
self.setTextErrorTip(Vue.t('wifiAdd.passwordInputTip'));
} else {
_public.iot.business.sds.findWifi({
data: {
model: _config2.default.mode,
ssid: self.getTextWiFiName(),
wifiPwd: self.getTextPassword(),
timeout: 20000
},
success: function success(response) {
console.log("findWifi");
console.log(response);
if (response.data == 'onProvisioning') {
//wifi链接中
_public.uComponents.showCommLoading(self);
} else if (response.data == 'provisioned success') {
//wifi连接成功,停止连接wifi
// iot.business.sds.stopFindWifi({
// success: (response) => {},
// error: (error) => {}
// });
}
},
error: function error(_error2) {
console.log(_error2);
}
});
var deviceId = null;
_public.iot.business.sds.findDevices({
success: function success(response) {
console.log("findDevices");
console.log(response);
var parameters = {};
if (response.data) {
var info = response.data.split(':[');
if (info[1]) {
var query = info[1].split(',');
console.log(query);
for (var i = 0; i < query.length; i++) {
var pari = query[i].split(' = ');
console.log(pari);
parameters[pari[0]] = pari[1];
}
console.log(parameters.sn);
}
}
if (parameters.sn) {
deviceId = parameters.sn;
}
var productId = _config2.default.mode.substr(_config2.default.mode_type.length, 6);
if (response.data == "joined success") {
unbind(self, deviceId, productId);
// bind(self, deviceId, productId);
} 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);
}
});
}
},
error: function error(_error4) {
console.log(_error4);
}
});
}
}
//tap loading button
function commLoadingButtonTap(self) {
if (self.getStatus() == 1) {
//绑定成功
_public.uComponents.hideCommLoading(self);
_public.iot.navigator.openWindow({
url: '../device/index.html',
id: 'device'
});
} else if (self.getStatus() == 2) {
//绑定失败
_public.uComponents.hideCommLoading(self);
}
if (self.getStatus() == 1) {
//绑定成功
_public.uComponents.hideCommLoading(self);
_public.iot.navigator.openWindow({
url: '../device/index.html',
id: 'device'
});
} else if (self.getStatus() == 2) {
//绑定失败
_public.uComponents.hideCommLoading(self);
}
}
function unbind(self, deviceId, productId) {
_public.iot.business.api.sendCustom('lock/getLockInfo', {
data: {
device_id: self.deviceId
},
success: function success(response) {
console.log(response);
var data = _public.uPublic.checkResponseData(response.data);
if (data) {
if (data.lock_id) {
_public.iot.business.api.sendCustom('lock/unbind', {
data: {
device_sn: self.getDoorlock().device_id,
device_id: self.getDoorlock().id
},
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() {}
});
console.log(deviceId);
_public.iot.business.api.sendCustom('lock/unbindDevice', {
data: {
device_sn: deviceId
},
success: function success(response) {
console.log(response);
bind(self, deviceId, productId);
},
error: function error(_error5) {
console.log(_error5);
},
complete: function complete() {}
});
}
function bind(self, deviceId, productId) {
_public.iot.business.api.sendCustom('lock/bind', {
data: {
product_id: productId,
device_id: deviceId,
// mac: parameters.mac,
nickname: ''
},
success: function success(response) {
console.log(response);
var data = response.data;
if (data.success) {
_public.uComponents.changeCommLoadingStatusAndText(self, 1, Vue.t('addDevice.bindSuccess'));
self.setStatus(1);
}
},
error: function error(_error7) {
console.log(_error7);
_public.uComponents.changeCommLoadingStatusAndText(self, 2, Vue.t('addDevice.bindFailure'));
self.setStatus(2);
},
complete: function complete() {}
});
_public.iot.business.api.sendCustom('lock/bind', {
data: {
product_id: productId,
device_id: deviceId,
// mac: parameters.mac,
nickname: ''
},
success: function success(response) {
console.log(response);
var data = response.data;
if (data.success) {
_public.uComponents.changeCommLoadingStatusAndText(self, 1, Vue.t('addDevice.bindSuccess'));
self.setStatus(1);
}
},
error: function error(_error6) {
console.log(_error6);
_public.uComponents.changeCommLoadingStatusAndText(self, 2, Vue.t('addDevice.bindFailure'));
self.setStatus(2);
},
complete: function complete() {}
});
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)["default"]))
......
......@@ -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