style(页面布局): 调整多个页面的顶部间距和导航栏样式

- 为Home和AlbumDetail页面添加统一的顶部间距
- 修改App.vue导航栏为绝对定位并增加z-index
- 在Playroom页面实现控制器元素的粘性定位并动态计算位置
This commit is contained in:
Astrian Zheng 2025-05-26 17:00:24 +10:00
parent 2ce63f5daa
commit 3a5377595b
Signed by: Astrian
SSH Key Fingerprint: SHA256:rVnhx3DAKjujCwWE13aDl7uV6+9U1MvydLkNRXJrBiA
4 changed files with 13 additions and 5 deletions

View File

@ -12,7 +12,7 @@ const route = useRoute()
<template>
<div class="w-screen h-screen overflow-hidden bg-[#191919]">
<div class="flex flex-col w-full h-full overflow-y-auto pb-24">
<div class="py-8 px-4 md:px-8 sticky top-0 bg-gradient-to-b from-[#00000080] to-transparent z-10">
<div class="py-8 px-4 md:px-8 w-screen bg-gradient-to-b from-[#00000080] to-transparent z-20 absolute top-0">
<div class="flex justify-between align-center h-[2.625rem] items-center">
<ul class="flex gap-4" v-if="(() => {
if (route.path === '/lucky' || route.path === '/library' || route.path === '/') { return true }

View File

@ -52,7 +52,7 @@ function playTheAlbum(from: number = 0) {
</script>
<template>
<div class="px-4 md:px-8 flex gap-8 flex-col md:flex-row select-none">
<div class="px-4 md:px-8 flex gap-8 flex-col md:flex-row select-none mt-[6.625rem]">
<div class="mx-auto md:mx-0 md:w-72">
<div class="md:sticky md:top-[6.625rem] flex flex-col gap-8">
<div

View File

@ -11,7 +11,7 @@ onMounted(async () => {
</script>
<template>
<div class="text-white flex flex-col gap-8">
<div class="text-white flex flex-col gap-8 mt-[6.625rem]">
<div class="grid xl:grid-cols-6 grid-cols-3 lg:grid-cols-4">
<div v-for="album in albums" :key="album.cid">
<RouterLink :to="`/albums/${album.cid}`">

View File

@ -31,6 +31,7 @@ const progressBarThumb = useTemplateRef('progressBarThumb')
const progressBarContainer = useTemplateRef('progressBarContainer')
const playQueueDialogContainer = useTemplateRef('playQueueDialogContainer')
const playQueueDialog = useTemplateRef('playQueueDialog')
const controllerRef = useTemplateRef('controllerRef')
const presentQueueListDialog = ref(false)
@ -144,6 +145,10 @@ function getCurrentTrack() {
return playQueueStore.list[playQueueStore.currentIndex]
}
}
function calculateStickyTop() {
return (window.innerHeight - (controllerRef.value?.clientHeight ?? 0)) / 2
}
</script>
<template>
@ -152,8 +157,10 @@ function getCurrentTrack() {
<div class="bg-transparent w-full h-full absolute top-0 left-0" />
</div>
<div class="w-full flex justify-center items-center my-auto gap-16 z-10 select-none">
<div class="flex flex-col w-96 gap-4">
<div class="absolute top-0 left-0 flex justify-center items-center h-screen w-screen overflow-y-auto gap-16 z-10 select-none">
<div class="flex flex-col w-96 gap-4 sticky" :style="{
top: `${calculateStickyTop()}px`
}" ref="controllerRef">
<img :src="getCurrentTrack().album?.coverUrl" class="rounded-2xl shadow-2xl border border-white/20 w-96 h-96" />
<div class="flex justify-between items-center gap-2">
<div class="relative flex-auto w-0">
@ -325,6 +332,7 @@ function getCurrentTrack() {
</div>
</div>
</div>
</div>
<!-- Queue list -->