From c761bc5e98bd6b1fe0900f3cfb1bb4734e1aed47 Mon Sep 17 00:00:00 2001
From: wangjuncheng <1>
Date: 星期四, 17 四月 2025 15:45:14 +0800
Subject: [PATCH] change

---
 src/store/simulation.js      |    8 +++++++-
 src/views/Home.vue           |    5 +++++
 src/views/Screen.vue         |    1 +
 src/views/nav/Navigation.vue |   14 ++++++++++----
 4 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/store/simulation.js b/src/store/simulation.js
index d99e4d2..a873b34 100644
--- a/src/store/simulation.js
+++ b/src/store/simulation.js
@@ -26,6 +26,7 @@
     const showDangerAssess = ref(false)
     const schemCard = ref([])
     const selectTab = ref("琛屾斂鍖哄垝浠跨湡")
+    const backToHome = ref(false)
 
     // 鍒濆鍖栨柟娉�
     const init = () => {
@@ -39,6 +40,7 @@
         locationShow.value = false
         tableShow.value = false
         flowShow.value = false
+        backToHome.value = false
         rightRiverShow.value = false
         showPreview.value = false
         deviceShow.value = false
@@ -129,7 +131,9 @@
         // showResultAssess.value = true
         // showDangerAssess.value = true
     }
-
+    const setBackToHome = (value) => {
+        backToHome.value = value;
+    };
     // 瀵艰埅鐐瑰嚮
     const handleNavClick = (index) => {
         switch (index) {
@@ -181,5 +185,7 @@
         updateSchemCardItem,
         handleClickTab,
         createSimulation,
+        backToHome,
+        setBackToHome
     }
 })
\ No newline at end of file
diff --git a/src/views/Home.vue b/src/views/Home.vue
index a250b6b..ba522a0 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -62,7 +62,12 @@
 
 const route = useRoute();
 const simStore = useSimStore();
+const backHome = ref(false);
 
+// 鎺ユ敹鏉ヨ嚜 ComponentA 鐨勪簨浠讹紝骞舵洿鏂� isFlying
+function handleBackToHome() {
+  backHome.value = false;
+}
 // 浠� store 涓В鏋勯渶瑕佺殑鐘舵��
 const {
   flowShow,
diff --git a/src/views/Screen.vue b/src/views/Screen.vue
index 0135f5f..b02334a 100644
--- a/src/views/Screen.vue
+++ b/src/views/Screen.vue
@@ -125,6 +125,7 @@
 const simStore = useSimStore();
 const { showDangerAssess, rightRiverShow } = storeToRefs(simStore);
 function flyToHomeView() {
+  simStore.setBackToHome(true);
   rightRiverShow.value = false;
   showDangerAssess.value = false;
   router.push("/");
diff --git a/src/views/nav/Navigation.vue b/src/views/nav/Navigation.vue
index fb83ec5..7685fd7 100644
--- a/src/views/nav/Navigation.vue
+++ b/src/views/nav/Navigation.vue
@@ -54,11 +54,10 @@
 <script setup>
 import { useRouter } from "vue-router";
 import { useSimStore } from "@/store/simulation";
-import { ref } from "vue";
+import { ref,watch} from "vue";
 
 const simBtn = ref(false);
 const currentIndexs = ref(1);
-
 const router = useRouter();
 const simStore = useSimStore();
 const isShow = ref(false);
@@ -87,11 +86,18 @@
     }
     ps.emitMessage(desc);
   }
-
-  // 璺敱璺宠浆
   const routes = ["", "/yhgl", "/zhjc", "/mnfz", "/mnpg"];
   router.push(routes[index]);
 };
+watch(
+    () => simStore.backToHome,
+    (newValue) => {
+        if (newValue) {
+            simBtn.value = false;
+            simStore.setBackToHome(false);
+        }
+    }
+);
 const handleClickHome = (index) => {
   if (index === 1) {
     router.push("/");

--
Gitblit v1.9.3