mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-05-18 19:47:29 +08:00
✨ feat: 优化页面样式
This commit is contained in:
+1
-1
@@ -62,7 +62,7 @@
|
|||||||
"howler": "^2.2.4",
|
"howler": "^2.2.4",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"marked": "^15.0.4",
|
"marked": "^15.0.4",
|
||||||
"naive-ui": "^2.39.0",
|
"naive-ui": "^2.41.0",
|
||||||
"postcss": "^8.4.49",
|
"postcss": "^8.4.49",
|
||||||
"prettier": "^3.3.2",
|
"prettier": "^3.3.2",
|
||||||
"remixicon": "^4.2.0",
|
"remixicon": "^4.2.0",
|
||||||
|
|||||||
@@ -5,3 +5,7 @@ body {
|
|||||||
.n-popover:has(.music-play) {
|
.n-popover:has(.music-play) {
|
||||||
border-radius: 1.5rem !important;
|
border-radius: 1.5rem !important;
|
||||||
}
|
}
|
||||||
|
.n-popover {
|
||||||
|
border-radius: 0.5rem !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
}
|
||||||
|
|||||||
Vendored
+1
@@ -28,6 +28,7 @@ declare module 'vue' {
|
|||||||
NInput: typeof import('naive-ui')['NInput']
|
NInput: typeof import('naive-ui')['NInput']
|
||||||
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
||||||
NLayout: typeof import('naive-ui')['NLayout']
|
NLayout: typeof import('naive-ui')['NLayout']
|
||||||
|
NMarquee: typeof import('naive-ui')['NMarquee']
|
||||||
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
||||||
NModal: typeof import('naive-ui')['NModal']
|
NModal: typeof import('naive-ui')['NModal']
|
||||||
NPagination: typeof import('naive-ui')['NPagination']
|
NPagination: typeof import('naive-ui')['NPagination']
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-drawer
|
<n-drawer
|
||||||
:show="musicFull"
|
v-model:show="isVisible"
|
||||||
height="100%"
|
height="100%"
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
:style="{ background: currentBackground || background }"
|
:style="{ background: currentBackground || background }"
|
||||||
@@ -22,6 +22,14 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="music-content-name">{{ playMusic.name }}</div>
|
<div class="music-content-name">{{ playMusic.name }}</div>
|
||||||
<div class="music-content-singer">
|
<div class="music-content-singer">
|
||||||
|
<n-ellipsis
|
||||||
|
class="text-ellipsis"
|
||||||
|
line-clamp="2"
|
||||||
|
:tooltip="{
|
||||||
|
contentStyle: { maxWidth: '600px' },
|
||||||
|
zIndex: 99999
|
||||||
|
}"
|
||||||
|
>
|
||||||
<span
|
<span
|
||||||
v-for="(item, index) in playMusic.ar || playMusic.song.artists"
|
v-for="(item, index) in playMusic.ar || playMusic.song.artists"
|
||||||
:key="index"
|
:key="index"
|
||||||
@@ -31,6 +39,7 @@
|
|||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
{{ index < (playMusic.ar || playMusic.song.artists).length - 1 ? ' / ' : '' }}
|
{{ index < (playMusic.ar || playMusic.song.artists).length - 1 ? ' / ' : '' }}
|
||||||
</span>
|
</span>
|
||||||
|
</n-ellipsis>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -74,7 +83,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useDebounceFn } from '@vueuse/core';
|
import { useDebounceFn } from '@vueuse/core';
|
||||||
import { onBeforeUnmount, ref, watch } from 'vue';
|
import { computed, onBeforeUnmount, ref, watch } from 'vue';
|
||||||
import { useStore } from 'vuex';
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -97,7 +106,7 @@ const animationFrame = ref<number | null>(null);
|
|||||||
const isDark = ref(false);
|
const isDark = ref(false);
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
musicFull: {
|
modelValue: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
@@ -107,10 +116,17 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
|
const isVisible = computed({
|
||||||
|
get: () => props.modelValue,
|
||||||
|
set: (value) => emit('update:modelValue', value)
|
||||||
|
});
|
||||||
|
|
||||||
// 歌词滚动方法
|
// 歌词滚动方法
|
||||||
const lrcScroll = (behavior = 'smooth') => {
|
const lrcScroll = (behavior = 'smooth') => {
|
||||||
const nowEl = document.querySelector(`#music-lrc-text-${nowIndex.value}`);
|
const nowEl = document.querySelector(`#music-lrc-text-${nowIndex.value}`);
|
||||||
if (props.musicFull && !isMouse.value && nowEl && lrcContainer.value) {
|
if (isVisible.value && !isMouse.value && nowEl && lrcContainer.value) {
|
||||||
const containerRect = lrcContainer.value.getBoundingClientRect();
|
const containerRect = lrcContainer.value.getBoundingClientRect();
|
||||||
const nowElRect = nowEl.getBoundingClientRect();
|
const nowElRect = nowEl.getBoundingClientRect();
|
||||||
const relativeTop = nowElRect.top - containerRect.top;
|
const relativeTop = nowElRect.top - containerRect.top;
|
||||||
@@ -142,9 +158,9 @@ watch(nowIndex, () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.musicFull,
|
() => isVisible.value,
|
||||||
() => {
|
() => {
|
||||||
if (props.musicFull) {
|
if (isVisible.value) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
lrcScroll('instant');
|
lrcScroll('instant');
|
||||||
});
|
});
|
||||||
@@ -227,7 +243,7 @@ onBeforeUnmount(() => {
|
|||||||
|
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const handleArtistClick = (id: number) => {
|
const handleArtistClick = (id: number) => {
|
||||||
props.musicFull = false;
|
isVisible.value = false;
|
||||||
store.commit('setCurrentArtistId', id);
|
store.commit('setCurrentArtistId', id);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -275,7 +291,7 @@ defineExpose({
|
|||||||
@apply flex flex-col justify-center items-center relative;
|
@apply flex flex-col justify-center items-center relative;
|
||||||
|
|
||||||
&-name {
|
&-name {
|
||||||
@apply font-bold text-xl pb-1 pt-4;
|
@apply font-bold text-2xl pb-1 pt-4;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-singer {
|
&-singer {
|
||||||
|
|||||||
@@ -51,7 +51,14 @@
|
|||||||
</n-ellipsis>
|
</n-ellipsis>
|
||||||
</div>
|
</div>
|
||||||
<div class="music-content-name">
|
<div class="music-content-name">
|
||||||
<n-ellipsis class="text-ellipsis" line-clamp="1">
|
<n-ellipsis
|
||||||
|
class="text-ellipsis"
|
||||||
|
line-clamp="1"
|
||||||
|
:tooltip="{
|
||||||
|
contentStyle: { maxWidth: '600px' },
|
||||||
|
zIndex: 99999
|
||||||
|
}"
|
||||||
|
>
|
||||||
<span
|
<span
|
||||||
v-for="(artists, artistsindex) in playMusic.ar || playMusic.song.artists"
|
v-for="(artists, artistsindex) in playMusic.ar || playMusic.song.artists"
|
||||||
:key="artistsindex"
|
:key="artistsindex"
|
||||||
@@ -141,7 +148,7 @@
|
|||||||
</n-popover>
|
</n-popover>
|
||||||
</div>
|
</div>
|
||||||
<!-- 播放音乐 -->
|
<!-- 播放音乐 -->
|
||||||
<music-full ref="MusicFullRef" v-model:music-full="musicFullVisible" :background="background" />
|
<music-full ref="MusicFullRef" v-model="musicFullVisible" :background="background" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -73,8 +73,12 @@
|
|||||||
<i class="iconfont ri-restart-line"></i>
|
<i class="iconfont ri-restart-line"></i>
|
||||||
<span>重启</span>
|
<span>重启</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="menu-item" @click="toGithubRelease">
|
<div class="menu-item" @click="selectItem('refresh')">
|
||||||
<i class="iconfont ri-refresh-line"></i>
|
<i class="iconfont ri-refresh-line"></i>
|
||||||
|
<span>刷新</span>
|
||||||
|
</div>
|
||||||
|
<div class="menu-item" @click="toGithubRelease">
|
||||||
|
<i class="iconfont ri-github-fill"></i>
|
||||||
<span>当前版本</span>
|
<span>当前版本</span>
|
||||||
<div class="version-info">
|
<div class="version-info">
|
||||||
<span class="version-number">{{ updateInfo.currentVersion }}</span>
|
<span class="version-number">{{ updateInfo.currentVersion }}</span>
|
||||||
@@ -212,6 +216,9 @@ const selectItem = async (key: string) => {
|
|||||||
case 'user':
|
case 'user':
|
||||||
router.push('/user');
|
router.push('/user');
|
||||||
break;
|
break;
|
||||||
|
case 'refresh':
|
||||||
|
window.location.reload();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -286,7 +293,7 @@ const toGithubRelease = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.user-popover {
|
.user-popover {
|
||||||
@apply min-w-[280px] p-0 rounded-xl overflow-hidden;
|
@apply min-w-[220px] p-0 rounded-xl overflow-hidden;
|
||||||
@apply bg-light dark:bg-black;
|
@apply bg-light dark:bg-black;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
|
||||||
@@ -303,7 +310,7 @@ const toGithubRelease = () => {
|
|||||||
@apply py-1;
|
@apply py-1;
|
||||||
|
|
||||||
.menu-item {
|
.menu-item {
|
||||||
@apply flex items-center px-3 py-2 text-sm cursor-pointer;
|
@apply flex items-center px-3 py-1 text-sm cursor-pointer;
|
||||||
@apply text-gray-700 dark:text-gray-300;
|
@apply text-gray-700 dark:text-gray-300;
|
||||||
transition: background-color 0.2s;
|
transition: background-color 0.2s;
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ const drag = (event: MouseEvent) => {
|
|||||||
-webkit-app-region: drag;
|
-webkit-app-region: drag;
|
||||||
@apply flex justify-between px-6 py-2 select-none relative;
|
@apply flex justify-between px-6 py-2 select-none relative;
|
||||||
@apply text-dark dark:text-white;
|
@apply text-dark dark:text-white;
|
||||||
z-index: 999;
|
z-index: 3000;
|
||||||
}
|
}
|
||||||
|
|
||||||
#buttons {
|
#buttons {
|
||||||
|
|||||||
Reference in New Issue
Block a user