项目框架
This commit is contained in:
@@ -0,0 +1,145 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { clearAuth, getUser } from '@/utils/auth'
|
||||
import logoUrl from '@/assets/logo.png'
|
||||
import noticeUrl from '@/assets/icon-notice.png'
|
||||
import settingUrl from '@/assets/icon-setting.png'
|
||||
import avatarUrl from '@/assets/avatar.png'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const user = computed(() => getUser())
|
||||
|
||||
const menus = [
|
||||
{ path: '/dashboard', title: '首页' },
|
||||
{ path: '/search', title: '版本资源检索' },
|
||||
{ path: '/special', title: '特藏版本推荐' },
|
||||
{ path: '/deposit', title: '版本资源呈缴' },
|
||||
{ path: '/analysis', title: '数据统计' },
|
||||
{ path: '/resource', title: '资源管理' },
|
||||
{ path: '/collect', title: '数据采集' },
|
||||
{ path: '/governance', title: '数据治理' }
|
||||
]
|
||||
|
||||
function logout() {
|
||||
clearAuth()
|
||||
router.push('/login')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="site">
|
||||
<header class="site-header">
|
||||
<div class="logo" @click="router.push('/')">
|
||||
<img class="logo-img" :src="logoUrl" alt="logo" />
|
||||
<span class="logo-text">版本资源联合服务平台</span>
|
||||
</div>
|
||||
<nav class="nav">
|
||||
<a
|
||||
v-for="m in menus"
|
||||
:key="m.path"
|
||||
:class="{ active: route.path === m.path }"
|
||||
@click="router.push(m.path)"
|
||||
>
|
||||
{{ m.title }}
|
||||
</a>
|
||||
</nav>
|
||||
<div class="right">
|
||||
<img class="hicon" :src="noticeUrl" alt="notice" />
|
||||
<img class="hicon" :src="settingUrl" alt="setting" />
|
||||
<img class="avatar" :src="avatarUrl" alt="avatar" />
|
||||
<span class="user">{{ user?.realName || 'admin' }}</span>
|
||||
<a class="quit" @click="logout">退出登录</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="site-main">
|
||||
<router-view />
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.site {
|
||||
min-height: 100vh;
|
||||
background: var(--page-bg);
|
||||
}
|
||||
|
||||
.site-header {
|
||||
height: 64px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 32px;
|
||||
padding: 0 24px;
|
||||
background: var(--header-bg) var(--nav-bg-img) center / cover no-repeat;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.logo-img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.hicon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
cursor: pointer;
|
||||
filter: brightness(0) invert(1);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.logo-text {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.nav {
|
||||
display: flex;
|
||||
gap: 28px;
|
||||
flex: 1;
|
||||
justify-content: center;
|
||||
|
||||
a {
|
||||
color: rgba(255, 255, 255, 0.82);
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
|
||||
&.active,
|
||||
&:hover {
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.quit {
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.site-main {
|
||||
padding: 20px 24px 40px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user