|
@@ -204,7 +204,7 @@ function toLastView(visitedViews, view) {
|
|
|
if (latestView && latestView.fullPath) {
|
|
|
router.push(latestView.fullPath)
|
|
|
} else {
|
|
|
- if (view?.name === 'Dashboard') {
|
|
|
+ if (view?.name === 'home') {
|
|
|
router.replace({ path: '/redirect' + view.fullPath })
|
|
|
} else {
|
|
|
router.push('/')
|
|
@@ -288,54 +288,6 @@ function closeContentMenu() {
|
|
|
function handleScroll() {
|
|
|
closeContentMenu()
|
|
|
}
|
|
|
-
|
|
|
-function findOutermostParent(tree, findName) {
|
|
|
- let parentMap = {}
|
|
|
-
|
|
|
- function buildParentMap(node, parent) {
|
|
|
- parentMap[node.name] = parent
|
|
|
-
|
|
|
- if (node.children) {
|
|
|
- for (let i = 0; i < node.children.length; i++) {
|
|
|
- buildParentMap(node.children[i], node)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- for (let i = 0; i < tree.length; i++) {
|
|
|
- buildParentMap(tree[i], null)
|
|
|
- }
|
|
|
-
|
|
|
- let currentNode = parentMap[findName]
|
|
|
- while (currentNode) {
|
|
|
- if (!parentMap[currentNode.name]) {
|
|
|
- return currentNode
|
|
|
- }
|
|
|
- currentNode = parentMap[currentNode.name]
|
|
|
- }
|
|
|
-
|
|
|
- return null
|
|
|
-}
|
|
|
-
|
|
|
-const againActiveTop = (newVal) => {
|
|
|
- if (layout.value !== 'mix') return
|
|
|
- const parent = findOutermostParent(permissionStore.routes, newVal)
|
|
|
- if (appStore.activeTopMenu !== parent.path) {
|
|
|
- appStore.activeTopMenu(parent.path)
|
|
|
- }
|
|
|
-}
|
|
|
-// 如果是混合模式,更改selectedTag,需要对应高亮的activeTop
|
|
|
-watch(
|
|
|
- () => route.name,
|
|
|
- (newVal) => {
|
|
|
- if (newVal) {
|
|
|
- againActiveTop(newVal)
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- deep: true
|
|
|
- }
|
|
|
-)
|
|
|
onMounted(() => {
|
|
|
initTags()
|
|
|
})
|