Files
banben/frontend/src/layouts/BasicLayout.vue
T
SUNJIAJINGS 46be7346a2 feat: 新增后台管理入口与资源新增功能
- 首页齿轮按钮以新标签页打开后台管理,新增 Admin 路由与视图
- 资源列表支持新增版本资源,复用编辑抽屉
- 主页检索按字段映射到检索页途径(题名/关键词/责任者/出版社/综合)
- 检索支持多词分词 OR 匹配,并过滤已屏蔽/下架记录
- 聚同算法改为 ISBN 优先、无 ISBN 时四要素判定,并前后端统一抽取分组逻辑
- 数据库主键改为自增序列,新增敏感词库与院校资源节点表,补充特藏与管理状态字段及样例数据序列同步
2026-10-21 16:25:28 +08:00

301 lines
6.2 KiB
Vue

<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-green.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: '/hotwords', 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')
}
/** 齿轮按钮:新标签页打开后台管理 */
function openAdmin() {
window.open(router.resolve('/admin').href, '_blank')
}
</script>
<template>
<div class="site" :class="{ 'on-hero': route.path === '/dashboard' }">
<header class="site-header">
<div class="logo" @click="router.push('/')">
<img class="logo-img" :src="logoUrl" alt="logo" />
<div class="logo-texts">
<span class="logo-text">版本资源联合服务平台</span>
<span class="logo-sub">VERSION RESOURCE UNION SERVICE</span>
</div>
</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" title="后台管理" @click="openAdmin" />
<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 {
position: relative;
z-index: 0;
min-height: 100vh;
background: var(--page-bg);
/* 导航背后垫一层与首页同源的实景图:
内页时它充当导航的背景,首页时则被上浮的轮播图盖住,
两种场景下导航都是「半透明绿压在实景图上」,观感完全一致 */
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 72px;
background:
linear-gradient(rgba(10, 28, 20, 0.5), rgba(10, 28, 20, 0.62)),
url('../assets/banner/b2.jpg') center 18% / cover no-repeat;
z-index: -1;
}
/* 首页:轮播图上浮到导航之下,导航直接压在实景图上 */
&.on-hero .site-main {
margin-top: -72px;
}
}
.site-header {
height: 72px;
display: flex;
align-items: center;
gap: 36px;
padding: 0 36px;
/* 与首页检索面板完全一致的半透明绿 + 同款毛玻璃 */
background: rgba(16, 38, 28, 0.58);
backdrop-filter: blur(22px) saturate(140%);
-webkit-backdrop-filter: blur(22px) saturate(140%);
color: #fff;
position: relative;
z-index: 20;
transition: background 0.45s ease;
/* 底部金线:呼应版本馆的描金装饰 */
&::after {
content: '';
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 2px;
background: linear-gradient(90deg, transparent, var(--brand-gold), transparent);
opacity: 0.6;
}
}
.logo {
display: flex;
align-items: center;
gap: 12px;
flex: none;
padding-right: 34px;
cursor: pointer;
position: relative;
&::after {
content: '';
position: absolute;
right: 0;
top: 50%;
width: 1px;
height: 30px;
transform: translateY(-50%);
background: rgba(210, 229, 214, 0.35);
}
}
.logo-img {
width: 36px;
height: 36px;
}
.logo-texts {
display: flex;
flex-direction: column;
gap: 4px;
}
.logo-text {
font-family: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'STSong',
'SimSun', serif;
font-size: 19px;
font-weight: 700;
letter-spacing: 2px;
line-height: 1;
color: #eef6f0;
}
.logo-sub {
font-size: 9px;
line-height: 1;
letter-spacing: 1px;
color: rgba(210, 229, 214, 0.72);
}
.nav {
display: flex;
flex: 1;
justify-content: center;
gap: 2px;
height: 100%;
a {
position: relative;
display: flex;
align-items: center;
height: 100%;
padding: 0 11px;
color: rgba(255, 255, 255, 0.78);
font-size: 14px;
letter-spacing: 0.5px;
white-space: nowrap;
flex: none;
cursor: pointer;
transition: color 0.2s;
&::after {
content: '';
position: absolute;
left: 11px;
right: 11px;
bottom: 0;
height: 2px;
background: var(--brand-gold);
transform: scaleX(0);
transition: transform 0.22s;
}
&.active,
&:hover {
color: #fff;
&::after {
transform: scaleX(1);
}
}
}
}
.right {
display: flex;
align-items: center;
gap: 14px;
flex: none;
padding-left: 26px;
font-size: 13px;
color: rgba(255, 255, 255, 0.85);
position: relative;
&::before {
content: '';
position: absolute;
left: 0;
top: 50%;
width: 1px;
height: 30px;
transform: translateY(-50%);
background: rgba(210, 229, 214, 0.3);
}
}
.hicon {
width: 19px;
height: 19px;
cursor: pointer;
opacity: 0.8;
filter: brightness(0) invert(1);
transition: opacity 0.2s;
&:hover {
opacity: 1;
}
}
.avatar {
width: 30px;
height: 30px;
border-radius: 50%;
border: 1px solid rgba(210, 229, 214, 0.5);
}
.user {
color: #eef6f0;
}
.quit {
color: rgba(255, 255, 255, 0.7);
cursor: pointer;
&:hover {
color: var(--brand-gold-light);
}
}
.site-main {
padding: 20px 24px 40px;
}
/* 窄屏收敛:隐藏英文副标题与用户名,保证导航不折行 */
@media (max-width: 1320px) {
.site-header {
gap: 20px;
padding: 0 24px;
}
.logo {
padding-right: 22px;
}
.logo-sub {
display: none;
}
.user {
display: none;
}
}
</style>