|
|
@ -2,11 +2,11 @@
|
|
|
|
<web-view class="webview" @message="webLoad" style="flex: 1;" :src="config.h5Url"></web-view>
|
|
|
|
<web-view class="webview" @message="webLoad" style="flex: 1;" :src="config.h5Url"></web-view>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<script setup>
|
|
|
|
<script setup>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
import { ref } from 'vue'
|
|
|
|
import config from "../../config";
|
|
|
|
import config from "../../config";
|
|
|
|
import {onExit } from "@dcloudio/uni-app";
|
|
|
|
import {onExit } from "@dcloudio/uni-app";
|
|
|
|
import { Communication } from '../../utils/communication.js';
|
|
|
|
import { Communication } from '../../utils/communication.js';
|
|
|
|
const commun=new Communication()
|
|
|
|
const commun=new Communication()
|
|
|
|
|
|
|
|
|
|
|
|
/* import {
|
|
|
|
/* import {
|
|
|
|
registerRequestPermissionTipsListener,
|
|
|
|
registerRequestPermissionTipsListener,
|
|
|
@ -26,6 +26,7 @@ onExit(()=>{
|
|
|
|
setRequestPermissionTips(PermissionTips)
|
|
|
|
setRequestPermissionTips(PermissionTips)
|
|
|
|
registerRequestPermissionTipsListener({
|
|
|
|
registerRequestPermissionTipsListener({
|
|
|
|
onRequest: (e) => {
|
|
|
|
onRequest: (e) => {
|
|
|
|
|
|
|
|
console.log('onRequest',e)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onConfirm: (e) => {
|
|
|
|
onConfirm: (e) => {
|
|
|
|
commun.sendToH5('permission-application',{action:'open-permission',data:e});
|
|
|
|
commun.sendToH5('permission-application',{action:'open-permission',data:e});
|
|
|
@ -51,13 +52,13 @@ onExit(()=>{
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}) */
|
|
|
|
})*/
|
|
|
|
function initializeWebView() {
|
|
|
|
function initializeWebView() {
|
|
|
|
const currentWebview = getCurrentPages().pop().$getAppWebview()
|
|
|
|
const currentWebview = getCurrentPages().pop().$getAppWebview()
|
|
|
|
commun.setWebView(currentWebview.children()[0])
|
|
|
|
commun.setWebView(currentWebview.children()[0])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//load-complete 注册函数
|
|
|
|
//load-complete 注册函数
|
|
|
|
commun.registerHandler('load-complete',()=>{
|
|
|
|
commun.registerHandler('load-complete',()=>{
|
|
|
|
initializeWebView()
|
|
|
|
initializeWebView()
|
|
|
|
const {statusBarHeight} = uni.getSystemInfoSync()
|
|
|
|
const {statusBarHeight} = uni.getSystemInfoSync()
|
|
|
|
commun.webViewObj.setStyle({
|
|
|
|
commun.webViewObj.setStyle({
|
|
|
@ -65,11 +66,23 @@ onExit(()=>{
|
|
|
|
bottom: 0,
|
|
|
|
bottom: 0,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
commun.registerHandler('getLocation',(data)=>{
|
|
|
|
|
|
|
|
uni.getLocation({
|
|
|
|
|
|
|
|
type:'gcj02',
|
|
|
|
|
|
|
|
geocode:true,
|
|
|
|
|
|
|
|
isHighAccuracy:true,
|
|
|
|
|
|
|
|
...data,
|
|
|
|
|
|
|
|
success: (res) => {
|
|
|
|
|
|
|
|
console.log('getLocation',res)
|
|
|
|
|
|
|
|
commun.sendToH5('getLocation',res);
|
|
|
|
|
|
|
|
},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
const webLoad = (e) => {
|
|
|
|
})
|
|
|
|
|
|
|
|
const webLoad = (e) => {
|
|
|
|
const message = e.detail.data?.[0] || '';
|
|
|
|
const message = e.detail.data?.[0] || '';
|
|
|
|
commun.handleMessage(message);
|
|
|
|
commun.handleMessage(message);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
<style>
|
|
|
|