首页修改,删除、重命名成功后,前端直接修改数据源
This commit is contained in:
@ -88,9 +88,7 @@
|
||||
});
|
||||
this.txt="";
|
||||
hideLoading(this);
|
||||
},800);
|
||||
|
||||
|
||||
},800);
|
||||
},
|
||||
|
||||
closePop: function() {
|
||||
|
||||
@ -223,7 +223,7 @@
|
||||
textNoMore: '没有更多数据了'
|
||||
},
|
||||
mescrollHeight: 0,
|
||||
page: 0, // 当前页码
|
||||
|
||||
size: 10, // 每页条数
|
||||
total: 0, // 总数据量
|
||||
|
||||
@ -250,44 +250,28 @@
|
||||
},
|
||||
// 下拉刷新
|
||||
downCallback() {
|
||||
debugger;
|
||||
console.log("下拉加载")
|
||||
this.mescroll && this.mescroll.resetUpScroll(false);
|
||||
// 重置分页参数
|
||||
|
||||
|
||||
|
||||
console.log("下拉加载")
|
||||
if(this.mescroll){
|
||||
this.mescroll.resetUpScroll(false);
|
||||
this.mescroll.scrollTo(0,0);
|
||||
}
|
||||
this.getData();
|
||||
|
||||
|
||||
},
|
||||
// 上拉加载
|
||||
upCallback() {
|
||||
debugger;
|
||||
|
||||
|
||||
|
||||
console.log("上拉加载")
|
||||
this.page += 1;
|
||||
|
||||
this.getData();
|
||||
},
|
||||
|
||||
bleStateRecovery() {
|
||||
console.log("蓝牙适配器恢复可用,重连断开的设备");
|
||||
ble.linkAllDevices();
|
||||
// if (ble.data && ble.data.LinkedList) {
|
||||
// for (var i = 0; i < this.deviceList.length; i++) {
|
||||
// if (this.deviceList[i].communicationMode !== '0' || this.deviceList[i].communicationMode !== 0) {
|
||||
// ble.data.LinkedList.find(v => {
|
||||
|
||||
// if (v.macAddress && v.device && v.device.id && v.device.id == this.deviceList[i]
|
||||
// .id) {
|
||||
// ble.LinkBlue(v.deviceId);
|
||||
// return true;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
},
|
||||
bleBreak(res) {
|
||||
console.log("蓝牙断开连接", res);
|
||||
@ -356,7 +340,7 @@
|
||||
},
|
||||
// 点击弹框外的区域关闭
|
||||
closePopup(type) {
|
||||
debugger;
|
||||
|
||||
if (type === 'delete') {
|
||||
this.deleteShow = false;
|
||||
uni.showTabBar(); // 显示TabBar
|
||||
@ -390,10 +374,10 @@
|
||||
this.deviceList = [];
|
||||
this.activeTab = index;
|
||||
this.activeTabInfo = tab
|
||||
this.page = 1; // 重置页码
|
||||
|
||||
|
||||
|
||||
this.getData();
|
||||
this.downCallback();
|
||||
},
|
||||
// 获取设备列表
|
||||
getData() {
|
||||
@ -452,10 +436,7 @@
|
||||
//防止下拉刷新的同时会调用一次上拉加载的问题
|
||||
timeout = setTimeout(task, 50);
|
||||
},
|
||||
// 滚动触底事件处理
|
||||
onScrollToLower() {
|
||||
this.getData();
|
||||
},
|
||||
|
||||
// 添加扫一扫图标
|
||||
scan() {
|
||||
this.showTooltip = !this.showTooltip;
|
||||
@ -520,9 +501,7 @@
|
||||
},
|
||||
// 右滑点击事件处理
|
||||
handleSwipeClick(e, item, index) {
|
||||
const {
|
||||
content
|
||||
} = e
|
||||
const {content} = e
|
||||
setTimeout(() => {
|
||||
console.log(item, 'eeeee');
|
||||
switch (e.content.text) {
|
||||
@ -557,10 +536,14 @@
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.onIntall();
|
||||
this.getTab()
|
||||
}, 500);
|
||||
|
||||
this.deviceList.find((v,i)=>{
|
||||
if(v.id==data.id){
|
||||
this.deviceList.splice(i,1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
this.deleteShow = false
|
||||
// 关闭所有滑动项
|
||||
this.$refs.swipeAction.closeAll();
|
||||
@ -594,9 +577,14 @@
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.onIntall();
|
||||
}, 500);
|
||||
|
||||
this.deviceList.find((v,i)=>{
|
||||
if(v.id===data.id){
|
||||
this.$set(this.deviceList[i],'deviceName',data.deviceName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
this.RenameModel = false
|
||||
this.deviceName = ''
|
||||
// 关闭所有滑动项
|
||||
@ -685,9 +673,7 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
onIntall() {
|
||||
this.downCallback();
|
||||
},
|
||||
|
||||
updateDeviceStatus(data) {
|
||||
this.deviceList = this.deviceList
|
||||
.map(item => {
|
||||
@ -716,16 +702,16 @@
|
||||
onLoad() {
|
||||
console.error("首页加载");
|
||||
this.getTab()
|
||||
this.onIntall()
|
||||
this.downCallback();
|
||||
// 绑定页面做了监听,新增成功,刷新页面
|
||||
uni.$on('refreshDeviceList', () => {
|
||||
this.getTab() // 刷新数据
|
||||
this.onIntall()
|
||||
this.downCallback();
|
||||
});
|
||||
// 监听设备状态更新事件
|
||||
uni.$on('deviceStatusUpdate', (data) => {
|
||||
console.log('列表收到消息了么');
|
||||
this.onIntall()
|
||||
this.downCallback();
|
||||
});
|
||||
ble = BleHelper.getBleTool();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user