From 08fcc710d0a2acb185b3477d72fe32aff6f2e29a Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 01 Dec 2025 16:23:03 +0800
Subject: [PATCH] feat:增加ws连接状态
---
src/pages/map/index.vue | 84 +++++++++++++++++++++++++++++------------
1 files changed, 59 insertions(+), 25 deletions(-)
diff --git a/src/pages/map/index.vue b/src/pages/map/index.vue
index 3a80b85..727a290 100644
--- a/src/pages/map/index.vue
+++ b/src/pages/map/index.vue
@@ -1,35 +1,69 @@
-<!--
- * @Author : yuan
- * @Date : 2025-10-14 17:40:58
- * @LastEditors : yuan
- * @LastEditTime : 2025-10-15 15:54:25
- * @FilePath : \src\pages\map\index.vue
- * @Description :
- * Copyright 2025 OBKoro1, All Rights Reserved.
- * 2025-10-14 17:40:58
--->
<template>
- <view class="page-wrap">
- <WebViewPlus :src="`${viewUrl}`" @webMessage="onPostMessage" />
- </view>
+ <view class="page-wrap">
+ <WebViewPlus :src="`${viewUrl}`" @webMessage="onPostMessage" />
+ </view>
</template>
<script setup>
-import { useUserStore } from "@/store/index.js";
-import WebViewPlus from "@/components/WebViewPlus.vue";
+ import {
+ getWebViewUrl
+ } from "@/utils/index.js";
+ import WebViewPlus from "@/components/WebViewPlus.vue";
+ // const viewUrl = getWebViewUrl("/defaultMap");
+ const baseUrl = getWebViewUrl("/defaultMap");
-const userStore = useUserStore();
-const viewUrl = `http://192.168.1.194:5174/drone-app-web-view/#/webViewWrapper/defaultMap?params=${JSON.stringify(
- userStore?.userInfo
-)}`;
+ let envParam = "";
+ // #ifdef WEB
+ envParam = "isWeb=true";
+ // #endif
+ // #ifdef APP-PLUS
+ envParam = "isWeb=false";
+ // #endif
+ const viewUrl = ref("");
+ onMounted(() => {
+ if (typeof baseUrl === "string") {
+ viewUrl.value = baseUrl.includes("?") ?
+ `${baseUrl}&${envParam}` :
+ `${baseUrl}?${envParam}`;
+ }
+ });
+ const onPostMessage = (data) => {
+ if (data.type === "scanCode") {
+ uni.navigateTo({
+ url: "/subPackages/qrCode/index",
+ });
+ } else if (data.type === "jumpAddWork") { //新建任务
+ const encodedData = encodeURIComponent(JSON.stringify(data.rowItem))
+ uni.setStorageSync('webview_params', encodedData)
+ uni.switchTab({
+ url: `/subPackages/taskDetail/addTask/index`,
+ });
+ } else if (data.type === 'jumpMapNav') { //事件导航
+ uni.navigateTo({
+ url: `/subPackages/workDetail/mapWork/index?currentItem=${data.eventNum}`
+ });
+ } else if (data.type === 'workid') { //事件详情
+ uni.navigateTo({
+ url: `/subPackages/workDetail/index?eventNum=${data.eventNum}`
+ });
+ }
+ };
-const onPostMessage = (event) => {};
-
-onLoad(() => {});
+ onShow(() => {
+ uni.setTabBarItem({
+ index: 2, // Tab 的索引(从0开始)
+ visible: false,
+ pagePath: "subPackages/taskDetail/addTask/index"
+ })
+ uni.setTabBarItem({
+ index: 3, // Tab
+ visible: true,
+ });
+ })
</script>
<style scoped lang="scss">
-.page-wrap {
- font-size: 20px;
-}
+ .page-wrap {
+ font-size: 20px;
+ }
</style>
--
Gitblit v1.9.3