From bff05c941230c57f0a1ed8d0e3c4f9c7b2b8af13 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 11 十一月 2025 16:40:14 +0800
Subject: [PATCH] 优化

---
 admin/src/main.js |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/admin/src/main.js b/admin/src/main.js
index a98f12b..dc697c7 100644
--- a/admin/src/main.js
+++ b/admin/src/main.js
@@ -15,6 +15,7 @@
 import preventReClick from '@/directives/directive'
 import Treeselect from '@riophae/vue-treeselect'
 import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+
 Vue.component('treeselect', Treeselect)
 
 Vue.use(preventReClick)
@@ -54,7 +55,7 @@
     }
   },
   methods: {
-    ...mapMutations(['switchCollapseMenu', 'setHomePage', 'setTopMenuCurrent', 'setTopMenuCurrent','cleartagsview']),
+    ...mapMutations(['switchCollapseMenu', 'setCurrentIndex', 'setHomePage', 'setTopMenuCurrent', 'setTopMenuCurrent','cleartagsview']),
     // 鍒濆鍖栨湰鍦伴厤缃�
     initLocalConfig () {
       // 鑿滃崟鐘舵�侀厤缃�
@@ -94,7 +95,14 @@
               tlist.push(...item.children)
             }
           })
-          this.setTopMenuCurrent(topCurrent)
+          if (this.$route.query && this.$route.query.menuparams) {
+            let menu = topList.filter(item => item.params === this.$route.query.menuparams)
+            this.setTopMenuCurrent(menu[0])
+            this.setCurrentIndex(topList.findIndex(obj => obj.params === this.$route.query.menuparams))
+          } else {
+            this.setTopMenuCurrent(topCurrent)
+            this.setCurrentIndex(0)
+          }
           // console.log(topList)
           // var menus = []
           // topList.forEach(item => {
@@ -119,7 +127,9 @@
             redirect: this.homePage.url
           })
           // 璺敱鍔犺浇瀹屾垚鍚庯紝濡傛灉璁块棶鐨勬槸/锛岃烦杞嚦鍔ㄦ�佽瘑鍒殑棣栭〉
-          if (this.$route.path === '/') {
+          if (this.$route.query && this.$route.query.menuparams) {
+            this.$router.push(topList.filter(item => item.params === this.$route.query.menuparams)[0].homeUrl)
+          } else if (this.$route.path === '/') {
             this.$router.push(this.homePage.url)
           }
         })

--
Gitblit v1.9.3