shuishen
2025-10-15 2fee66bc6651e1460ea1dbfb7affff2afa066add
src/subPackages/taskDetail/execution/index.vue
@@ -1,35 +1,24 @@
<!-- 已执行 -->
<template>
  <web-view ref="sWebViewRef" :src="`${viewUrl}`" @message="onPostMessage" @onPostMessage="onPostMessage" />
  <WebViewPlus :src="`${viewUrl}`"/>
</template>
<script setup>
import {onLoad} from "@dcloudio/uni-app";
import {useUserStore} from "@/store/index.js";
import WebViewPlus from "@/components/WebViewPlus.vue";
import {getWebViewUrl} from "@/utils/index.js";
const sWebViewRef = ref(null);
const userStore = useUserStore();
let viewUrl = ''
const viewUrl = ref(getWebViewUrl('/execution'))
function onPostMessage(event) {
  if (event.detail.data[0].type === 'back') {
    // active.value = null
  }
}
// onLoad(() => {
//   window.addEventListener('message', function (e) {
//     if (e.data.data.type === 'back') {
//       // active.value = null
//     }
//   });
// })
onLoad((options) => {
  // console.log('options1111111', JSON.parse(decodeURIComponent(options)));
  const id=3333
  viewUrl = `http://192.168.1.178:5173/drone-app-web-view/#/webViewWrapper/execution?rowItem=${id}`;
});
// function onPostMessage(data) {
//   console.log(data, '9999')
//   if (data.type === 'taskDetails'){
//     console.log('4444')
//     uni.switchTab({
//       url: '/subPackages/taskDetail/execution/index'
//     });
//   }
// }
</script>
<style lang="scss" scoped></style>