This commit is contained in:
JayJiaJun 2025-05-30 16:23:13 +08:00
parent 7aa728df28
commit 1e81272e9a
2 changed files with 35 additions and 4 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<view v-if="params.url"> <view v-if="params.url">
<web-view :src="`${params.url}`"></web-view> <web-view :src="`${params.url}`" @message="handleMessage"></web-view>
<u-loading-page :loading="loading"></u-loading-page> <u-loading-page :loading="loading"></u-loading-page>
</view> </view>
</template> </template>
@ -34,5 +34,21 @@
this.loading = false; this.loading = false;
}, 1000); }, 1000);
}, },
methods: {
handleMessage(e) {
console.log('[DEBUG] Webview收到消息:', e.detail);
//
if (e.detail && e.detail.data) {
const data = e.detail.data;
console.log('[DEBUG] 消息数据:', data);
// typedata
if (data.type && data.data) {
console.log('[DEBUG] 消息类型:', data.type);
console.log('[DEBUG] 消息内容:', data.data);
}
}
}
}
} }
</script> </script>

View File

@ -8,18 +8,24 @@
<u--text iconStyle="color: #486ff2; margin-right: 4px; font-size: 22px;" type="primary" <u--text iconStyle="color: #486ff2; margin-right: 4px; font-size: 22px;" type="primary"
prefixIcon="list-dot" align="right" text="设备详情" @click="handleGoToDeviceDetail"></u--text> prefixIcon="list-dot" align="right" text="设备详情" @click="handleGoToDeviceDetail"></u--text>
</view> </view>
<view class="running-status" v-show="current==0 && !isRelayProduct"> <view class="running-status" v-show="current==0 && !isRelayProduct && !isVoiceProduct && !isGatewayProduct">
<base-status :device="device" ref="baseStatus"></base-status> <base-status :device="device" ref="baseStatus"></base-status>
</view> </view>
<view class="deviceVariable" v-show="current==1 && !isRelayProduct"> <view class="deviceVariable" v-show="current==1 && !isRelayProduct && !isVoiceProduct && !isGatewayProduct">
<device-variable ref="deviceVariable" :device="device"></device-variable> <device-variable ref="deviceVariable" :device="device"></device-variable>
</view> </view>
<view class="relay-control" v-show="isRelayProduct"> <view class="relay-control" v-show="isRelayProduct">
<relay-control :device="device" ref="relayControl"></relay-control> <relay-control :device="device" ref="relayControl"></relay-control>
</view> </view>
<view class="voice-control" v-show="isVoiceProduct">
<voice :device="device" ref="voice"></voice>
</view>
<!-- <view class="relay-control" v-show="isRelayProduct"> <!-- <view class="relay-control" v-show="isRelayProduct">
<GRelay :device="device" ref="GRelay"></GRelay> <GRelay :device="device" ref="GRelay"></GRelay>
</view> --> </view> -->
<view class="gateway" v-show="isGatewayProduct">
<gateway :device="device" ref="gateway"></gateway>
</view>
</view> </view>
</template> </template>
@ -27,6 +33,8 @@
import baseStatus from './base.vue'; import baseStatus from './base.vue';
import deviceVariable from './variable.vue'; import deviceVariable from './variable.vue';
import relayControl from './relay.vue'; import relayControl from './relay.vue';
import voice from './voice.vue';
import gateway from './gateway.vue';
// import GRelay from './GRelay.vue' // import GRelay from './GRelay.vue'
export default { export default {
@ -35,7 +43,8 @@
baseStatus, baseStatus,
deviceVariable, deviceVariable,
relayControl, relayControl,
voice,
gateway
}, },
props: { props: {
device: { device: {
@ -50,6 +59,8 @@
this.deviceInfo = newVal; this.deviceInfo = newVal;
this.isSubDev = newVal.subDeviceList && newVal.subDeviceList.length > 0; this.isSubDev = newVal.subDeviceList && newVal.subDeviceList.length > 0;
this.isRelayProduct = newVal.productName === '多路控制器'; this.isRelayProduct = newVal.productName === '多路控制器';
this.isVoiceProduct = newVal.productName === '声卡';
this.isGatewayProduct = newVal.productName === '网关卡兼容';
} }
}, },
data() { data() {
@ -58,6 +69,8 @@
current: 0, current: 0,
isSubDev: false, isSubDev: false,
isRelayProduct: false, isRelayProduct: false,
isVoiceProduct: false,
isGatewayProduct: false,
deviceInfo: {} // deviceInfo: {} //
}; };
}, },
@ -69,6 +82,8 @@
this.isSubDev = this.device.subDeviceList.length > 0; this.isSubDev = this.device.subDeviceList.length > 0;
} }
this.isRelayProduct = this.device.productName === '继电器测试'; this.isRelayProduct = this.device.productName === '继电器测试';
this.isVoiceProduct = this.device.productName === '声卡';
this.isGatewayProduct = this.device.productName === '网关卡兼容';
console.log("create的数据", JSON.stringify(this.deviceInfo)) console.log("create的数据", JSON.stringify(this.deviceInfo))
}, },