|
@@ -1,5 +1,6 @@
|
|
|
<template>
|
|
|
<view>
|
|
|
+ <!-- v-if="!deviceCode" -->
|
|
|
<view class="map-box" v-if="!deviceCode">
|
|
|
|
|
|
<!-- <view class="mp-header">
|
|
@@ -15,7 +16,8 @@
|
|
|
<!-- <map id='map' :latitude="latitude" :longitude="longitude" :markers="covers" :polyline="polyline"
|
|
|
:scale="scale">
|
|
|
</map> -->
|
|
|
- <view class="top-input" v-if="!deviceId">
|
|
|
+ <!-- v-if="!deviceId" -->
|
|
|
+ <view class="top-input" >
|
|
|
<image src="../../static/img/noneEqu.png" mode=""></image>
|
|
|
<view class="btn-box" @click="goEquList">
|
|
|
<view class="btn">添加设备</view>
|
|
@@ -107,8 +109,19 @@
|
|
|
</view>
|
|
|
<van-loading class="loading" v-if="showLoading" type="spinner" color="#000" />
|
|
|
</view>
|
|
|
+ <!-- #ifdef APP-PLUS||H5 -->
|
|
|
+ <view class="status_bar"></view>
|
|
|
+ <view class="aaa" style="margin-top: var(--status-bar-height);margin-bottom: var(--status-bar-height);">
|
|
|
+ <uni-nav-bar title="" height="var(--status-bar-height)" left-icon="left" backgroundColor="#F35546" color="#fff" @clickLeft="webviewback"></uni-nav-bar>
|
|
|
+ </view>
|
|
|
+ <!-- <view class="" @click="webviewback" style="z-index: 1;position: absolute;">
|
|
|
+ 我是来展位的
|
|
|
+ </view> -->
|
|
|
+ <!-- #endif -->
|
|
|
<view class="" v-if="deviceCode">
|
|
|
- <web-view :src="h5url"></web-view>
|
|
|
+ <!-- <web-view :src="h5url"></web-view> -->
|
|
|
+ <!-- <web-view style="position: absolute; top: 100px;z-index: 2;" src="https://openapiweb.slaaplekker.cn/reportH5?accessToken=9f36cea4a4f64ba8bfb680ff98d98c1b&sn=289935886000036"></web-view> -->
|
|
|
+ <web-view ref="webview" v-if="h5url" style="position: absolute; top: 100px;z-index: 2;" :src="h5url" @message="bbb"></web-view>
|
|
|
</view>
|
|
|
|
|
|
<!-- </page-container> -->
|
|
@@ -136,6 +149,10 @@
|
|
|
// 获取导航栏高度
|
|
|
const barHeight = menuButtonInfo.height + (menuButtonInfo.top - statusBarHeight) * 2
|
|
|
// #endif
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ // import web from 'https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js'
|
|
|
+ // const webview =web.webview
|
|
|
+ // #endif
|
|
|
export default {
|
|
|
computed: mapGetters(['deviceCode', 'isLogin']),
|
|
|
data() {
|
|
@@ -268,7 +285,7 @@
|
|
|
y: 0.5,
|
|
|
},
|
|
|
},
|
|
|
- h5url:''
|
|
|
+ h5url:'',// 当前H5页面的URL
|
|
|
}
|
|
|
},
|
|
|
beforeCreate() {
|
|
@@ -289,7 +306,7 @@
|
|
|
// this.initAmap();
|
|
|
this.getLocationInfo()
|
|
|
// this.getHrdata()
|
|
|
- console.log(this.deviceCode,'deviceCodedeviceCode')
|
|
|
+ console.log(this.deviceCode,this.h5url,'deviceCodedeviceCode')
|
|
|
if(this.deviceCode){
|
|
|
this.geth5Url()
|
|
|
}
|
|
@@ -316,6 +333,9 @@
|
|
|
// this.errorMessage = '获取位置信息失败: ' + error.errMsg;
|
|
|
}
|
|
|
});
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ this.setWebviewHeight()
|
|
|
+ // #endif
|
|
|
|
|
|
},
|
|
|
onHide: function() {
|
|
@@ -326,11 +346,46 @@
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
+ bbb(e){
|
|
|
+ console.log(e,'我是刚触发得事件')
|
|
|
+ },
|
|
|
+ webviewback(){
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pages/index/index'
|
|
|
+ })
|
|
|
+ // webview.navigateBack({
|
|
|
+ // delta:1
|
|
|
+ // })
|
|
|
+ // webview.postMessage({data:'deletefile'})
|
|
|
+ },
|
|
|
+
|
|
|
+ setWebviewHeight() {
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ let height = 0; //定义动态的高度变量,如高度为定值,可以直接写
|
|
|
+ uni.getSystemInfo({
|
|
|
+ //成功获取的回调函数,返回值为系统信息
|
|
|
+ success: sysinfo => {
|
|
|
+ height = sysinfo.windowHeight - 47; //自行修改,自己需要的高度
|
|
|
+ },
|
|
|
+ });
|
|
|
+ const currentWebview = this.$scope.$getAppWebview(); //获取当前web-view
|
|
|
+ setTimeout(function() {
|
|
|
+ const wv = currentWebview.children()[0];
|
|
|
+ wv.setStyle({
|
|
|
+ top: 80, //设置web-view距离顶部的距离以及自己的高度,单位为px
|
|
|
+ height: height
|
|
|
+ });
|
|
|
+ }, 1000); //如页面初始化调用需要写延迟
|
|
|
+ // #endif
|
|
|
+ },
|
|
|
geth5Url(){
|
|
|
+ // this.h5url='https://openapiweb.slaaplekker.cn/reportH5?accessToken=9f36cea4a4f64ba8bfb680ff98d98c1b&sn=289935886000036'
|
|
|
+ // return
|
|
|
hrApi.geth5url({sn:this.deviceCode}).then(res=>{
|
|
|
- console.log(res,777)
|
|
|
+ console.log(res,this.h5url,777)
|
|
|
this.h5url=res.data.httpsURL
|
|
|
- // this.$set("this.h5url",res.data.httpsURL)
|
|
|
+ this.$forceUpdate();
|
|
|
+ // this.$set(this,"h5url",res.data.httpsURL)
|
|
|
})
|
|
|
},
|
|
|
getHrdata(){
|