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.
|
|
<template> <view class="page-web"> <!-- 签署合同webview --> <view class="page-inner"> <web-view :src="$store.state.webViewUrl" @message="message" @onPostMessage="handlePostMessage"></web-view> </view>
</view> </template>
<script> import learnDriveApi from '@/api/learnDrive.js' export default { data() { return { title: '加载中...', trainingApplyId: '' } }, onLoad(options) { this.trainingApplyId = options.id let _this = this // const currentWebview = _this.$mp.page.$getAppWebview();
this.shang() }, mounted() {
}, methods: { shang() { let _this = this var currentWebview = this.$scope.$getAppWebview(); setTimeout(()=>{ console.log('currentWebview') console.log(currentWebview) let wv = currentWebview.children()[0] wv.addEventListener('loaded', async function () { let webVeiwUrl = wv.getURL() console.log(webVeiwUrl) var reg = RegExp(/wait/i);//signaturecallback
if(reg.test(webVeiwUrl)){ console.log('匹配成功了') uni.navigateTo({ url: '/pages/learnDriveStep/payMoney/payMoney?trainingApplyId='+_this.trainingApplyId }) } console.log('监听到了————————————————————') }, false); },500) },
handlePostMessage(e) { console.log('好消息' + e) } }, onReady() { // #ifdef APP-PLUS
// var wv;
// var height = 0;
// uni.getSystemInfo({
// //成功获取的回调函数,返回值为系统信息
// success: (sysinfo) => {
// height = sysinfo.windowHeight; //自行修改,自己需要的高度 此处如底部有其他内容,可以直接---(-50)这种
// },
// complete: () => {}
// });
// var currentWebview = this.$scope
// .$getAppWebview() //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
// console.log(height)
// setTimeout(function() {
// wv = currentWebview.children()[0]
// wv.setStyle({
// top: 70,
// height: height
// })
// }, 1000); //如果是页面初始化调用时,需要延时一下
// #endif
} } </script>
<style> .page-web { flex: 1; width: 100%; flex-direction: column; }
.page-inner { flex: 1; } </style>
|