| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- <template>
- <header class="page-header">
- <div class="header-content">
- <div class="header-left">
- <div class="logo-container">
- <img src="/金水logo.png" alt="中国水文" class="water-logo">
- </div>
- <div class="title-container">
- <h1 class="site-title">东南大区成果展示平台</h1>
- <h2 class="site-subtitle">数字孪生技术在水文领域的应用与解决方案</h2>
- </div>
- </div>
-
- <nav class="nav-menu">
- <router-link to="/" class="nav-item" :class="{ active: currentRoute === '/' }">首页</router-link>
- <router-link to="/model-management" class="nav-item" :class="{ active: currentRoute === '/model-management' }">项目管理</router-link>
- <a href="#" class="nav-item">数据分析</a>
- <a href="#" class="nav-item">监测预警</a>
- <router-link to="/admin" class="nav-item">后台管理</router-link>
- </nav>
-
- <div class="header-right">
- <div class="current-time">{{ currentTime }}</div>
- </div>
- </div>
- </header>
- </template>
- <script setup>
- import { ref, onMounted, onUnmounted, watch } from 'vue'
- import { useRoute, useRouter } from 'vue-router'
- const currentRoute = ref('')
- const currentTime = ref('')
- const route = useRoute()
- const router = useRouter()
- const updateTime = () => {
- const now = new Date()
- const year = now.getFullYear()
- const month = String(now.getMonth() + 1).padStart(2, '0')
- const day = String(now.getDate()).padStart(2, '0')
- const hours = String(now.getHours()).padStart(2, '0')
- const minutes = String(now.getMinutes()).padStart(2, '0')
- const seconds = String(now.getSeconds()).padStart(2, '0')
-
- currentTime.value = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
- }
- let timer = null
- onMounted(() => {
- currentRoute.value = route.path
- updateTime()
- timer = setInterval(updateTime, 1000)
- })
- // 监听路由变化
- watch(
- () => route.path,
- (newPath) => {
- currentRoute.value = newPath
- }
- )
- onUnmounted(() => {
- if (timer) {
- clearInterval(timer)
- }
- })
- </script>
- <style scoped>
- .page-header {
- background: linear-gradient(135deg, #326ee2 100%);
- color: white;
- padding: 0.8rem 0;
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
- position: relative;
- z-index: 1000;
- height: 80px;
- }
- .header-content {
- width: 100%;
- height: 100%;
- padding: 0 1rem;
- display: flex;
- justify-content: space-between;
- align-items: center;
- max-width: 100%;
- margin: 0 auto;
- }
- .header-left {
- display: flex;
- align-items: center;
- gap: 1rem;
- flex: 1;
- }
- .logo-container {
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .water-logo {
- width: 60px;
- height: 60px;
- object-fit: contain;
- filter: brightness(0) invert(1);
- transition: transform 0.3s ease;
- }
- .water-logo:hover {
- transform: scale(1.1);
- }
- .title-container {
- display: flex;
- flex-direction: column;
- gap: -0.8rem;
- }
- .site-title {
- font-size: 2rem;
- font-weight: 700;
- margin: 0;
- background: linear-gradient(45deg, #fff, #f0f0f0);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- background-clip: text;
- letter-spacing: 0.1rem;
- line-height: 1.3;
- }
- .site-subtitle {
- font-size: 0.875rem;
- font-weight: 400;
- opacity: 0.9;
- margin: 0;
- /* margin-top: -0.8rem; */
- letter-spacing: 0.05rem;
- line-height: 1.5;
- }
- .nav-menu {
- display: flex;
- gap: 2.5rem;
- justify-content: center;
- flex: 2;
- }
- .nav-item {
- color: white;
- text-decoration: none;
- font-size: 1rem;
- font-weight: 400;
- padding: 0.5rem 1rem;
- border-radius: 4px;
- transition: all 0.3s ease;
- opacity: 0.9;
- line-height: 1.6;
- }
- .nav-item:hover {
- opacity: 1;
- transform: translateY(-2px);
- text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
- }
- .nav-item.active {
- opacity: 1;
- background: rgba(255, 255, 255, 0.2);
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
- }
- .header-right {
- display: flex;
- flex-direction: column;
- align-items: flex-end;
- gap: 1.5rem;
- flex: 1;
- }
- .current-time {
- font-size: 0.875rem;
- font-weight: 400;
- opacity: 0.9;
- font-family: 'Courier New', monospace;
- background: rgba(0, 0, 0, 0.1);
- padding: 0.3rem 0.8rem;
- border-radius: 4px;
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
- line-height: 1.5;
- }
- </style>
|