From e14264130d54c85706e063ddf6b090b5c2dd4edc Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 30 一月 2026 09:48:06 +0800
Subject: [PATCH] 最新版本541200007
---
admin/src/main.js | 60 +++++++++---------------------------------------------------
1 files changed, 9 insertions(+), 51 deletions(-)
diff --git a/admin/src/main.js b/admin/src/main.js
index dc697c7..0ad3f03 100644
--- a/admin/src/main.js
+++ b/admin/src/main.js
@@ -15,7 +15,6 @@
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)
@@ -38,7 +37,7 @@
router,
store,
computed: {
- ...mapState(['userInfo', 'homePage','topMenuCurrent','menuData'])
+ ...mapState(['userInfo', 'homePage'])
},
watch: {
async userInfo () {
@@ -46,16 +45,10 @@
return
}
await this.initRoutes()
- },
- async topMenuCurrent () {
- if (this.topMenuCurrent == null) {
- return
- }
- await this.chagneRoutes()
}
},
methods: {
- ...mapMutations(['switchCollapseMenu', 'setCurrentIndex', 'setHomePage', 'setTopMenuCurrent', 'setTopMenuCurrent','cleartagsview']),
+ ...mapMutations(['switchCollapseMenu', 'setHomePage']),
// 鍒濆鍖栨湰鍦伴厤缃�
initLocalConfig () {
// 鑿滃崟鐘舵�侀厤缃�
@@ -81,40 +74,17 @@
await fetchMenuTree()
.then(allmenus => {
// 娣诲姞鑿滃崟
+ var menus = allmenus.filter(item => {
+ return item.type !== 1
+ })
var topList = allmenus.filter(item => {
return item.type === 1
})
+ console.log(topList)
+ storeMenus.push.apply(storeMenus, menus)
storeTopMenus.push.apply(storeTopMenus, topList)
- var topCurrent = null
- var tlist =[]
- topList.forEach(item => {
- if (item.linkType === 0 ) {
- if (topCurrent == null) {
- topCurrent = item
- }
- tlist.push(...item.children)
- }
- })
- 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 => {
- // console.log(topCurrent.id, item.id)
- // if (item.id == this.topMenuCurrent.id) {
- // menus = item.children
- // }
- // })
- console.log('menus', this.menuData.list)
- storeMenus.push.apply(storeMenus, this.menuData.list)
// 娣诲姞璺敱
- this.__addRouters(tlist)
+ this.__addRouters(storeMenus)
// 404
router.addRoute({
path: '*',
@@ -127,9 +97,7 @@
redirect: this.homePage.url
})
// 璺敱鍔犺浇瀹屾垚鍚庯紝濡傛灉璁块棶鐨勬槸/锛岃烦杞嚦鍔ㄦ�佽瘑鍒殑棣栭〉
- 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 === '/') {
+ if (this.$route.path === '/') {
this.$router.push(this.homePage.url)
}
})
@@ -139,16 +107,6 @@
.finally(() => {
this.loading = false
})
- },
- async chagneRoutes () {
- // 閲嶇疆鑿滃崟
- this.cleartagsview('/index')
- console.log('menus', this.menuData.list)
- // 娣诲姞璺敱
- // this.__addRouters(this.menuData.list)
- if(this.topMenuCurrent.homeUrl){
- await this.$router.push({path: this.topMenuCurrent.homeUrl, query: {}})
- }
},
// 鏂板缓璺敱
__addRouters (routes, parents = []) {
--
Gitblit v1.9.3