Files
toolbox/resources/js/components/AdminLayout.vue
2025-08-01 16:55:23 +08:00

163 lines
6.0 KiB
Vue

<template>
<div class="admin-layout h-screen bg-gray-50">
<!-- 侧边栏 -->
<div class="fixed inset-y-0 left-0 z-50 w-64 bg-white shadow-lg border-r border-gray-200 flex flex-col">
<!-- Logo区域 -->
<div class="flex items-center justify-center h-16 px-6 bg-gradient-to-r from-blue-600 to-blue-700 border-b border-blue-800 flex-shrink-0">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 bg-white rounded-lg flex items-center justify-center">
<svg class="w-5 h-5 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
<path d="M3 4a1 1 0 011-1h12a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zM3 10a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H4a1 1 0 01-1-1v-6zM14 9a1 1 0 00-1 1v6a1 1 0 001 1h2a1 1 0 001-1v-6a1 1 0 00-1-1h-2z"/>
</svg>
</div>
<div class="text-white">
<div class="text-lg font-bold">管理系统</div>
<div class="text-xs text-blue-100">Environment Manager</div>
</div>
</div>
</div>
<!-- 导航菜单 -->
<nav class="mt-6 px-3 flex flex-col flex-1">
<div class="space-y-1 flex-1">
<a
href="#"
@click.prevent="setActiveMenu('env')"
:class="[
'group flex items-center px-3 py-2 text-sm font-medium rounded-lg transition-colors duration-200',
activeMenu === 'env'
? 'bg-blue-50 text-blue-700 border-r-2 border-blue-700'
: 'text-gray-700 hover:bg-gray-50 hover:text-gray-900'
]"
>
<svg
:class="[
'mr-3 h-5 w-5 transition-colors duration-200',
activeMenu === 'env' ? 'text-blue-500' : 'text-gray-400 group-hover:text-gray-500'
]"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
环境配置管理
</a>
<!-- 预留的其他菜单项 -->
<a
href="#"
@click.prevent="setActiveMenu('settings')"
:class="[
'group flex items-center px-3 py-2 text-sm font-medium rounded-lg transition-colors duration-200',
activeMenu === 'settings'
? 'bg-blue-50 text-blue-700 border-r-2 border-blue-700'
: 'text-gray-700 hover:bg-gray-50 hover:text-gray-900'
]"
>
<svg
:class="[
'mr-3 h-5 w-5 transition-colors duration-200',
activeMenu === 'settings' ? 'text-blue-500' : 'text-gray-400 group-hover:text-gray-500'
]"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
</svg>
系统设置
</a>
<a
href="#"
@click.prevent="setActiveMenu('logs')"
:class="[
'group flex items-center px-3 py-2 text-sm font-medium rounded-lg transition-colors duration-200',
activeMenu === 'logs'
? 'bg-blue-50 text-blue-700 border-r-2 border-blue-700'
: 'text-gray-700 hover:bg-gray-50 hover:text-gray-900'
]"
>
<svg
:class="[
'mr-3 h-5 w-5 transition-colors duration-200',
activeMenu === 'logs' ? 'text-blue-500' : 'text-gray-400 group-hover:text-gray-500'
]"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
操作日志
</a>
</div>
<!-- 底部信息 -->
<div class="mt-auto pt-6 border-t border-gray-200">
<div class="px-3 py-2">
<div class="text-xs text-gray-500 mb-1">系统信息</div>
<div class="text-xs text-gray-400">版本 v1.0.0</div>
<div class="text-xs text-gray-400">Laravel 12 + Vue 3</div>
</div>
</div>
</nav>
</div>
<!-- 主内容区域 -->
<div class="pl-64 h-screen">
<!-- 页面内容 -->
<main class="h-full">
<slot></slot>
</main>
</div>
</div>
</template>
<script>
export default {
name: 'AdminLayout',
props: {
pageTitle: {
type: String,
default: '环境配置管理'
}
},
data() {
return {
activeMenu: 'env'
}
},
methods: {
setActiveMenu(menu) {
this.activeMenu = menu;
this.$emit('menu-change', menu);
}
}
}
</script>
<style scoped>
.admin-layout {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
/* 响应式设计 */
@media (max-width: 1024px) {
.admin-layout .pl-64 {
padding-left: 0;
}
.admin-layout .fixed.w-64 {
transform: translateX(-100%);
transition: transform 0.3s ease-in-out;
}
.admin-layout .fixed.w-64.open {
transform: translateX(0);
}
}
</style>