关闭灯光

This commit is contained in:
fengerli
2025-07-31 14:03:28 +08:00
parent 52c4a0b436
commit c7d7149d2f
6 changed files with 191 additions and 91 deletions

View File

@ -5,17 +5,19 @@
rightIcon="/static/images/add.png" @right-click="scan"></custom-navbar>
<view class="device-page" :style="{ paddingTop: navBarHeight + 'px' }">
<!-- handleSend 发送信息 -->
<scroll-view class="tab-bar" scroll-x="true" scroll-with-animation>
<view class="tab-container">
<view v-for="(tab, index) in tabs" :key="index"
:class="['tab-item', activeTab === index ? 'active' : '']" @click="switchTab(tab,index)">
{{tab.typeName}}
<view class="tab-bar-wrap">
<scroll-view class="tab-bar" scroll-x="true" scroll-with-animation>
<view class="tab-container">
<view v-for="(tab, index) in tabs" :key="index"
:class="['tab-item', activeTab === index ? 'active' : '']" @click="switchTab(tab,index)">
{{tab.typeName}}
</view>
</view>
</scroll-view>
<view class="tab-more" @click="allMore">
<image src="/static/images/more.png" mode="aspectFit" class="more"></image>
</view>
<view class="uniui-more">
<image @click="allMore" src="/static/images/more.png" mode="" class="more"></image>
</view>
</scroll-view>
</view>
<view class="sendFlex" v-if="activeTab && activeTab.id !== ''&& activeTabInfo.communicationMode==0">
<!-- <view class="callpolice">报警</view> -->
<view class="Sendmessage" @click="location">位置</view>
@ -346,6 +348,7 @@
});
setTimeout(() => {
this.onIntall();
this.getTab()
}, 500);
this.deleteShow = false
// 关闭所有滑动项
@ -439,9 +442,7 @@
uni.navigateTo({
url: "/pages/6155/deviceDetail",
events: {
ack: function(data) {
}
ack: function(data) {}
},
success: (res) => {
res.eventChannel.emit('detailData', {
@ -450,14 +451,28 @@
}
})
}
},
onIntall() {
this.page = 1;
this.finished = false;
this.getData(this.deviceType); // 重新加载第一页数据
},
updateDeviceStatus(data) {
// 只更新 communicationMode == 0 的设备
this.deviceList = this.deviceList.map(item => {
console.log(item,'item2222');
if (item.communicationMode === 0) {
// 这里根据消息内容更新设备状态
// 示例:如果消息包含特定字段,则更新设备状态
return {
...item,
//status: data.message.status || item.status, // 假设消息中有status字段
lastUpdate: data.timestamp // 更新时间戳
};
}
return item;
});
}
},
onLoad() {
this.getTab()
@ -472,6 +487,17 @@
// 组件销毁前移除监听器
uni.$off('refreshDeviceList');
},
onShow() {
// 监听设备状态更新事件
uni.$on('deviceStatusUpdate', (data) => {
console.log('收到设备状态更新通知:', data);
this.updateDeviceStatus(data);
});
},
onHide() {
// 页面隐藏时取消监听,避免内存泄漏
uni.$off('deviceStatusUpdate');
},
}
</script>
@ -498,11 +524,10 @@
.tab-container {
display: flex;
/* justify-content: space-around; */
cursor: pointer;
margin-bottom: 40rpx;
/* min-width: 100%; */
/* 最小宽度 */
padding-right: 80rpx;
/* 预留更多按钮空间 */
}
.tab-item {
@ -530,19 +555,26 @@
font-size: 28rpx;
}
.uniui-more {
.tab-bar-wrap {
display: flex;
/* 横向排列 */
align-items: baseline;
/* 垂直居中 */
position: relative;
width: 100%;
/* 可选(若需要绝对定位 fallback */
}
.tab-more {
margin-left: 10rpx;
/* 与Tab的间距 */
display: flex;
align-items: center;
background: linear-gradient(-88.60deg, rgba(18, 18, 18, 1), rgba(18, 18, 18, 0) 100%);
}
.more {
width: 40rpx;
height: 8rpx;
/* position: absolute; */
/* right: 0rpx;
z-index: 100; */
float: right;
top: -95rpx
}
.gprs {

View File

@ -61,7 +61,7 @@
data() {
return {
showView: false,
phone: '13058067817', //手机号码
phone: '13800138001', //手机号码
code: "", //验证码
agreed: false,
isCounting: false,