war-web/src/App.vue
2025-08-21 12:58:48 +08:00

145 lines
3.3 KiB
Vue
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div id="app">
<el-config-provider :locale="zhCn">
<div class="app-container">
<!-- 顶部导航栏 -->
<el-header class="app-header">
<div class="header-left">
<div class="logo">🛡</div>
<h1 class="app-title">红蓝攻防对抗系统</h1>
</div>
<div class="header-right">
<el-button-group>
<el-button
v-for="route in navRoutes"
:key="route.name"
:type="$route.name === route.name ? 'primary' : 'default'"
@click="$router.push(route.path)"
>
{{ route.meta?.title }}
</el-button>
</el-button-group>
</div>
</el-header>
<!-- 主要内容区域 -->
<el-main class="app-main">
<router-view />
</el-main>
</div>
</el-config-provider>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
const router = useRouter()
// 导航路由配置
const navRoutes = ref([
{ name: 'Dashboard', path: '/', meta: { title: '主控面板' } },
{ name: 'EntityManagement', path: '/entities', meta: { title: '实体管理' } },
{ name: 'MissionPlanning', path: '/missions', meta: { title: '任务规划' } },
{ name: 'SituationAwareness', path: '/situation', meta: { title: '态势感知' } },
{ name: 'Assessment', path: '/assessment', meta: { title: '战况评估' } },
{ name: 'ComponentDemo', path: '/components', meta: { title: '组件展示' } }
])
</script>
<style scoped>
.app-container {
height: 100vh;
display: flex;
flex-direction: column;
}
.app-header {
display: flex;
justify-content: space-between;
align-items: center;
background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
color: white;
padding: 0 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
z-index: 1000;
}
.header-left {
display: flex;
align-items: center;
gap: 12px;
}
.logo {
height: 40px;
width: 40px;
font-size: 24px;
display: flex;
align-items: center;
justify-content: center;
}
.app-title {
margin: 0;
font-size: 20px;
font-weight: 600;
color: white;
}
.header-right {
display: flex;
align-items: center;
}
.app-main {
flex: 1;
padding: 0;
overflow-y: auto;
overflow-x: hidden;
background-color: #f5f5f5;
/* 自定义滚动条样式 */
scrollbar-width: thin;
scrollbar-color: rgba(30, 60, 114, 0.3) transparent;
}
.app-main::-webkit-scrollbar {
width: 8px;
}
.app-main::-webkit-scrollbar-track {
background: transparent;
}
.app-main::-webkit-scrollbar-thumb {
background: rgba(30, 60, 114, 0.3);
border-radius: 4px;
transition: background-color 0.3s ease;
}
.app-main::-webkit-scrollbar-thumb:hover {
background: rgba(30, 60, 114, 0.5);
}
/* 全局样式重置 */
* {
box-sizing: border-box;
}
#app {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body, html {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden; /* 保持主体不滚动,只在.app-main中滚动 */
}
</style>