diff --git a/backend/src/main/java/com/banben/modules/resource/entity/VersionResource.java b/backend/src/main/java/com/banben/modules/resource/entity/VersionResource.java index 62fad6b..b5cc193 100644 --- a/backend/src/main/java/com/banben/modules/resource/entity/VersionResource.java +++ b/backend/src/main/java/com/banben/modules/resource/entity/VersionResource.java @@ -66,7 +66,8 @@ public class VersionResource implements Serializable { @Schema(description = "所属任务年份(必备)") private String taskYear; - @Schema(description = "来源馆(必备)") + @TableField("source_library") + @Schema(description = "来源馆(必备),对应 version_resource.source_library") private String sourceLibrary; @Schema(description = "来源馆地址(必备,IP:端口或域名)") diff --git a/backend/src/main/java/com/banben/modules/special/dto/SpecialRecommendVO.java b/backend/src/main/java/com/banben/modules/special/dto/SpecialRecommendVO.java index 6d85d30..1a39872 100644 --- a/backend/src/main/java/com/banben/modules/special/dto/SpecialRecommendVO.java +++ b/backend/src/main/java/com/banben/modules/special/dto/SpecialRecommendVO.java @@ -44,6 +44,9 @@ public class SpecialRecommendVO implements Serializable { @Schema(description = "下载/电子版地址(special_resource.ebook_url,version_resource 场景取全文地址)") private String ebookUrl; + @Schema(description = "来源馆(version_resource.source_library)") + private String sourceLibrary; + @Schema(description = "数据来源:VERSION=version_resource特藏标记 / MANUAL=special_resource手工维护") private String source; } diff --git a/backend/src/main/java/com/banben/modules/special/entity/SpecialResource.java b/backend/src/main/java/com/banben/modules/special/entity/SpecialResource.java index a8c823c..32db132 100644 --- a/backend/src/main/java/com/banben/modules/special/entity/SpecialResource.java +++ b/backend/src/main/java/com/banben/modules/special/entity/SpecialResource.java @@ -40,6 +40,10 @@ public class SpecialResource implements Serializable { @Schema(description = "电子版下载地址") private String ebookUrl; + @TableField("source_library") + @Schema(description = "来源馆,对应 special_resource.source_library") + private String sourceLibrary; + @Schema(description = "排序号") private Integer sortNo; diff --git a/backend/src/main/java/com/banben/modules/special/service/impl/SpecialServiceImpl.java b/backend/src/main/java/com/banben/modules/special/service/impl/SpecialServiceImpl.java index f1b8998..cc5b874 100644 --- a/backend/src/main/java/com/banben/modules/special/service/impl/SpecialServiceImpl.java +++ b/backend/src/main/java/com/banben/modules/special/service/impl/SpecialServiceImpl.java @@ -129,6 +129,7 @@ public class SpecialServiceImpl extends ServiceImpl -import { onBeforeUnmount, onMounted, ref } from 'vue' +import { computed, onBeforeUnmount, onMounted, ref } from 'vue' import { useRouter } from 'vue-router' +import { getOverview, type AnalysisOverview } from '@/api/analysis' import { getRecommend, type SpecialRecommendItem } from '@/api/special' -import b1 from '@/assets/banner/b1.jpg' -import b2 from '@/assets/banner/b2.jpg' -import b3 from '@/assets/banner/b3.jpg' +import b1 from '@/assets/banner/army1.jpg' +import b2 from '@/assets/banner/army2.jpg' +import b3 from '@/assets/banner/army3.jpg' const router = useRouter() const keyword = ref('') @@ -14,18 +15,38 @@ const types = ref([]) const typeOpts = ['纸质图书', '电子图书', '中文文献', '外文文献'] const slides = [ - { img: b1, kicker: '馆藏资源', title: '典藏中华版本,赓续中华文脉' }, - { img: b2, kicker: '统一检索', title: '纸电一体,一站式发现' }, - { img: b3, kicker: '联合服务', title: '多馆协同,资源互联互通' } + { 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 overview = ref(null) + +function mediaCount(keyword: string) { + const item = overview.value?.mediaRatio?.find((m) => (m.name || '').includes(keyword)) + return item?.value ?? 0 +} + +function formatCount(n: number | undefined | null) { + if (!overview.value) return '—' + return Number(n || 0).toLocaleString('zh-CN') +} + +const statItems = computed(() => [ + { label: '资源总量', value: formatCount(overview.value?.totalCount) }, + { label: '纸质资源', value: formatCount(mediaCount('纸')) }, + { label: '电子资源', value: formatCount(mediaCount('电')) }, + { label: '今日检索', value: formatCount(overview.value?.todaySearchCount) }, + { label: '当前在线', value: formatCount(overview.value?.onlineCount) } +]) + +async function fetchOverview() { + try { + overview.value = await getOverview() + } catch { + overview.value = null + } +} /* ---------- 3D 书架:一本书对应一条特藏,点击进入特藏详情 ---------- */ const bookColors = ['#2c4d40', '#7a2e2e', '#2b3a67', '#8a6420', '#5a2e42'] @@ -40,6 +61,10 @@ function titleOf(it: SpecialRecommendItem) { return it.title || it.name || '' } +function sourceOf(it: SpecialRecommendItem) { + return (it.sourceLibrary || '').trim() +} + /* 拉取特藏列表,为每本书随机分配姿态与呼吸延迟,使节奏互不同步 */ async function fetchSpecials() { try { @@ -60,13 +85,16 @@ function openSpecial(it: SpecialRecommendItem) { router.push({ path: '/special', query: { id: String(it.id ?? '') } }) } -const hoverIndex = ref(-1) +const hoverKey = ref('') +const shelfPaused = ref(false) -/* X 轴推挤:悬停某本书时,左侧书本左推、右侧书本右推 */ -function wrapperStyle(i: number) { - if (hoverIndex.value < 0) return {} - if (i < hoverIndex.value) return { transform: 'translateX(-40px)' } - if (i > hoverIndex.value) return { transform: 'translateX(40px)' } +/* X 轴推挤:悬停某本书时,同一排左侧书本左推、右侧书本右推 */ +function wrapperStyle(copy: number, i: number) { + const prefix = `${copy}-` + if (!hoverKey.value.startsWith(prefix)) return {} + const hi = Number(hoverKey.value.slice(prefix.length)) + if (i < hi) return { transform: 'translateX(-40px)' } + if (i > hi) return { transform: 'translateX(40px)' } return { transform: 'translateX(0px)' } } @@ -126,6 +154,7 @@ function doSearch() { onMounted(() => { reset() fetchSpecials() + fetchOverview() }) onBeforeUnmount(pause) @@ -154,12 +183,13 @@ onBeforeUnmount(pause)
@@ -190,15 +220,27 @@ onBeforeUnmount(pause)
- -
+ +
+
+
@@ -211,13 +253,22 @@ onBeforeUnmount(pause) }" > -
- {{ titleOf(e) }} +
+
+ {{ titleOf(e) }} + {{ sourceOf(e) }} +
+
+

暂无特藏推荐,可在资源管理中将版本资源标记为特藏

@@ -365,15 +416,22 @@ onBeforeUnmount(pause) border-bottom: 1px solid rgba(255, 255, 255, 0.12); } -/* 纯展示,不可点击,因此不做高亮与悬停态 */ .side-item { - display: block; - padding: 14px 20px; + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + padding: 12px 18px; font-size: 14px; letter-spacing: 0.5px; color: rgba(255, 255, 255, 0.68); - cursor: default; - pointer-events: none; + + strong { + font-size: 16px; + font-weight: 600; + letter-spacing: 0; + color: #fff; + } } .panel-main { @@ -483,17 +541,40 @@ onBeforeUnmount(pause) color: rgba(255, 255, 255, 0.45); } -/* ---------- 快捷入口:3D 悬浮书架 ---------- */ +/* ---------- 快捷入口:3D 悬浮书架,横向循环滚动 ---------- */ .shelf { + margin-top: 30px; + overflow: hidden; + mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); +} + +.shelf-track { + display: flex; + width: max-content; + animation: shelfMarquee 36s linear infinite; + + &.paused { + animation-play-state: paused; + } +} + +.shelf-group { display: flex; - justify-content: center; align-items: flex-end; gap: 18px; - margin-top: 30px; - padding: 30px 16px 0; + padding: 36px 9px 0; perspective: 1200px; } +@keyframes shelfMarquee { + from { + transform: translateX(0); + } + to { + transform: translateX(-50%); + } +} + /* 外层:仅负责悬停时的 X 轴推挤位移 */ .book-wrapper { flex: none; @@ -564,22 +645,30 @@ onBeforeUnmount(pause) box-shadow: 0 34px 64px rgba(0, 0, 0, 0.6); } -/* 竖排烫金书名(楷体 + 锐利金属倒角),过长自动截断 */ -.book-title { +/* 书脊文字:书名竖排在上,来源在书名下侧横向居中 */ +.book-copy { position: absolute; - inset: 0; + inset: 10px 4px; display: flex; + flex-direction: column; align-items: center; justify-content: center; + gap: 6px; + min-height: 0; +} + +.book-title { + flex: 0 1 auto; + max-height: 100%; + min-height: 0; + overflow: hidden; /* vertical-lr:每列自上而下,多列时从左往右排(rl 会把开头那列放到最右,看着像反了) */ writing-mode: vertical-lr; font-family: 'Kaiti SC', 'STKaiti', 'KaiTi', '楷体', serif; font-size: 15px; + line-height: 1.15; letter-spacing: 5px; color: var(--brand-gold); - overflow: hidden; - text-overflow: ellipsis; - padding: 10px 0; text-shadow: -0.5px -0.5px 0px rgba(255, 255, 255, 0.8), 1px 1px 0px #704e10, @@ -587,6 +676,28 @@ onBeforeUnmount(pause) 2px 2px 3px rgba(0, 0, 0, 0.9); } +.has-source .book-title { + max-height: 62%; +} + +.book-source { + flex: 0 0 auto; + width: 100%; + writing-mode: horizontal-tb; + text-align: center; + font-size: 10px; + line-height: 1.25; + letter-spacing: 0; + color: rgba(255, 248, 220, 0.9); + border-top: 1px solid rgba(232, 201, 122, 0.55); + padding-top: 4px; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + word-break: break-all; +} + .shelf-empty { margin: 30px 0 0; text-align: center; @@ -713,6 +824,7 @@ onBeforeUnmount(pause) /* ---------- 响应式 ---------- */ @media (prefers-reduced-motion: reduce) { + .shelf-track, .book-inner, .book-shadow::before, .hero-text h1, @@ -724,9 +836,8 @@ onBeforeUnmount(pause) } @media (max-width: 1080px) { - .shelf { - flex-wrap: wrap; - row-gap: 22px; + .shelf-track { + animation-duration: 28s; } } @@ -744,7 +855,7 @@ onBeforeUnmount(pause) display: none; } - .shelf { + .shelf-group { gap: 12px; } @@ -758,7 +869,11 @@ onBeforeUnmount(pause) .book-title { font-size: 13px; - letter-spacing: 5px; + letter-spacing: 3px; + } + + .book-source { + font-size: 9px; } } diff --git a/frontend/src/views/Login.vue b/frontend/src/views/Login.vue index 507cc48..b91b1bf 100644 --- a/frontend/src/views/Login.vue +++ b/frontend/src/views/Login.vue @@ -103,7 +103,7 @@ async function handleLogin() { color: var(--text-on-dark); background: linear-gradient(180deg, rgba(16, 38, 28, 0.2) 0%, rgba(16, 38, 28, 0.72) 100%), - url('../assets/banner/b2.jpg') center 30% / cover no-repeat; + url('../assets/banner/army2.jpg') center 30% / cover no-repeat; &::after { content: '';