From 32febb140d320b35d580c8d4e78a80ef846e75fc Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 19 Dec 2025 15:59:34 +0800
Subject: [PATCH] feat:webview通信处理
---
src/subPackages/inProgress/index.vue | 57 +++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 39 insertions(+), 18 deletions(-)
diff --git a/src/subPackages/inProgress/index.vue b/src/subPackages/inProgress/index.vue
index 9026fa0..9b9e1cc 100644
--- a/src/subPackages/inProgress/index.vue
+++ b/src/subPackages/inProgress/index.vue
@@ -1,43 +1,64 @@
+<!--
+ * @Author : yuan
+ * @Date : 2025-12-05 11:32:36
+ * @LastEditors : yuan
+ * @LastEditTime : 2025-12-19 15:56:31
+ * @FilePath : \src\subPackages\inProgress\index.vue
+ * @Description :
+ * Copyright 2025 OBKoro1, All Rights Reserved.
+ * 2025-12-05 11:32:36
+-->
<template>
- <WebViewPlus v-if="showComponent" :src="`${viewUrl}`" @webMessage="onPostMessage"/>
+ <WebViewPlus
+ v-if="showComponent"
+ :src="`${viewUrl}`"
+ @webMessage="onPostMessage"
+ />
</template>
<script setup>
import WebViewPlus from "@/components/WebViewPlus.vue";
-import {getWebViewUrl} from "@/utils/index.js";
-import {onHide, onLoad, onShow} from "@dcloudio/uni-app";
+import { getWebViewUrl } from "@/utils/index.js";
+import { onHide, onLoad, onShow } from "@dcloudio/uni-app";
-const wayLineJobInfoId = ref(null)
-const viewUrl = ref('')
-const showComponent = ref(false)
+const wayLineJobInfoId = ref(null);
+const viewUrl = ref("");
+const showComponent = ref(false);
function onPostMessage(data) {
- if (data.type === 'back') {
+ // #ifdef MP-WEIXIN
+ // #endif
+
+ // #ifndef MP-WEIXIN
+ if (data.type === "back") {
uni.switchTab({
- url: '/pages/inspectionTask/index'
+ url: "/pages/inspectionTask/index",
});
- } else if (data.type === 'control') {
+ } else if (data.type === "control") {
uni.navigateTo({
- url: `/subPackages/droneConsole/index?wayLineJobInfoId=${wayLineJobInfoId.value}&dockSn=${data.dockSn}`
+ url: `/subPackages/droneConsole/index?wayLineJobInfoId=${wayLineJobInfoId.value}&dockSn=${data.dockSn}`,
});
}
+ // #endif
}
onLoad((options) => {
- wayLineJobInfoId.value = options.wayLineJobInfoId
- viewUrl.value = getWebViewUrl('/TaskInProgress', {wayLineJobInfoId: wayLineJobInfoId.value})
-})
+ wayLineJobInfoId.value = options.wayLineJobInfoId;
+ viewUrl.value = getWebViewUrl("/TaskInProgress", {
+ wayLineJobInfoId: wayLineJobInfoId.value,
+ });
+});
onShow(function () {
- showComponent.value = true
+ showComponent.value = true;
// #ifdef APP-PLUS
plus.navigator.setFullscreen(false);
plus.screen.lockOrientation("portrait-primary");
// #endif
-})
+});
-onHide(() =>{
- showComponent.value = false
-})
+onHide(() => {
+ showComponent.value = false;
+});
</script>
<style scoped lang="scss">
--
Gitblit v1.9.3