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>
<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>
</view>
</template>
@ -34,5 +34,21 @@
this.loading = false;
}, 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>

View File

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