1
0
forked from dyf/APP

常规小优化

This commit is contained in:
liub
2026-04-22 08:29:06 +08:00
parent 01ff9c7a05
commit 1f88de4710
22 changed files with 1682 additions and 392 deletions

View File

@ -27,10 +27,11 @@
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
:down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
<view v-if="deviceList.length>0">
<uni-swipe-action ref="swipeAction" >
<uni-swipe-action ref="swipeAction">
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
<uni-swipe-action-item :right-options="Options" :show="item.showOption"
@click="handleSwipeClick($event, item, index)" class="device-card"
:class="item.active?'active':''"
:style="{ border: item.communicationMode==0 && item.onlineStatus==1 && item.alarmStatus==1 ? '1px solid rgba(224, 52, 52, 1)' : 'none' }">
<view @click.stop="handleFile(item,index)">
<view class="device-header">
@ -62,7 +63,8 @@
</view>
</view>
</view>
<image @click.stop="swipeToggle(item,index)" src="/static/images/common/cires.png" class="circle" mode="aspectFit"></image>
<image @click.stop="swipeToggle(item,index)" src="/static/images/common/cires.png"
class="circle" mode="aspectFit"></image>
</uni-swipe-action-item>
</block>
</uni-swipe-action>
@ -136,8 +138,8 @@
</view>
<!-- 蒙板用于点击任意位置关闭悬浮的菜单 -->
<view class="mask" v-show="showTooltip||showshare" @click.stop="closePopMenu"></view>
<MsgBox ref="msgPop" />
</view>
</template>
@ -242,8 +244,8 @@
isLock: false,
empty: {
tip: '暂无数据',
hideScroll: false,
icon: '/static/images/common/empty.png'
hideScroll: false,
icon: '/static/images/common/empty.png'
},
textNoMore: '没有更多数据了'
},
@ -315,7 +317,7 @@
},
bleBreak(res) {
// console.error("蓝牙断开连接", res);
console.error("蓝牙断开连接", res);
if (res.deviceId) {
this.updateBleStatu(res.deviceId);
}
@ -698,37 +700,44 @@
}
})
},
swipeToggle(item,index){
if(!item.showOption || item.showOption=='none'){
this.$set(this.deviceList[index],'showOption','right');
swipeToggle(item, index) {
if (!item.showOption || item.showOption == 'none') {
this.$set(this.deviceList[index], 'showOption', 'right');
return;
}
this.$set(this.deviceList[index],'showOption','none');
this.$set(this.deviceList[index], 'showOption', 'none');
},
// 列表跳转
handleFile(item,index) {
if(item.showOption=='right'){
this.$set(this.deviceList[index],'showOption','none');
handleFile(item, index) {
if (item.showOption == 'right') {
this.$set(this.deviceList[index], 'showOption', 'none');
return;
}
let url = item.detailPageUrl;
uni.navigateTo({
url: url,
events: {
ack: function(data) {}
},
success: (res) => {
// 页面跳转成功后的回调函数
res.eventChannel.emit('detailData', {
data: item,
deviceType: this.tabs[this.activeTab].id || '',
apiType: 'listA' //标识,根据这个参数,区分普通详情,分享跳转详情,查不一样的权限信息
});
},
fail(ex) {
console.log("ex=", ex);
}
})
this.$set(this.deviceList[index], 'active', true);
setTimeout(() => {
this.$set(this.deviceList[index], 'active', false);
let url = item.detailPageUrl;
uni.navigateTo({
url: url,
events: {
ack: function(data) {}
},
success: (res) => {
// 页面跳转成功后的回调函数
res.eventChannel.emit('detailData', {
data: item,
deviceType: this.tabs[this.activeTab].id || '',
apiType: 'listA' //标识,根据这个参数,区分普通详情,分享跳转详情,查不一样的权限信息
});
},
fail(ex) {
console.log("ex=", ex);
}
});
}, 100);
},
updateDeviceStatus(data) {
@ -768,7 +777,6 @@
}
},
onLoad() {
// console.error("首页加载");
this.getTab()
this.downCallback();
@ -785,7 +793,7 @@
this.downCallback();
});
ble = bleTool.getBleTool();
console.log("this=",this);
console.log("this=", this);
recei = BleReceive.getBleReceive(this);
//蓝牙连接成功的回调
ble.addRecoveryCallback((res) => {
@ -795,7 +803,7 @@
//蓝牙断开连接的回调
ble.addDisposeCallback((res) => {
// console.log("蓝牙断开连接的回调");
console.log("蓝牙断开连接的回调");
this.bleBreak(res);
}, pagePath);
@ -813,8 +821,8 @@
//接收到消息的回调
ble.addReceiveCallback((receive, device, path, recArr) => {
// console.error("首页收到消息了");
let json=recei.ReceiveData(receive, device, path, recArr);
// console.error("首页收到消息了");
let json = recei.ReceiveData(receive, device, path, recArr);
// console.error("消息内容",json);
this.updateBleStatu();
}, pagePath);
@ -888,22 +896,23 @@
text-align: center;
/* 文字居中 */
/* 设置最小宽度 */
position: relative;
}
.tab-item.active {
color: #bbe600;
height: 60rpx;
font-weight: bold;
}
.tab-item.active::before{
.tab-item.active::before {
content: "";
background-color: #bbe600;
background-color: #bbe600;
position: absolute;
top: 90%;
left:35%;
left: 35%;
width: 30%;
height: 6rpx;
border-radius: 6rpx;
@ -957,6 +966,9 @@
box-sizing: border-box;
position: relative;
}
.device-card.active{
background-color: #2a2a2a !important;
}
.device-header {
@ -1160,23 +1172,24 @@
}
.cancelBtn{
.cancelBtn {
text-align: center;
width: 170rpx !important;
background-color: #00000000;
}
.agreement-popupC .cancelBtn{
border:1rpx solid #E03434;
color:#E03434;
.agreement-popupC .cancelBtn {
border: 1rpx solid #E03434;
color: #E03434;
}
.agreement-popupD .cancelBtn{
.agreement-popupD .cancelBtn {
border: 1rpx solid rgba(255, 255, 255, 0.6);
color:rgba(255, 255, 255, 0.6);
color: rgba(255, 255, 255, 0.6);
}
.agreement-popupD {
width: 75%;
background-color: rgb(42, 42, 42);