c961dd90 by 任超

stytle:菜单

1 parent a25db879
1 <!--
2 * @Description:
3 * @Autor: renchao
4 * @LastEditTime: 2023-03-24 17:10:02
5 -->
1 <template> 6 <template>
2 <div v-if="!item.hidden"> 7 <div v-if="!item.hidden">
3 <template 8 <template
...@@ -65,9 +70,9 @@ export default { ...@@ -65,9 +70,9 @@ export default {
65 }) 70 })
66 71
67 // When there is only one child router, the child router is displayed by default 72 // When there is only one child router, the child router is displayed by default
68 if (showingChildren.length === 1) { 73 // if (showingChildren.length === 1) {
69 return true 74 // return true
70 } 75 // }
71 76
72 // Show parent if there are no child router to display 77 // Show parent if there are no child router to display
73 if (showingChildren.length === 0) { 78 if (showingChildren.length === 0) {
......
1 <!-- 1 <!--
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-03-23 16:17:42 4 * @LastEditTime: 2023-03-24 17:10:32
5 --> 5 -->
6 <template> 6 <template>
7 <div> 7 <div>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
9 <el-menu router :default-active="activeMenu" :background-color="variables.menuBg" :text-color="variables.menuText" 9 <el-menu router :default-active="activeMenu" :background-color="variables.menuBg" :text-color="variables.menuText"
10 :unique-opened="true" :active-text-color="variables.menuActiveText" :collapse-transition="false" mode="vertical"> 10 :unique-opened="true" :active-text-color="variables.menuActiveText" :collapse-transition="false" mode="vertical">
11 <!-- 权限菜单 --> 11 <!-- 权限菜单 -->
12 <sidebar-item v-for="route in permission_routes.slice(4)" :key="route.path" :item="route" 12 <sidebar-item v-for="route in permission_routes.slice(5)" :key="route.path" :item="route"
13 :base-path="route.path" /> 13 :base-path="route.path" />
14 <!-- 菜单全部展示 --> 14 <!-- 菜单全部展示 -->
15 <!-- <sidebar-item v-for="route in asyncRoutes" :key="route.path" :item="route" :base-path="route.path" /> --> 15 <!-- <sidebar-item v-for="route in asyncRoutes" :key="route.path" :item="route" :base-path="route.path" /> -->
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
50 } 50 }
51 }, 51 },
52 mounted () { 52 mounted () {
53 console.log(this.permission_routes, 'permission_routespermission_routes'); 53 console.log(this.permission_routes.slice(5), 'permission_routes');
54 } 54 }
55 } 55 }
56 </script> 56 </script>
......
1 /* 1 /*
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-03-24 16:59:29 4 * @LastEditTime: 2023-03-24 17:24:52
5 */ 5 */
6 import Vue from 'vue' 6 import Vue from 'vue'
7 import router from "./router"; 7 import router from "./router";
...@@ -33,6 +33,7 @@ router.beforeEach(async (to, from, next) => { ...@@ -33,6 +33,7 @@ router.beforeEach(async (to, from, next) => {
33 if (!hasUser) { 33 if (!hasUser) {
34 store.dispatch("user/getUserInfo"); 34 store.dispatch("user/getUserInfo");
35 } 35 }
36 debugger
36 if (hasAddRoute) { 37 if (hasAddRoute) {
37 next(); 38 next();
38 } else { 39 } else {
......
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
111 let code = this.BASE_API.CODE; 111 let code = this.BASE_API.CODE;
112 localStorage.setItem("token", `Bearer ${res.content}`); 112 localStorage.setItem("token", `Bearer ${res.content}`);
113 const { result: getMenuData } = (await getMenuInfo(code)) || []; 113 const { result: getMenuData } = (await getMenuInfo(code)) || [];
114 let path1 = JSON.parse(getMenuData[0].metadata)?.path + '/' + JSON.parse(getMenuData[0].children[0].metadata)?.path 114 let path1 = JSON.parse(getMenuData[1].metadata)?.path + '/' + JSON.parse(getMenuData[1].children[0].metadata)?.path
115 //登录成功后需判断有无重定向,没有重定向则跳转首页 115 //登录成功后需判断有无重定向,没有重定向则跳转首页
116 const accessRoutes = await this.$store.dispatch( 116 const accessRoutes = await this.$store.dispatch(
117 "permission/generateRoutes", 117 "permission/generateRoutes",
......