4545 <h1 >{{ currentPageTitle }}</h1 >
4646 <div class =" header-actions" >
4747 <el-tooltip content =" System manage" placement =" bottom" >
48- <div class =" header-icon-btn" >
48+ <div class =" header-icon-btn" @click = " toSystem " >
4949 <el-icon ><iconsystem /></el-icon >
5050 <span >System manage</span >
5151 </div >
7777 </div >
7878 </div >
7979
80+ <div v-if =" sysRouterList.length && showHead" class =" sys-setting-container" >
81+ <el-menu
82+ :default-active =" activeMenu"
83+ class =" el-menu-demo"
84+ mode =" horizontal"
85+ >
86+ <el-menu-item v-for =" item in sysRouterList" :key =" item.path" :index =" item.path" @click =" menuSelect" >
87+ <el-icon v-if =" item.meta.icon" >
88+ <component :is =" resolveIcon(item.meta.icon)" />
89+ </el-icon >
90+ <span >{{ item.meta.title }}</span >
91+ </el-menu-item >
92+ </el-menu >
93+ </div >
8094
81- <div class =" page-content" >
95+ <div v-if =" sysRouterList.length && showHead" class =" sys-page-content" >
96+ <div class =" sys-inner-container" >
97+ <router-view />
98+ </div >
99+ </div >
100+ <div v-else class =" page-content" >
82101 <router-view />
83102 </div >
84103 </div >
@@ -105,19 +124,31 @@ const route = useRoute()
105124const userStore = useUserStore ()
106125const name = ref (' admin' )
107126const activeMenu = computed (() => route .path )
108-
109127const routerList = computed (() => {
110128 return router .getRoutes ().filter (route => {
111- return route .path !== ' /login' && ! route .redirect && route .path !== ' /:pathMatch(.*)*'
129+ return route .path !== ' /login' && ! route .path . includes ( ' /system ' ) && ! route . redirect && route .path !== ' /:pathMatch(.*)*'
112130 })
113131})
132+
133+ const sysRouterList = computed (() => {
134+ return router .getRoutes ().filter (route => route .path .includes (' /system' ))
135+ })
136+
137+ const showHead = computed (() => {
138+ return route .path .includes (' /system' )
139+ })
114140const workspace = ref (' 1' )
115141const options = [
116142 { value: ' 1' , label: ' Default workspace' },
117143 { value: ' 2' , label: ' Workspace 2' },
118144 { value: ' 3' , label: ' Workspace 3' }
119145]
120- const currentPageTitle = computed (() => route .meta .title || ' Dashboard' )
146+ const currentPageTitle = computed (() => {
147+ if (route .path .includes (' /system' )) {
148+ return ' System Settings'
149+ }
150+ return route .meta .title || ' Dashboard'
151+ })
121152const resolveIcon = (iconName : any ) => {
122153 const icons: Record <string , any > = {
123154 ' ds' : ds ,
@@ -129,13 +160,15 @@ const resolveIcon = (iconName: any) => {
129160}
130161
131162const menuSelect = (e : any ) => {
132- console .log (routerList .value )
133163 router .push (e .index )
134164}
135165const logout = () => {
136166 userStore .logout ()
137167 router .push (' /login' )
138168}
169+ const toSystem = () => {
170+ router .push (' /system' )
171+ }
139172 </script >
140173
141174<style lang="less" scoped>
@@ -260,6 +293,23 @@ const logout = () => {
260293 flex : 1 ;
261294 overflow-y : auto ;
262295 }
296+ .sys-page-content {
297+ background-color : var (--white );
298+ border-radius : var (--border-radius );
299+ padding : 24px ;
300+ box-shadow : var (--shadow );
301+ margin-top : 24px ;
302+ .sys-inner-container {
303+ background : #fff ;
304+ border-radius : 8px ;
305+ padding : 20px ;
306+ box-shadow : 0 2px 8px rgba (0 , 0 , 0 , 0.1 );
307+ }
308+ }
309+ .sys-setting-container {
310+ overflow : hidden ;
311+ border-radius : 8px ;
312+ }
263313 }
264314}
265315 </style >
0 commit comments