首页跳转传参方式

This commit is contained in:
fengerli
2025-07-15 16:34:58 +08:00
parent 56f05e7eec
commit 388b462b57
8 changed files with 15788 additions and 2169 deletions

View File

@ -24,8 +24,8 @@
style="height:80vh;">
<uni-swipe-action ref="swipeAction">
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
<uni-swipe-action-item :right-options="Options"
@click="handleSwipeClick($event, item, index)" class="device-card">
<uni-swipe-action-item :right-options="Options" @click="handleSwipeClick($event, item, index)"
class="device-card">
<view @click.stop="handleFile(item)">
<view class="device-header">
<view class="deviceIMG">
@ -60,7 +60,7 @@
</scroll-view>
</view>
<!-- 删除弹框 -->
<view class="agreement-mask" v-if="deleteShow">
<view class="agreement-mask" v-if="deleteShow" @click="closePopup('delete')">
<view class="agreement-popupC">
<view class="popup-content">
<image src="/static/images/dell.png" mode="" class="svg"></image>
@ -76,7 +76,7 @@
</view>
</view>
<!-- =========重命名============== -->
<view class="agreement-mask" v-if="RenameModel">
<view class="agreement-mask" v-if="RenameModel" @click="closePopup('rename')">
<view class="agreement-popupD">
<view class="popup-content">
<view>
@ -162,6 +162,14 @@
}
},
methods: {
// 点击弹框外的区域关闭
closePopup(type) {
if (type === 'delete') {
this.deleteShow = false;
} else if (type === 'rename') {
this.RenameModel = false;
}
},
// tab导航切换栏
getTab() {
deviceTypeList({}).then((res) => {
@ -192,6 +200,7 @@
const deviceType = tab.id === '' ? undefined : tab.id;
this.getData(deviceType);
},
// 获取设备列表
getData(deviceType = '') {
if (this.loading || this.finished) return;
@ -256,7 +265,9 @@
},
// 右滑点击事件处理
handleSwipeClick(e, item, index) {
const {content} = e
const {
content
} = e
console.log(e, 'eeeee');
switch (e.content.text) {
case '删除':
@ -339,52 +350,59 @@
})
},
// 位置
location(){
location() {
uni.navigateTo({
url:'/pages/common/map/index'
url: '/pages/common/map/index'
})
},
handleFile(item) {
console.log('item' + JSON.stringify(item));
//console.log('item' + JSON.stringify(item));
// communicationMode 0是4G 1是蓝牙
if (item.communicationMode == 0) {
uni.navigateTo({
url: `/pages/6170/deviceControl/index?id=${item.id}`
url: "/pages/6170/deviceControl/index",
events: {
ack: function(data) {}
},
success: (res) => {
// 页面跳转成功后的回调函数
res.eventChannel.emit('deviceControl', {
data: item
});
}
})
}
});
return;
}
if (item.typeName == '6155') {
uni.navigateTo({
url: "/pages/6155/deviceDetail",
events: {
ack: function(data) {
if (item.typeName == '6155') {
uni.navigateTo({
url: "/pages/6155/deviceDetail",
events: {
ack: function(data) {
}
},
success: (res) => {
res.eventChannel.emit('detailData', {
data: item
});
}
})
}
},
success: (res) => {
res.eventChannel.emit('detailData', {
data: item
});
}
})
}
},
onIntall() {
this.page = 1;
this.finished = false;
this.getData(); // 重新加载第一页数据
},
},
onShow() {
this.getTab()
this.onIntall()
}
onIntall() {
this.page = 1;
this.finished = false;
this.getData(); // 重新加载第一页数据
},
},
onShow() {
this.getTab()
this.onIntall()
}
}
</script>
<style>
@ -465,118 +483,6 @@
position: relative;
}
/* .device-header {
display: flex;
align-items: center;
margin-bottom: 15rpx;
padding: 30rpx 0 10rpx 30rpx;
width: 100%;
}
.device-name {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.87);
margin-left: 24rpx;
line-height: 50rpx;
}
.ID {
color: rgba(255, 255, 255, 0.6);
font-size: 24rpx;
}
.device-status {
width: 122rpx;
height: 52rpx;
font-size: 26rpx;
border-radius: 0px 8px 0px 8px;
background-color: rgb(42, 42, 42);
position: absolute;
top: 0rpx;
right: 0rpx;
text-align: center;
line-height: 52rpx;
}
.circle {
width: 8rpx;
height: 40rpx;
position: absolute;
right: 18rpx;
top: 65rpx;
}
.online {
color: rgb(187, 230, 0);
}
.unline {
color: rgba(255, 255, 255, 0.4);
}
.device-id {
font-size: 26rpx;
color: #999;
margin-bottom: 20rpx;
display: block;
}
.device-info {
display: flex;
font-size: 28rpx;
color: rgba(255, 255, 255, 0.87);
position: relative;
width: 100%;
}
.device-flex{
display: flex;
justify-content: space-between;
}
.deviceIMG {
width: 100rpx;
height: 100rpx;
border-radius: 16rpx;
position: relative;
background-color: rgba(42, 42, 42, 0.6);
display: flex;
align-items: center;
}
.IMG {
width: 68rpx;
height: 50rpx;
margin-left: 17%;
}
.onlines::before {
content: '';
position: absolute;
width: 15rpx;
height: 15rpx;
background: rgb(0, 171, 103);
border-radius: 50%;
left: 120rpx;
top: 15rpx
}
.line {
width: 2rpx;
height: 24rpx;
background: linear-gradient(90deg,
rgba(0, 0, 0, 0) 0%,
rgb(255, 255, 255) 50%,
rgba(255, 255, 255, 0) 100%);
margin-top: 12rpx;
}
.loading-status {
text-align: center;
color: rgba(255, 255, 255, 0.6);
padding: 20rpx;
font-size: 22rpx;
} */
.device-header {
display: flex;
align-items: center;
@ -599,7 +505,7 @@
.ID {
color: rgba(255, 255, 255, 0.6);
font-size: 26rpx;
font-size: 24rpx;
display: flex;
justify-content: space-between;
position: relative;
@ -756,6 +662,7 @@
color: rgba(255, 255, 255, 0.87);
height: 50rpx;
padding: 30rpx;
align-items: center;
}
.popup-input {