technological-brain-web/src/components/PageNavigation.vue

153 lines
3.7 KiB
Vue
Raw Normal View History

2025-10-14 18:37:27 +08:00
<template>
<header class="topbar" :class="{ 'light-theme': isLightTheme }">
<!-- 左侧品牌 -->
<router-link to="/" class="brand">
<div class="brand-mark"></div>
<div class="brand-text">科技大脑智慧服务平台</div>
</router-link>
<!-- 右侧整条胶囊导航条 -->
<div class="nav-wrap">
<div class="nav-list" role="navigation" aria-label="主导航">
<router-link to="/" class="nav-item" :class="{ 'is-active': $route.name === 'home' }">首页</router-link>
<router-link to="/news-policy" class="nav-item" :class="{ 'is-active': $route.name === 'news-policy' }">新闻政策</router-link>
<router-link to="/smart-qa" class="nav-item" :class="{ 'is-active': $route.name === 'smart-qa' }">智慧问答</router-link>
<router-link to="/tech-resources" class="nav-item" :class="{ 'is-active': $route.name === 'tech-resources' }">科技资源</router-link>
<router-link to="/talent-profile" class="nav-item" :class="{ 'is-active': $route.name === 'talent-profile' }">人才画像</router-link>
<router-link to="/login" class="nav-item" :class="{ 'is-active': $route.name === 'login' }">登录</router-link>
</div>
</div>
</header>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { useRoute } from 'vue-router'
const route = useRoute()
// 判断是否为浅色主题页面(除了首页和登录页)
const isLightTheme = computed(() => {
return route.name !== 'home' && route.name !== 'login'
})
</script>
<style scoped>
/* ===== 顶栏 ===== */
/* 顶部整行:左右两端布局 */
.topbar {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1000;
padding: 24px 32px;
display: flex;
align-items: center;
justify-content: space-between;
pointer-events: auto;
background: rgba(8, 26, 43, 0.95);
backdrop-filter: blur(10px);
border-bottom: 1px solid rgba(130, 196, 255, 0.15);
transition: all 0.3s ease;
}
.topbar.light-theme {
background: rgba(255, 255, 255, 0.95);
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
/* 左侧品牌区 */
.brand {
display: flex;
align-items: center;
gap: 14px;
color: #cfe8ff;
text-decoration: none;
}
.light-theme .brand {
color: #2c3e50;
}
.brand-mark {
width: 24px;
height: 6px;
border-radius: 4px;
background: #49b0ff;
box-shadow: 0 0 12px #49b0ff;
}
.brand-text {
font-size: 20px;
letter-spacing: 0.5px;
opacity: 0.95;
}
.light-theme .brand-text {
opacity: 1;
}
/* 右侧胶囊导航条:纯 divflex 布局 */
.nav-wrap {
display: flex;
align-items: flex-end;
gap: 16px;
padding: 10px 10px 10px 18px;
min-width: 720px; /* 让条看起来更长一些,可按需调整 */
backdrop-filter: blur(2px);
cursor: pointer;
}
/* 菜单区:居中对齐、等间距 */
.nav-list {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
gap: 42px;
}
/* 菜单项router-link 样式hover 高亮active 发光 */
.nav-item {
position: relative;
padding: 6px 2px;
color: #ffffff;
font-size: 16px;
letter-spacing: 0.5px;
transition: color 0.2s ease, text-shadow 0.2s ease, transform 0.2s ease;
cursor: pointer;
text-decoration: none;
display: inline-block;
}
.nav-item:hover {
color: #d7ecff;
text-shadow: 0 0 10px rgba(144, 210, 255, 0.5);
cursor: pointer;
}
.nav-item.is-active {
color: #8fd3ff;
font-weight: 600;
text-shadow: 0 0 10px rgba(150, 210, 255, 0.85);
}
/* 浅色主题样式 */
.light-theme .nav-item {
color: #606266;
text-shadow: none;
}
.light-theme .nav-item:hover {
color: #409eff;
text-shadow: none;
}
.light-theme .nav-item.is-active {
color: #409eff;
font-weight: 600;
text-shadow: none;
}
</style>