Ver código fonte

修改首页显示

lex-xin 4 anos atrás
pai
commit
1010af02db

+ 23 - 13
src/permission.js

@@ -42,25 +42,35 @@ function getFirstMenu(routes) {
   let firstMenu = null
   routes.forEach(item => {
     if(!firstMenu && item.children?.length > 0) {
-      item.children.forEach(child => {
-        if(!firstMenu && child.children?.length > 0) {
-          child.children.forEach(sChild => {
-            if(!firstMenu && !sChild.hidden) {
-              firstMenu = child.path + '/' + sChild.path
-            }
-          })
-        } else {
-          if(!firstMenu && !child.hidden) {
-            firstMenu = item.path + '/' + child.path
-          }
+      firstMenu = pathErgodic(item)
+    }
+  })
+  return firstMenu
+}
+
+function pathErgodic(item) {
+  let firstMenu = null
+  item.children.forEach(i => {
+    if(!firstMenu && i.children?.length > 0) {
+      firstMenu = pathErgodic(i)
+    } else {
+      if(!firstMenu && checkPathUrl(i.path)) {
+        firstMenu = i.path
+      } else {
+        if(!firstMenu && !i.hidden) {
+          firstMenu = item.path + '/' + i.path
         }
-      })
+      }
     }
   })
-  console.log(firstMenu)
   return firstMenu
 }
 
+// 判断path有没有带/,并且是第一个位置
+function checkPathUrl(path) {
+  return path.indexOf('/') === 0 ? true : false
+}
+
 
 router.beforeEach(async (to, from, next) => {
   // from.query = to.query

+ 1 - 1
src/views/adapayAccount/form.vue

@@ -377,7 +377,7 @@ export default {
       this.form.multipartFile = null
       this.$store.dispatch('delVisitedViews', this.$route)
       this.$router.push({
-        path: "/systemManager/sysBasics/adapayManager"
+        path: "/sysBasics/adapayManager"
       });
     }
   },

+ 1 - 1
src/views/adapayAccount/index.vue

@@ -286,7 +286,7 @@ export default {
         tagTitle = '修改'
       }
       this.$router.push({
-        path: '/systemManager/sysBasics/adapayOperation',
+        path: '/sysBasics/adapayOperation',
         query: {
           type: type,
           row: JSON.stringify(row)

+ 2 - 2
src/views/app/entryActivities.vue

@@ -157,7 +157,7 @@ export default {
         })
       } else if (type == 'create') {
         this.$router.push({
-          path: '/systemManager/sysBasics/entryOperation',
+          path: '/sysBasics/entryOperation',
           query: {
             type: 'create'
           }
@@ -166,7 +166,7 @@ export default {
         })
       } else if (type == 'look') {
         this.$router.push({
-          path: '/systemManager/sysBasics/entryOperation',
+          path: '/sysBasics/entryOperation',
           query: {
             id: row.id,
             type: 'look'

+ 2 - 2
src/views/app/entryOperation.vue

@@ -351,7 +351,7 @@ export default {
         this.$message.success(title + "成功");
         this.$store.dispatch('delVisitedViews', this.$route)
         this.$router.push({
-          path: "/systemManager/sysBasics/entryActivities"
+          path: "/sysBasics/entryActivities"
         });
       } else {
         this.$message.error(res.msg);
@@ -360,7 +360,7 @@ export default {
     onCancel () {
       this.$store.dispatch('delVisitedViews', this.$route)
       this.$router.push({
-        path: "/systemManager/sysBasics/entryActivities"
+        path: "/sysBasics/entryActivities"
       });
     },
     handleSuccess (res) {

+ 1 - 1
src/views/categroyManager/insideSetting/adminManager.vue

@@ -84,7 +84,7 @@ export default {
     },
     onAdminOperation (type, row) {
       let params = {
-        path: '/systemManager/parameter/adminoperation',
+        path: '/parameter/adminoperation',
         query: {
           type: type,
           page: this.pageInfo.page

+ 2 - 2
src/views/categroyManager/insideSetting/adminOperation.vue

@@ -135,7 +135,7 @@ export default {
       if (res.code == 200) {
         this.$message.success('修改成功')
         this.$store.dispatch('delVisitedViews', this.$route)
-        this.$router.push({ path: '/systemManager/parameter/adminManager', query: { page: this.page } })
+        this.$router.push({ path: '/parameter/adminManager', query: { page: this.page } })
       } else {
         this.$message.error(res.msg)
       }
@@ -240,7 +240,7 @@ export default {
     onCancel () {
       this.$store.dispatch('delVisitedViews', this.$route)
       this.$router.push({
-        path: '/systemManager/parameter/adminManager',
+        path: '/parameter/adminManager',
         query: {
           page: this.$route.query.page
         }