首页跳转传参方式
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
<!-- 设备电量信息 -->
|
<!-- 设备电量信息 -->
|
||||||
<view class="battery-section">
|
<view class="battery-section">
|
||||||
<view class="battery-sectionLeft">
|
<view class="battery-sectionLeft">
|
||||||
<image src="/static/images/bip.6.png" class="bipImg"></image>
|
<image :src="itemInfo.devicePic" class="bipImg"></image>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view class="battery-v1">
|
<view class="battery-v1">
|
||||||
@ -59,7 +59,6 @@
|
|||||||
<view class="control-card">
|
<view class="control-card">
|
||||||
<slider :value="sliderValue" min="0" max="100" activeColor="rgb(187, 230, 0)"
|
<slider :value="sliderValue" min="0" max="100" activeColor="rgb(187, 230, 0)"
|
||||||
backgroundColor="rgb(26, 26, 26)" show-value />
|
backgroundColor="rgb(26, 26, 26)" show-value />
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 灯光模式选择 -->
|
<!-- 灯光模式选择 -->
|
||||||
@ -217,13 +216,20 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {
|
||||||
|
connectMQTT,
|
||||||
|
publishMessage,
|
||||||
|
onMessageReceived,
|
||||||
|
disconnectMQTT,
|
||||||
|
isMQTTConnected
|
||||||
|
} from '@/utils/mqtt'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
mainMode: 'string',
|
mainMode: 'string',
|
||||||
secondaryMode: 'string',
|
secondaryMode: 'string',
|
||||||
navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight,
|
navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight,
|
||||||
navTitle: "6170",
|
navTitle: "",
|
||||||
sliderValue: 50,
|
sliderValue: 50,
|
||||||
lightModeA: false,
|
lightModeA: false,
|
||||||
currentMainMode: '强光模式',
|
currentMainMode: '强光模式',
|
||||||
@ -232,7 +238,8 @@
|
|||||||
lightModeC: false, //激光提示框
|
lightModeC: false, //激光提示框
|
||||||
items: [],
|
items: [],
|
||||||
isFormExpanded: true, // 默认展开
|
isFormExpanded: true, // 默认展开
|
||||||
deviceID: ''
|
deviceID: '',
|
||||||
|
itemInfo: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -241,6 +248,25 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
async initMQTT() {
|
||||||
|
try {
|
||||||
|
if (!isMQTTConnected()) {
|
||||||
|
await connectMQTT()
|
||||||
|
}
|
||||||
|
await publishMessage('/test/123/456/set', 'Hello MQTT!')
|
||||||
|
uni.showToast({
|
||||||
|
title: '消息发送成功'
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.error('发送失败:', error)
|
||||||
|
uni.showToast({
|
||||||
|
title: '发送失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
selectMode(type) {
|
selectMode(type) {
|
||||||
this.modeType = type;
|
this.modeType = type;
|
||||||
this.lightModeA = true;
|
this.lightModeA = true;
|
||||||
@ -312,7 +338,7 @@
|
|||||||
this.lightModeB = false
|
this.lightModeB = false
|
||||||
},
|
},
|
||||||
|
|
||||||
// 操纵说明
|
// 操作说明
|
||||||
operatingInst() {
|
operatingInst() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/common/operatingInstruct/index?id=${this.deviceID}`
|
url: `/pages/common/operatingInstruct/index?id=${this.deviceID}`
|
||||||
@ -343,9 +369,17 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
console.log(options.id) // 输出: 123
|
const eventChannel = this.getOpenerEventChannel();
|
||||||
this.deviceID = options.id
|
// 监听 'detailData' 事件,获取传过来的数据
|
||||||
}
|
eventChannel.on('deviceControl', (data) => {
|
||||||
|
this.itemInfo = data.data;
|
||||||
|
this.deviceID = data.data.id;
|
||||||
|
this.navTitle = data.data.deviceName;
|
||||||
|
console.log('Received detail data:', this.navTitle);
|
||||||
|
});
|
||||||
|
// 如果需要向调用页面返回数据,可以触发 'ack' 事件
|
||||||
|
eventChannel.emit('ack', {})
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
style="height:80vh;">
|
style="height:80vh;">
|
||||||
<uni-swipe-action ref="swipeAction">
|
<uni-swipe-action ref="swipeAction">
|
||||||
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
|
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
|
||||||
<uni-swipe-action-item :right-options="Options"
|
<uni-swipe-action-item :right-options="Options" @click="handleSwipeClick($event, item, index)"
|
||||||
@click="handleSwipeClick($event, item, index)" class="device-card">
|
class="device-card">
|
||||||
<view @click.stop="handleFile(item)">
|
<view @click.stop="handleFile(item)">
|
||||||
<view class="device-header">
|
<view class="device-header">
|
||||||
<view class="deviceIMG">
|
<view class="deviceIMG">
|
||||||
@ -60,7 +60,7 @@
|
|||||||
</scroll-view>
|
</scroll-view>
|
||||||
</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="agreement-popupC">
|
||||||
<view class="popup-content">
|
<view class="popup-content">
|
||||||
<image src="/static/images/dell.png" mode="" class="svg"></image>
|
<image src="/static/images/dell.png" mode="" class="svg"></image>
|
||||||
@ -76,7 +76,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</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="agreement-popupD">
|
||||||
<view class="popup-content">
|
<view class="popup-content">
|
||||||
<view>
|
<view>
|
||||||
@ -162,6 +162,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 点击弹框外的区域关闭
|
||||||
|
closePopup(type) {
|
||||||
|
if (type === 'delete') {
|
||||||
|
this.deleteShow = false;
|
||||||
|
} else if (type === 'rename') {
|
||||||
|
this.RenameModel = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
// tab导航切换栏
|
// tab导航切换栏
|
||||||
getTab() {
|
getTab() {
|
||||||
deviceTypeList({}).then((res) => {
|
deviceTypeList({}).then((res) => {
|
||||||
@ -192,6 +200,7 @@
|
|||||||
const deviceType = tab.id === '' ? undefined : tab.id;
|
const deviceType = tab.id === '' ? undefined : tab.id;
|
||||||
this.getData(deviceType);
|
this.getData(deviceType);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取设备列表
|
// 获取设备列表
|
||||||
getData(deviceType = '') {
|
getData(deviceType = '') {
|
||||||
if (this.loading || this.finished) return;
|
if (this.loading || this.finished) return;
|
||||||
@ -256,7 +265,9 @@
|
|||||||
},
|
},
|
||||||
// 右滑点击事件处理
|
// 右滑点击事件处理
|
||||||
handleSwipeClick(e, item, index) {
|
handleSwipeClick(e, item, index) {
|
||||||
const {content} = e
|
const {
|
||||||
|
content
|
||||||
|
} = e
|
||||||
console.log(e, 'eeeee');
|
console.log(e, 'eeeee');
|
||||||
switch (e.content.text) {
|
switch (e.content.text) {
|
||||||
case '删除':
|
case '删除':
|
||||||
@ -339,52 +350,59 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 位置
|
// 位置
|
||||||
location(){
|
location() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:'/pages/common/map/index'
|
url: '/pages/common/map/index'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleFile(item) {
|
handleFile(item) {
|
||||||
console.log('item' + JSON.stringify(item));
|
//console.log('item' + JSON.stringify(item));
|
||||||
// communicationMode 0是4G 1是蓝牙
|
// communicationMode 0是4G 1是蓝牙
|
||||||
if (item.communicationMode == 0) {
|
if (item.communicationMode == 0) {
|
||||||
uni.navigateTo({
|
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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
});
|
if (item.typeName == '6155') {
|
||||||
return;
|
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() {
|
onIntall() {
|
||||||
this.getTab()
|
this.page = 1;
|
||||||
this.onIntall()
|
this.finished = false;
|
||||||
}
|
this.getData(); // 重新加载第一页数据
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.getTab()
|
||||||
|
this.onIntall()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -465,118 +483,6 @@
|
|||||||
position: relative;
|
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 {
|
.device-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -599,7 +505,7 @@
|
|||||||
|
|
||||||
.ID {
|
.ID {
|
||||||
color: rgba(255, 255, 255, 0.6);
|
color: rgba(255, 255, 255, 0.6);
|
||||||
font-size: 26rpx;
|
font-size: 24rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -756,6 +662,7 @@
|
|||||||
color: rgba(255, 255, 255, 0.87);
|
color: rgba(255, 255, 255, 0.87);
|
||||||
height: 50rpx;
|
height: 50rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup-input {
|
.popup-input {
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<view>
|
<view>
|
||||||
<image src="/static/images/bip.6.png" class="bip"></image>
|
<image src="/static/images/bip.6.png" class="bip"></image>
|
||||||
</view>
|
</view>
|
||||||
<text class="device-name">设备名:CLI</text>
|
<text class="device-name">设备名:{{deviceId}}</text>
|
||||||
<text class="device-model1">ID:{{deviceId}}</text>
|
<text class="device-model1">ID:{{deviceId}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="connecting-line" v-if="isConnectNo">连接中...</view>
|
<view class="connecting-line" v-if="isConnectNo">连接中...</view>
|
||||||
@ -63,7 +63,7 @@
|
|||||||
communicationMode: '0', //0是4g,1是蓝牙
|
communicationMode: '0', //0是4g,1是蓝牙
|
||||||
})
|
})
|
||||||
console.log(this.deviceId,'deerer ere');
|
console.log(this.deviceId,'deerer ere');
|
||||||
if (res.code == 0) {
|
if (res.code == 200) {
|
||||||
this.isConnectNo=false
|
this.isConnectNo=false
|
||||||
this.isSuccess =true
|
this.isSuccess =true
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
@ -73,6 +73,7 @@
|
|||||||
});
|
});
|
||||||
this.isConnecting = true;
|
this.isConnecting = true;
|
||||||
} else {
|
} else {
|
||||||
|
this.isConnectNo=false
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
});
|
});
|
||||||
|
16
unpackage/dist/dev/app-plus/__uniappautomator.js
vendored
16
unpackage/dist/dev/app-plus/__uniappautomator.js
vendored
File diff suppressed because one or more lines are too long
17243
unpackage/dist/dev/app-plus/app-service.js
vendored
17243
unpackage/dist/dev/app-plus/app-service.js
vendored
File diff suppressed because one or more lines are too long
425
unpackage/dist/dev/app-plus/app-view.js
vendored
425
unpackage/dist/dev/app-plus/app-view.js
vendored
File diff suppressed because one or more lines are too long
2
unpackage/dist/dev/app-plus/manifest.json
vendored
2
unpackage/dist/dev/app-plus/manifest.json
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user