diff --git a/src/layout/components/HeaderSys/index.vue b/src/layout/components/HeaderSys/index.vue index 19feea9..8af36e1 100644 --- a/src/layout/components/HeaderSys/index.vue +++ b/src/layout/components/HeaderSys/index.vue @@ -76,6 +76,7 @@ import { ElMessageBox } from 'element-plus'; import usePermissionStore from '@/store/modules/permission'; import { getUserProfile } from '@/api/system/user'; + const permissionStore = usePermissionStore(); const { proxy } = getCurrentInstance(); const dialogShow = ref(false); diff --git a/src/layout/components/HeaderSys/index.vue b/src/layout/components/HeaderSys/index.vue index 19feea9..8af36e1 100644 --- a/src/layout/components/HeaderSys/index.vue +++ b/src/layout/components/HeaderSys/index.vue @@ -76,6 +76,7 @@ import { ElMessageBox } from 'element-plus'; import usePermissionStore from '@/store/modules/permission'; import { getUserProfile } from '@/api/system/user'; + const permissionStore = usePermissionStore(); const { proxy } = getCurrentInstance(); const dialogShow = ref(false); diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 9a4eb1d..021832e 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -36,7 +36,6 @@ localStorage.setItem('routerPartKFC', rewriteRoutes[1].name); //默认加载第一个菜单 } else { router.push({ path: '/chengguanweiScreen' }); - localStorage.setItem('routerPartKFC', rewriteRoutes[1].name); //默认加载第一个菜单 } }); }); diff --git a/src/layout/components/HeaderSys/index.vue b/src/layout/components/HeaderSys/index.vue index 19feea9..8af36e1 100644 --- a/src/layout/components/HeaderSys/index.vue +++ b/src/layout/components/HeaderSys/index.vue @@ -76,6 +76,7 @@ import { ElMessageBox } from 'element-plus'; import usePermissionStore from '@/store/modules/permission'; import { getUserProfile } from '@/api/system/user'; + const permissionStore = usePermissionStore(); const { proxy } = getCurrentInstance(); const dialogShow = ref(false); diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 9a4eb1d..021832e 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -36,7 +36,6 @@ localStorage.setItem('routerPartKFC', rewriteRoutes[1].name); //默认加载第一个菜单 } else { router.push({ path: '/chengguanweiScreen' }); - localStorage.setItem('routerPartKFC', rewriteRoutes[1].name); //默认加载第一个菜单 } }); }); diff --git a/src/views/sponeScreen/HaiMianScreen/index.vue b/src/views/sponeScreen/HaiMianScreen/index.vue index f624eaa..0792593 100644 --- a/src/views/sponeScreen/HaiMianScreen/index.vue +++ b/src/views/sponeScreen/HaiMianScreen/index.vue @@ -153,7 +153,9 @@ import waterCourse_icon from '@/assets/cesiumMap/legendIcon/combineBengZhan_icon.png'; import sewageFactory_icon from '@/assets/cesiumMap/legendIcon/sewageFactory_icon.png'; import pipeMonitor_icon from '@/assets/cesiumMap/legendIcon/pipeMonitor_icon.png'; +import usePermissionStore from '@/store/modules/permission'; +const permissionStore = usePermissionStore(); const { proxy } = getCurrentInstance(); const router = useRouter(); const weatherInfo = ref({}); @@ -192,6 +194,16 @@ // 跳转业务系统 function goSystem() { + // 动态获取路由返回子菜单 + let arrs = []; + permissionStore.sidebarRouters.map(item => { + if (!!!item.meta) return; + arrs.push({ + title: item.meta.title, + name: item.name, + }); + }); + localStorage.setItem('routerPartKFC', arrs[1].name); //默认加载第一个菜单 router.push({ path: '/index' }); }