You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.1 KiB

<template>
<view>
<web-view :src="src" @message="handlePostMessage"></web-view>
</view>
</template>
<script>
const {H5ServerUrl} = require('@/static/api');
export default {
data() {
return {
src:'',
};
},
onLoad(options) {
let token = uni.getStorageSync('token').token;
let start = options.startTime;
let end = options.endTime;
let time = options.time;
this.src = 'https://zhongnengyunche.com/dispatching/'+ H5ServerUrl +'/index.html?id='+options.id+'&start='+start+'&end='+end+'&token='+token+'&time='+time;
console.log('h5src:',this.src);
},
methods:{
handlePostMessage(e) {
    let resObj = e.detail.data[e.detail.data.length - 1];
//多次传递会是数组的形式,传递一次会push进数组,所以我们需要拿到最新的数据,也就是数组的最后一个子集
    console.log('h5传参',resObj.message)
if(resObj.message == 0){
uni.showToast({
title: '暂无轨迹',
icon: 'none'
});
}else{
uni.showToast({
title: '加载失败',
icon: 'none'
});
}
},
}
}
</script>
<style lang="scss" scoped>
</style>