2024-06-18 07:55:32 +00:00
|
|
|
|
<template>
|
2024-07-09 09:36:30 +00:00
|
|
|
|
|
2024-06-18 07:55:32 +00:00
|
|
|
|
<web-view class="webview" @message="webLoad" style="flex: 1;" ref="webViewRef" :src="config.h5Url"></web-view>
|
2024-07-18 12:46:46 +00:00
|
|
|
|
|
2024-06-18 07:55:32 +00:00
|
|
|
|
</template>
|
|
|
|
|
<script setup>
|
2024-07-09 10:55:32 +00:00
|
|
|
|
import uvNoNetwork from "../../uni_modules/uv-no-network/components/uv-no-network/uv-no-network.vue";
|
2024-06-18 07:55:32 +00:00
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
import config from "../../config";
|
|
|
|
|
import { onShow, onHide } from "@dcloudio/uni-app";
|
|
|
|
|
/* import location from "../../utils/location"; */
|
|
|
|
|
/* import {
|
|
|
|
|
registerRequestPermissionTipsListener,
|
|
|
|
|
unregisterRequestPermissionTipsListener,
|
|
|
|
|
setRequestPermissionTips
|
|
|
|
|
} from "@/uni_modules/uni-registerRequestPermissionTips" */
|
|
|
|
|
/* plus.runtime.setBadgeNumber(999); */
|
|
|
|
|
|
|
|
|
|
/* const permissionListener = uni.createRequestPermissionListener();
|
|
|
|
|
permissionListener.onRequest((e)=>{
|
|
|
|
|
})
|
|
|
|
|
permissionListener.onConfirm((e) => {
|
|
|
|
|
sendWebWiew(webViewRef.value,{auth:e,open:true})
|
|
|
|
|
});
|
|
|
|
|
permissionListener.onComplete((e) => {
|
|
|
|
|
/* uni.showToast({
|
|
|
|
|
duration:1000000,
|
|
|
|
|
title:`${JSON.stringify(e)}1111${JSON.stringify(f)}`,
|
|
|
|
|
icon:'none'
|
|
|
|
|
}) */
|
|
|
|
|
/* sendWebWiew(webViewRef.value,{auth:e,open:false})
|
|
|
|
|
}); *!/*/
|
|
|
|
|
/* registerRequestPermissionTipsListener({
|
|
|
|
|
onRequest: (e) => {
|
|
|
|
|
console.log(e)
|
|
|
|
|
},
|
|
|
|
|
onConfirm: (e) => {
|
|
|
|
|
sendWebWiew(webViewRef.value,{auth:e,open:true})
|
|
|
|
|
},
|
|
|
|
|
onComplete: (e) => {
|
|
|
|
|
|
|
|
|
|
const arr=['android.permission.ACCESS_COARSE_LOCATION','android.permission.ACCESS_FINE_LOCATION','android.permission.ACCESS_LOCATION_EXTRA_COMMANDS','android.permission.ACCESS_MOCK_LOCATION']
|
|
|
|
|
const hasIntersection = Object.keys(e).some(item => new Set(arr).has(item));
|
|
|
|
|
uni.setSt
|
|
|
|
|
sendWebWiew(webViewRef.value,{auth:Object.keys(e),open:false})
|
|
|
|
|
}
|
|
|
|
|
})*/
|
|
|
|
|
//解决ios的h5问题,获取网络权限之后,重新加载
|
2024-07-09 09:36:30 +00:00
|
|
|
|
|
2024-06-18 07:55:32 +00:00
|
|
|
|
const webViewObj=ref(null)
|
|
|
|
|
const webLoad=(e)=>{
|
|
|
|
|
const h5SendString=e.detail.data?.[0]?.action
|
|
|
|
|
switch (h5SendString) {
|
|
|
|
|
//webview初始化加载完成
|
|
|
|
|
case 'load-complete':{
|
2024-07-08 07:29:21 +00:00
|
|
|
|
|
2024-06-18 07:55:32 +00:00
|
|
|
|
const {statusBarHeight} = uni.getSystemInfoSync()
|
|
|
|
|
const currentWebview = getCurrentPages().pop().$getAppWebview()
|
|
|
|
|
webViewObj.value=currentWebview.children()[0]
|
|
|
|
|
webViewObj.value.setStyle({
|
|
|
|
|
top: statusBarHeight,
|
|
|
|
|
bottom: 0,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
|
|
</style>
|