From da27ee7966358d48ac8f9bb0c0d78327d2c5d934 Mon Sep 17 00:00:00 2001 From: zhou zhou <3272660260@qq.com> Date: 星期一, 20 十月 2025 08:04:05 +0800 Subject: [PATCH] # --- Monitor-APP/pages/home/home.vue | 99 +++++++++++++++++-------------------------------- 1 files changed, 34 insertions(+), 65 deletions(-) diff --git a/Monitor-APP/pages/home/home.vue b/Monitor-APP/pages/home/home.vue index 873f6a1..b0a8c24 100644 --- a/Monitor-APP/pages/home/home.vue +++ b/Monitor-APP/pages/home/home.vue @@ -143,7 +143,7 @@ <view style="height: 2%"></view> <view style="height: 18%; display: flex; justify-content: space-around; align-items: center"> <view style="height: 50%"> - <image style="height: 100%" src="../../static/img/logo-bai.png" mode="aspectFit"></image> + <image style="height: 100%; opacity: 0;" src="../../static/img/logo-bai.png" mode="aspectFit"></image> </view> </view> </view> @@ -230,29 +230,17 @@ </view> </view> <view class="item"> - <view class="desc">Wcsport锛�</view> + <view class="desc">port锛�</view> <view class="input"> <input type="text" v-model="basePort" /> </view> </view> <view class="item"> - <view class="desc">WcsUrl锛�</view> + <view class="desc">Url锛�</view> <view class="input"> <input type="text" v-model="baseUrl" /> </view> - </view> - <view class="item"> - <view class="desc">Wmsport锛�</view> - <view class="input"> - <input type="text" v-model="wmsPort" /> - </view> - </view> - <view class="item"> - <view class="desc">WmsUrl锛�</view> - <view class="input"> - <input type="text" v-model="wmsUrl" /> - </view> - </view> + </view> <view class="item"> <view class="desc">ledId锛�</view> <view class="input"> @@ -348,7 +336,8 @@ wmsUrl: '', wmsPort: '', switchDebounceTimer: null, - viewSwitchInProgress: false + viewSwitchInProgress: false, + getConfigUrl:"http://192.168.1.198:8080/wms/rpc/getLedInfos" }; }, onShow() { @@ -357,8 +346,7 @@ plus.navigator.setFullscreen(true); // #endif this.getVersion(); - var ip = this.getIp(); - console.log(ip); + }, mounted() { let that = this; @@ -393,6 +381,9 @@ that.baseCrnId = BaseCrnId; that.wmsUrl = WMSURL; that.wmsPort = WMSPORT; + + that.getIPConfig(); + that.uniWebSocket(); // that.webSockerInit() }, @@ -421,54 +412,29 @@ this.oldData = []; } }, 30000 * 10); // 姣忓皬鏃舵墽琛屼竴娆� + + }, methods: { - getIp() { - var ip = null; - if (plus.os.name === 'Android') { - try { - const InetAddress = plus.android.importClass('java.net.InetAddress'); - const NetworkInterface = plus.android.importClass('java.net.NetworkInterface'); - const Collections = plus.android.importClass('java.util.Collections'); - - let interfaces = NetworkInterface.getNetworkInterfaces(); - let en = Collections.list(interfaces); // Java ArrayList - let ipEth = null; // 鏈夌嚎 - let ipWifi = null; // Wi-Fi - let ipOther = null; // 鍏滃簳 - let size = plus.android.invoke(en, 'size'); - for (let i = 0; i < size; i++) { - let intf = plus.android.invoke(en, 'get', i); - let name = plus.android.invoke(intf, 'getName'); // eth0 / wlan0 / lo 绛� - let enumIpAddr = plus.android.invoke(intf, 'getInetAddresses'); - let enumList = Collections.list(enumIpAddr); - let listSize = plus.android.invoke(enumList, 'size'); - for (let j = 0; j < listSize; j++) { - let inetAddress = plus.android.invoke(enumList, 'get', j); - if (!plus.android.invoke(inetAddress, 'isLoopbackAddress')) { - let hostAddress = plus.android.invoke(inetAddress, 'getHostAddress'); - // 鍙彇 IPv4 - if (hostAddress.indexOf(':') === -1) { - if (name.startsWith('eth') && !ipEth) { - ipEth = hostAddress; - } else if (name.startsWith('wlan') && !ipWifi) { - ipWifi = hostAddress; - } else if (!ipOther) { - ipOther = hostAddress; - } - } - } - } + getIPConfig(){ + const that = this + + console.log(that.baseIP) + uni.request({ + url: that.getConfigUrl, + method:'GET', + success(result) { + console.log(result) + const res = result.data + uni.setStorageSync('BaseIp', res.data.ledIp); + uni.setStorageSync('BaseLedId', res.data.ledId); + uni.setStorageSync('BasePort', res.data.ledPort); + uni.setStorageSync('UPROJ', res.data.ledUrl); + } - ip = ipEth || ipWifi || ipOther || null; - return ip; - } catch (e) { - console.log('鑾峰彇IP澶辫触锛�', e); - return ip; - } - } else { - return ip; - } + }); + + }, uniWebSocket() { let that = this; @@ -597,7 +563,10 @@ that.infoText.sourceLocNo = data.taskList[0].sourceLocNo; that.infoText.staNo = data.taskList[0].staNo; that.swiperList = data.taskList[0].matDtos; - } else { + }else if(data.type === 'NoData'){ + that.infoType = 0; + } + else { if (that.infoType == 2 || that.infoType == 3) { return; } -- Gitblit v1.9.1