chenyao
2025-10-15 5d2a0677a6d25e6934faec08aff8339af93e3387
feat:提交代码
2 files modified
74 ■■■■■ changed files
src/pages/inspectionTask/index.vue 37 ●●●●● patch | view | raw | blame | history
src/subPackages/taskDetail/execution/index.vue 37 ●●●●● patch | view | raw | blame | history
src/pages/inspectionTask/index.vue
@@ -1,34 +1,23 @@
<!-- 巡检任务 -->
<template>
  <web-view ref="sWebViewRef" :src="`${viewUrl}`" />
  <WebViewPlus :src="`${viewUrl}`" @webMessage="onPostMessage"/>
</template>
<script setup>
import { useUserStore } from "@/store/index.js";
import { getWebViewUrl } from "@/utils/index.js";
import WebViewPlus from "@/components/WebViewPlus.vue";
const sWebViewRef = ref(null);
const userStore = useUserStore();
const viewUrl = `http://192.168.1.15:5174/drone-app-web-view/#/webViewWrapper/inspectionTask?params=${JSON.stringify(userStore?.userInfo)}`;
const viewUrl = getWebViewUrl('/inspectionTask')
function onPostMessage(data) {
  if (data.type === 'taskDetails'){
    uni.navigateTo({
      url: '/subPackages/taskDetail/execution/index'
    });
  }
}
</script>
<style scoped lang="scss">
</style>
<!--<template>-->
<!--  <WebViewPlus :src="`${viewUrl}`" @webMessage="onPostMessage"/>-->
<!--</template>-->
<!--<script setup>-->
<!--import {useUserStore} from "@/store/index.js";-->
<!--import WebViewPlus from "@/components/WebViewPlus.vue";-->
<!--const userStore = useUserStore();-->
<!--const viewUrl = `http://192.168.1.15:5174/drone-app-web-view/#/appTaskDetails?params=${JSON.stringify(userStore?.userInfo)}`;-->
<!--function onPostMessage(data) {-->
<!--  console.log(data)-->
<!--}-->
<!--</script>-->
<!--<style scoped lang="scss">-->
<!--</style>-->
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>