From 34fe52caba63e6a6337cb9c3e6bd0d4707fd6a99 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 06 三月 2026 10:17:05 +0800
Subject: [PATCH] 解决冲突
---
admin/src/main.js | 120 ++++++++++++++++++++++++++++++------------------------------
1 files changed, 60 insertions(+), 60 deletions(-)
diff --git a/admin/src/main.js b/admin/src/main.js
index bc32466..d04334f 100644
--- a/admin/src/main.js
+++ b/admin/src/main.js
@@ -38,7 +38,7 @@
router,
store,
computed: {
- ...mapState(['userInfo', 'homePage','topMenuCurrent','menuData'])
+ ...mapState(['userInfo', 'homePage', 'topMenuCurrent', 'menuData'])
},
watch: {
async userInfo () {
@@ -55,7 +55,7 @@
}
},
methods: {
- ...mapMutations(['switchCollapseMenu', 'setCurrentIndex', 'setHomePage', 'setTopMenuCurrent', 'setTopMenuCurrent','cleartagsview']),
+ ...mapMutations(['switchCollapseMenu', 'setCurrentIndex', 'setHomePage', 'setTopMenuCurrent', 'setTopMenuCurrent', 'cleartagsview']),
// 鍒濆鍖栨湰鍦伴厤缃�
initLocalConfig () {
// 鑿滃崟鐘舵�侀厤缃�
@@ -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
- }
- tlist.push(...item.children)
+ .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
}
- })
- 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)
+ tlist.push(...item.children)
}
})
- .catch(e => {
- throw e
+ if (this.$route.query && this.$route.query.menuparams) {
+ const 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'
})
- .finally(() => {
- this.loading = false
+ // 棣栭〉
+ 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)
+ }
+ })
+ .catch(e => {
+ throw e
+ })
+ .finally(() => {
+ this.loading = false
+ })
},
async chagneRoutes () {
// 閲嶇疆鑿滃崟
@@ -146,8 +146,8 @@
console.log('menus', this.menuData.list)
// 娣诲姞璺敱
// this.__addRouters(this.menuData.list)
- if(this.topMenuCurrent.homeUrl){
- await this.$router.push({path: this.topMenuCurrent.homeUrl, query: {}})
+ if (this.topMenuCurrent.homeUrl) {
+ await this.$router.push({ path: this.topMenuCurrent.homeUrl, query: {} })
}
},
// 鏂板缓璺敱
@@ -188,7 +188,7 @@
return
}
await this.initRoutes()
- .catch(() => {})
+ .catch(() => {})
},
mounted () {
this.initLocalConfig()
--
Gitblit v1.9.3