常规小优化
This commit is contained in:
@ -45,12 +45,17 @@
|
||||
|
||||
|
||||
</view>
|
||||
<view class="tab">
|
||||
<view class="center tabItem" @click="Status.tabIndex=0" :class="{'active':Status.tabIndex==0}">未入库(<text class="mathIcon">{{UnJoin.length}}</text>)</view>
|
||||
<view class="center tabItem" @click="Status.tabIndex=1" :class="{'active':Status.tabIndex==1}">已入库(<text class="mathIcon">{{joined.length}}</text>)</view>
|
||||
<view class="center tabItem" @click="Status.tabIndex=2" :class="{'active':Status.tabIndex==2}">全部(<text class="mathIcon">{{SearchEquips.length}}</text>)</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mainContent">
|
||||
<view class="p100">
|
||||
|
||||
<view class="list searchList">
|
||||
<view class="item" v-on:click="Link(item,index)" v-for="item, index in SearchEquips"
|
||||
<view class="item" v-on:click="Link(item,index)" v-for="item, index in list"
|
||||
v-show="!item['linkStatu']"
|
||||
:class="{'displayNone':item.name.toLowerCase().indexOf(search.toLowerCase())===-1}">
|
||||
<view class="leftImg ">
|
||||
@ -152,7 +157,8 @@
|
||||
title: '添加设备',
|
||||
showBack: true,
|
||||
height: 90
|
||||
}
|
||||
},
|
||||
tabIndex:0
|
||||
},
|
||||
search: '',
|
||||
groupid: '',
|
||||
@ -168,12 +174,35 @@
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
list(){
|
||||
if(this.Status.tabIndex==0){
|
||||
return this.UnJoin;
|
||||
}
|
||||
if(this.Status.tabIndex==1){
|
||||
return this.joined;
|
||||
}
|
||||
|
||||
return this.SearchEquips;
|
||||
},
|
||||
SearchEquips: function() {
|
||||
let f = this.EquipMents.filter(v => {
|
||||
return v.name.toLowerCase().indexOf(this.search.toLowerCase()) > -1
|
||||
});
|
||||
return f;
|
||||
}
|
||||
},
|
||||
joined(){
|
||||
let f=this.EquipMents.filter(v => {
|
||||
return v.name.toLowerCase().indexOf(this.search.toLowerCase()) > -1 && v.isUpload;
|
||||
});
|
||||
return f;
|
||||
},
|
||||
UnJoin(){
|
||||
let f=this.EquipMents.filter(v => {
|
||||
return v.name.toLowerCase().indexOf(this.search.toLowerCase()) > -1 && !v.isUpload;
|
||||
});
|
||||
return f;
|
||||
},
|
||||
|
||||
},
|
||||
onHide: function() {
|
||||
ble.StopSearch();
|
||||
@ -427,7 +456,7 @@
|
||||
|
||||
if (!f) {
|
||||
arr[i].remark = '正在校验...';
|
||||
these.EquipMents.push(arr[i]);
|
||||
these.EquipMents.unshift(arr[i]);
|
||||
|
||||
these.getDevice(arr[i]);
|
||||
|
||||
@ -482,18 +511,19 @@
|
||||
|
||||
|
||||
ble.addStateBreakCallback(() => {
|
||||
|
||||
MsgError('蓝牙不可用','确定',these);
|
||||
|
||||
MsgError('蓝牙不可用','',these);
|
||||
|
||||
these.EquipMents=[];
|
||||
these.EquipMents.filter((v, i) => {
|
||||
these.$set(these.EquipMents[i], 'link', false);
|
||||
});
|
||||
}, pagePath);
|
||||
ble.addStateRecoveryCallback(() => {
|
||||
|
||||
|
||||
these.ReSearch();
|
||||
MsgSuccess('蓝牙恢复可用','',these,()=>{
|
||||
MsgSuccess('蓝牙恢复可用','确定',these,()=>{
|
||||
MsgClear(these);
|
||||
})
|
||||
});
|
||||
},
|
||||
pagePath);
|
||||
|
||||
@ -553,11 +583,10 @@
|
||||
|
||||
|
||||
|
||||
|
||||
// #ifdef APP|APP-PLUS
|
||||
setTimeout(()=>{
|
||||
debugger;
|
||||
MsgInfo("如需要在PC上查看此数据,请复制链接后通过微信发送到PC,在PC端打开,然后点右上角扫码授权","复制链接",these,true,()=>{
|
||||
console.log("执行复制");
|
||||
console.log("开始访问剪切板");
|
||||
uni.setClipboardData({
|
||||
data:'https://static-mp-5b7c35fc-f6fe-4100-a2e1-3669e4d4bfc9.next.bspapp.com/AppTools/views/index.html',
|
||||
success(){
|
||||
@ -565,25 +594,19 @@
|
||||
title:'已复制链接'
|
||||
});
|
||||
|
||||
// #ifdef APP
|
||||
|
||||
plus.runtime.openURL('weixin://', (err) => {
|
||||
MsgError("打开微信失败,请手动打开微信,发送至'文件传输助手'");
|
||||
});
|
||||
// #endif
|
||||
|
||||
// #ifndef APP
|
||||
MsgInfo("已复制链接,请打开浏览器查看","",these);
|
||||
setTimeout(()=>{
|
||||
MsgClear(these);
|
||||
},1200)
|
||||
// #endif
|
||||
},
|
||||
fail(ex){
|
||||
console.error("无法复制",ex)
|
||||
fail(ex) {
|
||||
console.error("ex=",ex);
|
||||
}
|
||||
});
|
||||
});
|
||||
},500);
|
||||
// #endif
|
||||
|
||||
},
|
||||
|
||||
onShow: function() {
|
||||
@ -812,6 +835,7 @@
|
||||
|
||||
let json = getUrlParams(res.result);
|
||||
if (!json.key) {
|
||||
|
||||
|
||||
MsgError('无效的二维码','',these);
|
||||
return;
|
||||
@ -892,11 +916,11 @@
|
||||
ble.disconnectDevice().finally(dis => {
|
||||
|
||||
ble.StopSearch().finally(res => {
|
||||
|
||||
setTimeout(()=>{
|
||||
this.EquipMents = [];
|
||||
|
||||
this.EquipMents = [];
|
||||
this.PairEquip = [];
|
||||
ble.StartSearch().then(result => {
|
||||
setTimeout(()=>{
|
||||
ble.StartSearch().then(result => {
|
||||
|
||||
}).catch(err => {
|
||||
console.error("err=", err);
|
||||
@ -904,7 +928,7 @@
|
||||
}).finally(()=>{
|
||||
hideLoading(these);
|
||||
});
|
||||
},200);
|
||||
},600)
|
||||
|
||||
}).catch(ex => {
|
||||
console.error("ex=", ex);
|
||||
@ -993,7 +1017,7 @@
|
||||
});
|
||||
|
||||
let index = 1;
|
||||
let total = 5;
|
||||
let total = 1;
|
||||
|
||||
let linkCallback = (res) => {
|
||||
let c = these.PairEquip.find(function(v) {
|
||||
@ -1029,14 +1053,11 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
ble.StopSearch();
|
||||
|
||||
resolve(res);
|
||||
}).catch((ex) => {
|
||||
if (index == total) {
|
||||
console.log("连接了N次都没连上");
|
||||
updateLoading(this, {
|
||||
text: ex.msg
|
||||
});
|
||||
reject(ex);
|
||||
return;
|
||||
}
|
||||
@ -1058,8 +1079,8 @@
|
||||
these.sendEquipToMq();
|
||||
}).catch(ex => {
|
||||
console.log("ex=", ex)
|
||||
|
||||
MsgError("连接失败:" + ex.msg,'',these);
|
||||
|
||||
MsgError("连接失败"+ex.code + ex.msg,'',these);
|
||||
hideLoading(these);
|
||||
});
|
||||
}
|
||||
@ -1076,6 +1097,22 @@
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.tabItem.active{
|
||||
border-bottom:2rpx solid #BBE600;
|
||||
color:#BBE600;
|
||||
}
|
||||
.mathIcon{
|
||||
color: #BBE600;
|
||||
}
|
||||
.tab{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
justify-content: space-evenly;
|
||||
height: 60rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.noLink {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
@ -1228,12 +1265,7 @@
|
||||
min-height: 120rpx;
|
||||
}
|
||||
|
||||
.searchList {
|
||||
width: 100%;
|
||||
height: calc(100% - 186rpx);
|
||||
overflow-y: scroll;
|
||||
margin-top: 120rpx;
|
||||
}
|
||||
|
||||
|
||||
.list .item {
|
||||
width: 100%;
|
||||
@ -1447,7 +1479,7 @@
|
||||
.topStatric {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 30rpx;
|
||||
padding:0rpx 30rpx;
|
||||
position: fixed;
|
||||
top: 0rpx;
|
||||
z-index: 99;
|
||||
@ -1463,9 +1495,15 @@
|
||||
|
||||
.mainContent {
|
||||
|
||||
margin-top: 160rpx;
|
||||
margin-top: 280rpx;
|
||||
}
|
||||
|
||||
.searchList {
|
||||
width: 100%;
|
||||
height: calc(100% - 186rpx);
|
||||
overflow-y: scroll;
|
||||
margin-top: 90rpx;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
@ -1476,9 +1514,15 @@
|
||||
}
|
||||
|
||||
.topStatric {
|
||||
top: 90rpx
|
||||
top: 130rpx
|
||||
}
|
||||
|
||||
.searchList {
|
||||
width: 100%;
|
||||
height: calc(100% - 186rpx);
|
||||
overflow-y: scroll;
|
||||
margin-top: 150rpx;
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user