| | |
| | | <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> |
| | |
| | | </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"> |
| | |
| | | wmsUrl: '', |
| | | wmsPort: '', |
| | | switchDebounceTimer: null, |
| | | viewSwitchInProgress: false |
| | | viewSwitchInProgress: false, |
| | | getConfigUrl:"http://192.168.1.198:8080/wms/rpc/getLedInfos" |
| | | }; |
| | | }, |
| | | onShow() { |
| | |
| | | plus.navigator.setFullscreen(true); |
| | | // #endif |
| | | this.getVersion(); |
| | | var ip = this.getIp(); |
| | | console.log(ip); |
| | | |
| | | }, |
| | | mounted() { |
| | | let that = this; |
| | |
| | | that.baseCrnId = BaseCrnId; |
| | | that.wmsUrl = WMSURL; |
| | | that.wmsPort = WMSPORT; |
| | | |
| | | that.getIPConfig(); |
| | | |
| | | that.uniWebSocket(); |
| | | // that.webSockerInit() |
| | | }, |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |