545 lines
11 KiB
Vue
545 lines
11 KiB
Vue
<script setup lang="ts">
|
||
import { onBeforeUnmount, onMounted, ref } from 'vue'
|
||
import { useRouter } from 'vue-router'
|
||
import b1 from '@/assets/banner/b1.jpg'
|
||
import b2 from '@/assets/banner/b2.jpg'
|
||
import b3 from '@/assets/banner/b3.jpg'
|
||
|
||
const router = useRouter()
|
||
const keyword = ref('')
|
||
const field = ref('题名')
|
||
const fields = ['题名', '关键词', '作者', '出版机构']
|
||
const types = ref<string[]>([])
|
||
const typeOpts = ['纸质图书', '电子图书', '中文文献', '外文文献']
|
||
|
||
const slides = [
|
||
{ img: b1, kicker: '馆藏资源', title: '典藏中华版本,赓续中华文脉' },
|
||
{ img: b2, kicker: '统一检索', title: '纸电一体,一站式发现' },
|
||
{ img: b3, kicker: '联合服务', title: '多馆协同,资源互联互通' }
|
||
]
|
||
|
||
const sources = [
|
||
{ name: '馆藏资源检索', on: true },
|
||
{ name: '版本资源库', on: false },
|
||
{ name: '古籍善本', on: false },
|
||
{ name: '电子文献', on: false },
|
||
{ name: '特色专题库', on: false }
|
||
]
|
||
|
||
const entries = [
|
||
{ title: '资源检索', path: '/search', icon: 'Search' },
|
||
{ title: '热词检索', path: '/hotwords', icon: 'Cloudy' },
|
||
{ title: '特藏推荐', path: '/special', icon: 'Star' },
|
||
{ title: '资源呈缴', path: '/deposit', icon: 'Upload' },
|
||
{ title: '数据统计', path: '/analysis', icon: 'DataAnalysis' },
|
||
{ title: '资源管理', path: '/resource', icon: 'Collection' },
|
||
{ title: '数据采集', path: '/collect', icon: 'Download' },
|
||
{ title: '数据治理', path: '/governance', icon: 'MagicStick' }
|
||
]
|
||
|
||
const active = ref(0)
|
||
const tick = ref(0)
|
||
let timer: number | undefined
|
||
const DURATION = 6000
|
||
|
||
function reset() {
|
||
if (timer) window.clearTimeout(timer)
|
||
tick.value++
|
||
timer = window.setTimeout(() => go(active.value + 1), DURATION)
|
||
}
|
||
function go(i: number) {
|
||
active.value = (i + slides.length) % slides.length
|
||
reset()
|
||
}
|
||
function next() {
|
||
go(active.value + 1)
|
||
}
|
||
function prev() {
|
||
go(active.value - 1)
|
||
}
|
||
function pause() {
|
||
if (timer) window.clearTimeout(timer)
|
||
timer = undefined
|
||
}
|
||
function resume() {
|
||
reset()
|
||
}
|
||
|
||
function doSearch() {
|
||
router.push({ path: '/search', query: { keyword: keyword.value } })
|
||
}
|
||
|
||
onMounted(reset)
|
||
onBeforeUnmount(pause)
|
||
</script>
|
||
|
||
<template>
|
||
<div class="home" @mouseenter="pause" @mouseleave="resume">
|
||
<!-- 全屏背景轮播 -->
|
||
<div class="bg">
|
||
<div
|
||
v-for="(s, i) in slides"
|
||
:key="i"
|
||
class="bg-slide"
|
||
:class="{ on: i === active }"
|
||
:style="{ backgroundImage: `url(${s.img})` }"
|
||
/>
|
||
<div class="mask" />
|
||
</div>
|
||
|
||
<!-- 内容层 -->
|
||
<div class="stage">
|
||
<div class="hero-text">
|
||
<span class="kicker">{{ slides[active].kicker }}</span>
|
||
<h1>{{ slides[active].title }}</h1>
|
||
</div>
|
||
|
||
<div class="panel">
|
||
<aside class="panel-side">
|
||
<div class="side-head">
|
||
<el-icon :size="15"><Search /></el-icon>
|
||
<span>搜索馆藏资源</span>
|
||
</div>
|
||
<a v-for="s in sources" :key="s.name" class="side-item">
|
||
{{ s.name }}
|
||
</a>
|
||
</aside>
|
||
|
||
<section class="panel-main">
|
||
<div class="row1">
|
||
<el-select v-model="field" class="sel">
|
||
<el-option v-for="f in fields" :key="f" :label="f" :value="f" />
|
||
</el-select>
|
||
<input
|
||
v-model="keyword"
|
||
class="ipt"
|
||
placeholder="请输入检索词,支持表达式检索"
|
||
@keyup.enter="doSearch"
|
||
/>
|
||
<button class="btn primary" @click="doSearch">检 索</button>
|
||
<button class="btn ghost" @click="router.push('/advanced')">高级检索</button>
|
||
</div>
|
||
|
||
<div class="types">
|
||
<span class="lbl">前置筛选:</span>
|
||
<label v-for="t in typeOpts" :key="t">
|
||
<input type="checkbox" :value="t" v-model="types" />{{ t }}
|
||
</label>
|
||
</div>
|
||
|
||
<p class="hint">
|
||
覆盖本馆订购与自建的多类型版本资源,支持纸电一体检索与全文获取。
|
||
</p>
|
||
</section>
|
||
</div>
|
||
|
||
<!-- 快捷入口 -->
|
||
<div class="quick">
|
||
<div
|
||
v-for="e in entries"
|
||
:key="e.path"
|
||
class="quick-item"
|
||
@click="router.push(e.path)"
|
||
>
|
||
<el-icon :size="26"><component :is="e.icon" /></el-icon>
|
||
<span>{{ e.title }}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 轮播控制 -->
|
||
<div class="ctrl">
|
||
<button class="arrow" @click="prev">‹</button>
|
||
<div class="dots">
|
||
<span
|
||
v-for="(s, i) in slides"
|
||
:key="i"
|
||
:class="{ on: i === active }"
|
||
@click="go(i)"
|
||
/>
|
||
</div>
|
||
<button class="arrow" @click="next">›</button>
|
||
</div>
|
||
|
||
<div :key="tick" class="progress"><span /></div>
|
||
</div>
|
||
</template>
|
||
|
||
<style scoped lang="scss">
|
||
.home {
|
||
position: relative;
|
||
min-height: calc(100vh - 72px);
|
||
margin: -20px -24px;
|
||
overflow: hidden;
|
||
background: #16301f;
|
||
}
|
||
|
||
/* ---------- 背景轮播 ---------- */
|
||
.bg {
|
||
position: absolute;
|
||
inset: 0;
|
||
}
|
||
|
||
.bg-slide {
|
||
position: absolute;
|
||
inset: 0;
|
||
background-position: center;
|
||
background-size: cover;
|
||
opacity: 0;
|
||
transform: scale(1.07);
|
||
transition:
|
||
opacity 1.1s cubic-bezier(0.4, 0, 0.2, 1),
|
||
transform 8s cubic-bezier(0.22, 0.61, 0.36, 1);
|
||
will-change: opacity, transform;
|
||
|
||
&.on {
|
||
opacity: 1;
|
||
transform: scale(1);
|
||
}
|
||
}
|
||
|
||
.mask {
|
||
position: absolute;
|
||
inset: 0;
|
||
background: linear-gradient(
|
||
180deg,
|
||
rgba(10, 28, 20, 0.62) 0%,
|
||
rgba(10, 28, 20, 0.28) 38%,
|
||
rgba(8, 24, 17, 0.68) 100%
|
||
);
|
||
}
|
||
|
||
/* ---------- 内容层 ---------- */
|
||
.stage {
|
||
position: relative;
|
||
z-index: 2;
|
||
max-width: 1240px;
|
||
margin: 0 auto;
|
||
padding: 6vh 24px 108px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: center;
|
||
min-height: calc(100vh - 72px);
|
||
}
|
||
|
||
.hero-text {
|
||
margin-bottom: 34px;
|
||
color: #fff;
|
||
|
||
.kicker {
|
||
display: inline-block;
|
||
padding: 4px 12px;
|
||
margin-bottom: 14px;
|
||
font-size: 12px;
|
||
letter-spacing: 3px;
|
||
color: #dcece1;
|
||
border: 1px solid rgba(220, 236, 225, 0.45);
|
||
}
|
||
|
||
h1 {
|
||
margin: 0;
|
||
font-size: 46px;
|
||
font-weight: 700;
|
||
letter-spacing: 6px;
|
||
text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
|
||
animation: rise 0.9s both;
|
||
}
|
||
}
|
||
|
||
@keyframes rise {
|
||
from {
|
||
opacity: 0;
|
||
transform: translateY(14px);
|
||
}
|
||
to {
|
||
opacity: 1;
|
||
transform: translateY(0);
|
||
}
|
||
}
|
||
|
||
/* ---------- 半透明检索面板 ---------- */
|
||
.panel {
|
||
display: flex;
|
||
background: rgba(16, 38, 28, 0.58);
|
||
backdrop-filter: blur(22px) saturate(140%);
|
||
-webkit-backdrop-filter: blur(22px) saturate(140%);
|
||
border: 1px solid rgba(255, 255, 255, 0.16);
|
||
border-radius: var(--radius-sm);
|
||
overflow: hidden;
|
||
box-shadow: 0 18px 46px rgba(0, 0, 0, 0.3);
|
||
}
|
||
|
||
.panel-side {
|
||
width: 214px;
|
||
flex: none;
|
||
padding: 16px 0;
|
||
background: rgba(0, 0, 0, 0.16);
|
||
border-right: 1px solid rgba(255, 255, 255, 0.1);
|
||
}
|
||
|
||
.side-head {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 7px;
|
||
padding: 0 18px 14px;
|
||
margin-bottom: 6px;
|
||
font-size: 14px;
|
||
letter-spacing: 1px;
|
||
color: #fff;
|
||
border-bottom: 1px solid rgba(255, 255, 255, 0.12);
|
||
}
|
||
|
||
/* 纯展示,不可点击,因此不做高亮与悬停态 */
|
||
.side-item {
|
||
display: block;
|
||
padding: 14px 20px;
|
||
font-size: 14px;
|
||
letter-spacing: 0.5px;
|
||
color: rgba(255, 255, 255, 0.68);
|
||
cursor: default;
|
||
pointer-events: none;
|
||
}
|
||
|
||
.panel-main {
|
||
flex: 1;
|
||
min-width: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: center;
|
||
padding: 28px 30px;
|
||
}
|
||
|
||
.row1 {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
padding: 8px;
|
||
background: #fff;
|
||
border-radius: var(--radius-sm);
|
||
}
|
||
|
||
.sel {
|
||
width: 120px;
|
||
flex: none;
|
||
|
||
:deep(.el-input__wrapper) {
|
||
background: transparent;
|
||
box-shadow: none;
|
||
}
|
||
}
|
||
|
||
.ipt {
|
||
flex: 1;
|
||
min-width: 0;
|
||
height: 54px;
|
||
padding: 0 10px;
|
||
border: none;
|
||
outline: none;
|
||
font-size: 15px;
|
||
color: var(--text-main);
|
||
|
||
&::placeholder {
|
||
color: #a9b6ac;
|
||
}
|
||
}
|
||
|
||
.btn {
|
||
flex: none;
|
||
height: 54px;
|
||
padding: 0 32px;
|
||
border: none;
|
||
border-radius: var(--radius-sm);
|
||
font-size: 15px;
|
||
letter-spacing: 2px;
|
||
cursor: pointer;
|
||
transition: all 0.22s;
|
||
}
|
||
|
||
.btn.primary {
|
||
color: #fff;
|
||
background: linear-gradient(180deg, #6aa889, #4f8a6b);
|
||
|
||
&:hover {
|
||
background: linear-gradient(180deg, #78b697, #57956f);
|
||
}
|
||
}
|
||
|
||
.btn.ghost {
|
||
color: var(--brand-primary-deep);
|
||
background: #fff;
|
||
border: 1px solid #cfe0d5;
|
||
letter-spacing: 1px;
|
||
|
||
&:hover {
|
||
background: var(--brand-light);
|
||
border-color: var(--brand-primary);
|
||
}
|
||
}
|
||
|
||
.types {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 18px;
|
||
margin-top: 16px;
|
||
font-size: 13px;
|
||
color: rgba(255, 255, 255, 0.72);
|
||
|
||
.lbl {
|
||
color: rgba(255, 255, 255, 0.5);
|
||
}
|
||
|
||
label {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 5px;
|
||
cursor: pointer;
|
||
|
||
input {
|
||
accent-color: var(--brand-gold-light);
|
||
}
|
||
}
|
||
}
|
||
|
||
.hint {
|
||
margin: 12px 0 0;
|
||
font-size: 12px;
|
||
line-height: 1.7;
|
||
color: rgba(255, 255, 255, 0.45);
|
||
}
|
||
|
||
/* ---------- 快捷入口 ---------- */
|
||
.quick {
|
||
display: grid;
|
||
grid-template-columns: repeat(8, 1fr);
|
||
gap: 10px;
|
||
margin-top: 28px;
|
||
}
|
||
|
||
.quick-item {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
gap: 10px;
|
||
padding: 24px 8px;
|
||
color: #fff;
|
||
font-size: 13px;
|
||
letter-spacing: 0.5px;
|
||
background: rgba(255, 255, 255, 0.1);
|
||
border: 1px solid rgba(255, 255, 255, 0.16);
|
||
border-radius: var(--radius-sm);
|
||
backdrop-filter: blur(14px);
|
||
-webkit-backdrop-filter: blur(14px);
|
||
cursor: pointer;
|
||
transition: all 0.24s;
|
||
|
||
&:hover {
|
||
background: rgba(255, 255, 255, 0.22);
|
||
border-color: rgba(255, 255, 255, 0.36);
|
||
transform: translateY(-3px);
|
||
}
|
||
}
|
||
|
||
/* ---------- 轮播控制 ---------- */
|
||
.ctrl {
|
||
position: absolute;
|
||
left: 50%;
|
||
bottom: 26px;
|
||
z-index: 3;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 14px;
|
||
transform: translateX(-50%);
|
||
}
|
||
|
||
.arrow {
|
||
width: 30px;
|
||
height: 30px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 18px;
|
||
line-height: 1;
|
||
color: rgba(255, 255, 255, 0.8);
|
||
background: rgba(255, 255, 255, 0.1);
|
||
border: 1px solid rgba(255, 255, 255, 0.22);
|
||
border-radius: 50%;
|
||
cursor: pointer;
|
||
transition: all 0.24s;
|
||
|
||
&:hover {
|
||
color: #fff;
|
||
background: rgba(255, 255, 255, 0.22);
|
||
}
|
||
}
|
||
|
||
.dots {
|
||
display: flex;
|
||
gap: 8px;
|
||
|
||
span {
|
||
width: 22px;
|
||
height: 2px;
|
||
background: rgba(255, 255, 255, 0.35);
|
||
cursor: pointer;
|
||
transition: all 0.3s;
|
||
|
||
&.on {
|
||
width: 40px;
|
||
background: var(--brand-gold-light);
|
||
}
|
||
}
|
||
}
|
||
|
||
.progress {
|
||
position: absolute;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
z-index: 3;
|
||
height: 2px;
|
||
background: rgba(255, 255, 255, 0.1);
|
||
|
||
span {
|
||
display: block;
|
||
height: 100%;
|
||
background: linear-gradient(90deg, var(--brand-primary), var(--brand-gold-light));
|
||
animation: grow 6s linear forwards;
|
||
}
|
||
}
|
||
|
||
@keyframes grow {
|
||
from {
|
||
width: 0;
|
||
}
|
||
to {
|
||
width: 100%;
|
||
}
|
||
}
|
||
|
||
/* ---------- 响应式 ---------- */
|
||
@media (max-width: 1080px) {
|
||
.quick {
|
||
grid-template-columns: repeat(4, 1fr);
|
||
}
|
||
}
|
||
|
||
@media (max-width: 760px) {
|
||
.hero-text h1 {
|
||
font-size: 24px;
|
||
letter-spacing: 2px;
|
||
}
|
||
|
||
.panel {
|
||
flex-direction: column;
|
||
}
|
||
|
||
.panel-side {
|
||
display: none;
|
||
}
|
||
|
||
.quick {
|
||
grid-template-columns: repeat(3, 1fr);
|
||
}
|
||
}
|
||
</style>
|