wangjuncheng
2025-04-17 c761bc5e98bd6b1fe0900f3cfb1bb4734e1aed47
change
已修改4个文件
28 ■■■■ 文件已修改
src/store/simulation.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Home.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Screen.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/nav/Navigation.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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
    }
})
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,
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("/");
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("/");