From 9ed63131e87df9fc45c35f445a24506ae662d23c Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 06 三月 2026 09:55:25 +0800
Subject: [PATCH] 更改头部
---
admin/src/main.js | 112 ++++++++++++++++++++++++++++----------------------------
1 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/admin/src/main.js b/admin/src/main.js
index dc697c7..bc32466 100644
--- a/admin/src/main.js
+++ b/admin/src/main.js
@@ -79,66 +79,66 @@
this.setHomePage(storeMenus[0])
}
await fetchMenuTree()
- .then(allmenus => {
- // 娣诲姞鑿滃崟
- var topList = allmenus.filter(item => {
- return item.type === 1
- })
- storeTopMenus.push.apply(storeTopMenus, topList)
- var topCurrent = null
- var tlist =[]
- topList.forEach(item => {
- if (item.linkType === 0 ) {
- if (topCurrent == null) {
- topCurrent = item
+ .then(allmenus => {
+ // 娣诲姞鑿滃崟
+ var topList = allmenus.filter(item => {
+ return item.type === 1
+ })
+ 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)
}
- 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)
+ // 404
+ router.addRoute({
+ path: '*',
+ redirect: '/not-found'
+ })
+ // 棣栭〉
+ router.addRoute({
+ name: 'index',
+ path: '/',
+ 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 === '/') {
+ this.$router.push(this.homePage.url)
}
})
- 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)
- // 404
- router.addRoute({
- path: '*',
- redirect: '/not-found'
+ .catch(e => {
+ throw e
})
- // 棣栭〉
- router.addRoute({
- name: 'index',
- path: '/',
- redirect: this.homePage.url
+ .finally(() => {
+ this.loading = false
})
- // 璺敱鍔犺浇瀹屾垚鍚庯紝濡傛灉璁块棶鐨勬槸/锛岃烦杞嚦鍔ㄦ�佽瘑鍒殑棣栭〉
- 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)
- }
- })
- .catch(e => {
- throw e
- })
- .finally(() => {
- this.loading = false
- })
},
async chagneRoutes () {
// 閲嶇疆鑿滃崟
@@ -188,7 +188,7 @@
return
}
await this.initRoutes()
- .catch(() => {})
+ .catch(() => {})
},
mounted () {
this.initLocalConfig()
--
Gitblit v1.9.3