罗广辉
2025-10-14 8d3186f80e7e1dcb489dab9c5d6b0b81e219aeb6
src/pages/inspectionTask/TaskDetails/TaskDetails.vue
@@ -1,38 +1,21 @@
<template>
  <view class="page-wrap">
    <web-view
      ref="sWebViewRef"
      :src='`${viewUrl}?token=${token}&wayLineJodInfoId=${active.id}`'
      @message="onPostMessage"
      @onPostMessage="onPostMessage"
    />
  </view>
  <WebViewPlus :src="`${viewUrl}`" @webMessage="onPostMessage"/>
</template>
<script setup>
import {onLoad} from "@dcloudio/uni-app";
import {useUserStore} from "@/store/index.js";
import WebViewPlus from "@/components/WebViewPlus.vue";
const active = defineModel('active')
const sWebViewRef = ref(null)
const viewUrl = 'http://192.168.1.15:5173/drone-app-web-view/#/appTaskDetails'
const userStore = useUserStore()
const token = computed(() => userStore?.userInfo?.access_token)
const viewUrl = `http://192.168.1.15:5174/drone-app-web-view/#/appTaskDetails?params=${JSON.stringify(userStore?.userInfo)}`;
function onPostMessage(event) {
  if (event.detail.data[0].type === 'back') {
    active.value = null
function onPostMessage(data) {
  if (data.type === 'back'){
    uni.navigateBack()
  }
}
onLoad(() => {
  window.addEventListener('message', function (e) {
    if (e.data.data.type === 'back') {
      active.value = null
    }
  });
})
</script>
<style scoped lang="scss">