mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-27 18:37:22 +08:00
修改动画, 修改搜索
This commit is contained in:
+6
-6
@@ -1,9 +1,9 @@
|
|||||||
import request from "@/utils/request";
|
import request from "@/utils/request"
|
||||||
import { ISearchDetail } from "@/type/search";
|
import { ISearchDetail } from "@/type/search"
|
||||||
|
|
||||||
// 搜索内容
|
// 搜索内容
|
||||||
export const getSearch = (keywords: any) => {
|
export const getSearch = (keywords: any) => {
|
||||||
return request.get<ISearchDetail>("/search", {
|
return request.get<any>("/cloudsearch", {
|
||||||
params: { keywords: keywords, type: 1018 },
|
params: { keywords: keywords, type: 1 },
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
<span
|
<span
|
||||||
class="play-list-type-item"
|
class="play-list-type-item"
|
||||||
:class="setAnimationClass('animate__bounceIn')"
|
:class="setAnimationClass('animate__bounceIn')"
|
||||||
:style="setAnimationDelay(index <= 13 ? index : index - 13)"
|
:style="setAnimationDelay(index <= 19 ? index : index - 19)"
|
||||||
v-if="isShowAllPlaylistCategory || index <= 13"
|
v-show="isShowAllPlaylistCategory || index <= 19"
|
||||||
@click="handleClickPlaylistType(item.name)"
|
@click="handleClickPlaylistType(item.name)"
|
||||||
>{{ item.name }}</span>
|
>{{ item.name }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -14,10 +14,9 @@
|
|||||||
<!-- <keep-alive>
|
<!-- <keep-alive>
|
||||||
<component :is="Component" v-if="$route.meta.keepAlive" />
|
<component :is="Component" v-if="$route.meta.keepAlive" />
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
<component :is="Component" v-if="!$route.meta.keepAlive" /> -->
|
<component :is="Component" v-if="!$route.meta.keepAlive" />-->
|
||||||
<keep-alive>
|
|
||||||
<component :is="Component"/>
|
<component :is="Component" />
|
||||||
</keep-alive>
|
|
||||||
</router-view>
|
</router-view>
|
||||||
</n-message-provider>
|
</n-message-provider>
|
||||||
</n-layout>
|
</n-layout>
|
||||||
@@ -34,7 +33,7 @@ import type { SongResult } from '@/type/music';
|
|||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useStore } from 'vuex';
|
import { useStore } from 'vuex';
|
||||||
// import { AppMenu, PlayBar, SearchBar } from './components';
|
// import { AppMenu, PlayBar, SearchBar } from './components';
|
||||||
import {defineAsyncComponent} from 'vue';
|
import { defineAsyncComponent } from 'vue';
|
||||||
const AppMenu = defineAsyncComponent(() => import('./components/AppMenu.vue'));
|
const AppMenu = defineAsyncComponent(() => import('./components/AppMenu.vue'));
|
||||||
const PlayBar = defineAsyncComponent(() => import('./components/PlayBar.vue'));
|
const PlayBar = defineAsyncComponent(() => import('./components/PlayBar.vue'));
|
||||||
const SearchBar = defineAsyncComponent(() => import('./components/SearchBar.vue'));
|
const SearchBar = defineAsyncComponent(() => import('./components/SearchBar.vue'));
|
||||||
|
|||||||
@@ -0,0 +1,189 @@
|
|||||||
|
|
||||||
|
<template>
|
||||||
|
<div id="drawer-target" v-show="isFull">
|
||||||
|
<div class="music-img">
|
||||||
|
<img class="img" :src="playMusic?.picUrl + '?param=300y300'" />
|
||||||
|
</div>
|
||||||
|
<div class="music-content">
|
||||||
|
<div class="music-content-name">{{ playMusic?.song.name }}</div>
|
||||||
|
<div class="music-content-singer">
|
||||||
|
<span
|
||||||
|
v-for="(item,index) in playMusic?.song.artists"
|
||||||
|
:key="index"
|
||||||
|
>{{ item.name }}{{ index < playMusic?.song.artists.length - 1 ? ' / ' : '' }}</span>
|
||||||
|
</div>
|
||||||
|
<n-layout
|
||||||
|
class="music-lrc"
|
||||||
|
style="height: 550px;"
|
||||||
|
ref="lrcSider"
|
||||||
|
:native-scrollbar="false"
|
||||||
|
@mouseover="mouseOverLayout"
|
||||||
|
@mouseleave="mouseLeaveLayout"
|
||||||
|
>
|
||||||
|
<template v-for="(item,index) in lrcArray" :key="index">
|
||||||
|
<div
|
||||||
|
class="music-lrc-text"
|
||||||
|
:class="{ 'now-text': isCurrentLrc(index) }"
|
||||||
|
@click="setAudioTime(index)"
|
||||||
|
>{{ item.text }}</div>
|
||||||
|
</template>
|
||||||
|
</n-layout>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed, ref } from 'vue'
|
||||||
|
import type { SongResult } from "@/type/music";
|
||||||
|
import type { ILyric } from "@/type/lyric";
|
||||||
|
import { getMusicLrc } from "@/api/music"
|
||||||
|
import { useStore } from 'vuex';
|
||||||
|
|
||||||
|
const store = useStore();
|
||||||
|
const props = defineProps({
|
||||||
|
isFull: {
|
||||||
|
type: Boolean
|
||||||
|
},
|
||||||
|
audio: {
|
||||||
|
type: Object,
|
||||||
|
default: {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const playMusic = computed(() => store.state.playMusic as SongResult)
|
||||||
|
|
||||||
|
|
||||||
|
const lrcData = ref<ILyric>()
|
||||||
|
|
||||||
|
interface ILrcData {
|
||||||
|
text: string;
|
||||||
|
trText: string;
|
||||||
|
}
|
||||||
|
const lrcArray = ref<Array<ILrcData>>()
|
||||||
|
const lrcTimeArray = ref<Array<Number>>([])
|
||||||
|
// 加载歌词
|
||||||
|
const loadLrc = async () => {
|
||||||
|
const { data } = await getMusicLrc(playMusic.value.id)
|
||||||
|
lrcData.value = data
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
let musicText = data.lrc.lyric
|
||||||
|
//歌词时间
|
||||||
|
let timeArray = musicText.match(/(\d{2}):(\d{2})(\.(\d*))?/g)
|
||||||
|
let timeArrayNum: Array<Number> = []
|
||||||
|
timeArray?.forEach(function (item, index) {
|
||||||
|
if (item.length < 9) {
|
||||||
|
item = item + "0"
|
||||||
|
}
|
||||||
|
timeArrayNum.push(parseInt(item.split(':')[0]) * 60 + parseFloat(item.split(':')[1]));
|
||||||
|
})
|
||||||
|
lrcTimeArray.value = timeArrayNum
|
||||||
|
//歌词
|
||||||
|
let musicTextArray = musicText.replace(/(\[(\d{2}):(\d{2})(\.(\d*))?\])/g, '').split('\n')
|
||||||
|
let text = []
|
||||||
|
|
||||||
|
try {
|
||||||
|
let trMusicText = data.tlyric.lyric
|
||||||
|
let trMusicTextArray = trMusicText.replace(/(\[(\d{2}):(\d{2})(\.(\d*))?\])/g, '').split('\n')
|
||||||
|
for (let i = 0; i < musicTextArray.length - 1; i++) {
|
||||||
|
text.push({
|
||||||
|
text: musicTextArray[i],
|
||||||
|
trText: trMusicTextArray[i]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
lrcArray.value = text
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
text = []
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const newLrcIndex = ref(0)
|
||||||
|
const isMouse = ref(false)
|
||||||
|
// 获取歌词滚动dom
|
||||||
|
const lrcSider = ref<any>(null)
|
||||||
|
// 歌词滚动方法
|
||||||
|
const lrcScroll = () => {
|
||||||
|
if (props.isFull && !isMouse.value) {
|
||||||
|
let top = newLrcIndex.value * 50 - 225;
|
||||||
|
lrcSider.value.scrollTo({ top: top, behavior: 'smooth' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const nowTime = ref(0)
|
||||||
|
const allTime = ref(0)
|
||||||
|
// 计算属性 获取当前播放时间的进度
|
||||||
|
const timeSlider = computed({
|
||||||
|
get: () => nowTime.value / allTime.value * 100,
|
||||||
|
set: (value) => {
|
||||||
|
props.audio.value.currentTime = value * allTime.value / 100
|
||||||
|
props.audio.value.play()
|
||||||
|
store.commit("setPlayMusic", true);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 是否是当前正在播放的歌词
|
||||||
|
const isCurrentLrc = (index: any) => {
|
||||||
|
let isTrue = !(nowTime.value <= lrcTimeArray.value[index] || nowTime.value >= lrcTimeArray.value[index + 1])
|
||||||
|
if (isTrue) {
|
||||||
|
newLrcIndex.value = index
|
||||||
|
}
|
||||||
|
return isTrue
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const mouseOverLayout = () => {
|
||||||
|
isMouse.value = true
|
||||||
|
}
|
||||||
|
const mouseLeaveLayout = () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
isMouse.value = false
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
#drawer-target {
|
||||||
|
@apply top-0 left-0 absolute w-full h-full overflow-hidden rounded px-24 pt-24 pb-48 flex items-center;
|
||||||
|
background-color: #333333;
|
||||||
|
animation-duration: 300ms;
|
||||||
|
.music-img {
|
||||||
|
@apply flex-1;
|
||||||
|
.img {
|
||||||
|
@apply rounded-xl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.music-content {
|
||||||
|
@apply flex flex-col justify-center items-center;
|
||||||
|
&-name {
|
||||||
|
@apply font-bold text-3xl py-2;
|
||||||
|
}
|
||||||
|
&-singer {
|
||||||
|
@apply text-base py-2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.music-lrc {
|
||||||
|
background-color: #333333;
|
||||||
|
width: 800px;
|
||||||
|
height: 550px;
|
||||||
|
&-text {
|
||||||
|
@apply text-white text-lg flex justify-center items-center cursor-pointer;
|
||||||
|
height: 50px;
|
||||||
|
transition: all 0.2s ease-out;
|
||||||
|
&:hover {
|
||||||
|
@apply font-bold text-xl text-red-500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.now-text {
|
||||||
|
@apply font-bold text-xl text-red-500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,35 +1,37 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 展开全屏 -->
|
<!-- 展开全屏 -->
|
||||||
<div id="drawer-target" :class="musicFullClass" v-show="musicFull">
|
<transition name="musicPage">
|
||||||
<div class="music-img">
|
<div id="drawer-target" v-show="musicFull">
|
||||||
<img class="img" :src="playMusic.picUrl + '?param=300y300'" />
|
<div class="music-img">
|
||||||
</div>
|
<img class="img" :src="playMusic.picUrl + '?param=300y300'" />
|
||||||
<div class="music-content">
|
</div>
|
||||||
<div class="music-content-name">{{ playMusic.song.name }}</div>
|
<div class="music-content">
|
||||||
<div class="music-content-singer">
|
<div class="music-content-name">{{ playMusic.song.name }}</div>
|
||||||
<span
|
<div class="music-content-singer">
|
||||||
v-for="(item,index) in playMusic.song.artists"
|
<span
|
||||||
:key="index"
|
v-for="(item,index) in playMusic.song.artists"
|
||||||
>{{ item.name }}{{ index < playMusic.song.artists.length - 1 ? ' / ' : '' }}</span>
|
:key="index"
|
||||||
|
>{{ item.name }}{{ index < playMusic.song.artists.length - 1 ? ' / ' : '' }}</span>
|
||||||
|
</div>
|
||||||
|
<n-layout
|
||||||
|
class="music-lrc"
|
||||||
|
style="height: 550px;"
|
||||||
|
ref="lrcSider"
|
||||||
|
:native-scrollbar="false"
|
||||||
|
@mouseover="mouseOverLayout"
|
||||||
|
@mouseleave="mouseLeaveLayout"
|
||||||
|
>
|
||||||
|
<template v-for="(item,index) in lrcArray" :key="index">
|
||||||
|
<div
|
||||||
|
class="music-lrc-text"
|
||||||
|
:class="{ 'now-text': isCurrentLrc(index) }"
|
||||||
|
@click="setAudioTime(index)"
|
||||||
|
>{{ item.text }}</div>
|
||||||
|
</template>
|
||||||
|
</n-layout>
|
||||||
</div>
|
</div>
|
||||||
<n-layout
|
|
||||||
class="music-lrc"
|
|
||||||
style="height: 550px;"
|
|
||||||
ref="lrcSider"
|
|
||||||
:native-scrollbar="false"
|
|
||||||
@mouseover="mouseOverLayout"
|
|
||||||
@mouseleave="mouseLeaveLayout"
|
|
||||||
>
|
|
||||||
<template v-for="(item,index) in lrcArray" :key="index">
|
|
||||||
<div
|
|
||||||
class="music-lrc-text"
|
|
||||||
:class="{ 'now-text': isCurrentLrc(index) }"
|
|
||||||
@click="setAudioTime(index)"
|
|
||||||
>{{ item.text }}</div>
|
|
||||||
</template>
|
|
||||||
</n-layout>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</transition>
|
||||||
<!-- 底部播放栏 -->
|
<!-- 底部播放栏 -->
|
||||||
<div class="music-play-bar" :class="setAnimationClass('animate__bounceInUp')">
|
<div class="music-play-bar" :class="setAnimationClass('animate__bounceInUp')">
|
||||||
<img class="play-bar-img" :src="playMusic.picUrl + '?param=200y200'" @click="setMusicFull" />
|
<img class="play-bar-img" :src="playMusic.picUrl + '?param=200y200'" @click="setMusicFull" />
|
||||||
@@ -126,6 +128,12 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(() => playMusicUrl.value, (value, oldValue) => {
|
||||||
|
if (!value) {
|
||||||
|
parsingMusic()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// 抬起键盘按钮监听
|
// 抬起键盘按钮监听
|
||||||
document.onkeyup = (e) => {
|
document.onkeyup = (e) => {
|
||||||
switch (e.code) {
|
switch (e.code) {
|
||||||
@@ -240,13 +248,6 @@ const parsingMusic = async () => {
|
|||||||
store.state.playMusicUrl = data.data.url
|
store.state.playMusicUrl = data.data.url
|
||||||
}
|
}
|
||||||
|
|
||||||
const musicFullClass = computed(() => {
|
|
||||||
if (musicFull.value) {
|
|
||||||
return setAnimationClass('animate__fadeInUp')
|
|
||||||
} else {
|
|
||||||
return setAnimationClass('animate__fadeOutDown')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const lrcData = ref<ILyric>()
|
const lrcData = ref<ILyric>()
|
||||||
|
|
||||||
@@ -315,6 +316,12 @@ const setAudioTime = (index: any) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.musicPage-enter-active {
|
||||||
|
animation: fadeInUp 0.8s ease-in-out;
|
||||||
|
}
|
||||||
|
.musicPage-leave-active {
|
||||||
|
animation: fadeOutDown 0.8s ease-in-out;
|
||||||
|
}
|
||||||
#drawer-target {
|
#drawer-target {
|
||||||
@apply top-0 left-0 absolute w-full h-full overflow-hidden rounded px-24 pt-24 pb-48 flex items-center;
|
@apply top-0 left-0 absolute w-full h-full overflow-hidden rounded px-24 pt-24 pb-48 flex items-center;
|
||||||
background-color: #333333;
|
background-color: #333333;
|
||||||
|
|||||||
+7
-7
@@ -1,6 +1,6 @@
|
|||||||
import { createRouter, createWebHistory } from "vue-router";
|
import { createRouter, createWebHistory, createMemoryHistory } from "vue-router"
|
||||||
import AppLayout from "@/layout/AppLayout.vue";
|
import AppLayout from "@/layout/AppLayout.vue"
|
||||||
import homeRouter from "@/router/home";
|
import homeRouter from "@/router/home"
|
||||||
|
|
||||||
let loginRouter = {
|
let loginRouter = {
|
||||||
path: "/login",
|
path: "/login",
|
||||||
@@ -11,7 +11,7 @@ let loginRouter = {
|
|||||||
icon: "icon-Home",
|
icon: "icon-Home",
|
||||||
},
|
},
|
||||||
component: () => import("@/views/login/index.vue"),
|
component: () => import("@/views/login/index.vue"),
|
||||||
};
|
}
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
@@ -19,9 +19,9 @@ const routes = [
|
|||||||
component: AppLayout,
|
component: AppLayout,
|
||||||
children: [...homeRouter, loginRouter],
|
children: [...homeRouter, loginRouter],
|
||||||
},
|
},
|
||||||
];
|
]
|
||||||
|
|
||||||
export default createRouter({
|
export default createRouter({
|
||||||
routes: routes,
|
routes: routes,
|
||||||
history: createWebHistory(),
|
history: createMemoryHistory(),
|
||||||
});
|
})
|
||||||
|
|||||||
+15
-12
@@ -1,23 +1,26 @@
|
|||||||
// 设置歌手背景图片
|
// 设置歌手背景图片
|
||||||
export const setBackgroundImg = (url: String) => {
|
export const setBackgroundImg = (url: String) => {
|
||||||
return "background-image:" + "url(" + url + ")";
|
return "background-image:" + "url(" + url + ")"
|
||||||
};
|
}
|
||||||
// 设置动画类型
|
// 设置动画类型
|
||||||
export const setAnimationClass = (type: String) => {
|
export const setAnimationClass = (type: String) => {
|
||||||
return "animate__animated " + type;
|
return "animate__animated " + type
|
||||||
};
|
}
|
||||||
// 设置动画延时
|
// 设置动画延时
|
||||||
export const setAnimationDelay = (index: number = 6, time: number = 50) => {
|
export const setAnimationDelay = (index: number = 6, time: number = 50) => {
|
||||||
return "animation-delay:" + index * time + "ms";
|
return "animation-delay:" + index * time + "ms"
|
||||||
};
|
}
|
||||||
|
|
||||||
//将秒转换为分钟和秒
|
//将秒转换为分钟和秒
|
||||||
export const secondToMinute = (s: number) => {
|
export const secondToMinute = (s: number) => {
|
||||||
let minute: number = Math.floor(s / 60);
|
if (!s) {
|
||||||
let second: number = Math.floor(s % 60);
|
return "00:00"
|
||||||
|
}
|
||||||
|
let minute: number = Math.floor(s / 60)
|
||||||
|
let second: number = Math.floor(s % 60)
|
||||||
let minuteStr: string =
|
let minuteStr: string =
|
||||||
minute > 9 ? minute.toString() : "0" + minute.toString();
|
minute > 9 ? minute.toString() : "0" + minute.toString()
|
||||||
let secondStr: string =
|
let secondStr: string =
|
||||||
second > 9 ? second.toString() : "0" + second.toString();
|
second > 9 ? second.toString() : "0" + second.toString()
|
||||||
return minuteStr + ":" + secondStr;
|
return minuteStr + ":" + secondStr
|
||||||
};
|
}
|
||||||
|
|||||||
+25
-15
@@ -122,21 +122,23 @@ const formatDetail = computed(() => (detail: any) => {
|
|||||||
</div>
|
</div>
|
||||||
</n-layout>
|
</n-layout>
|
||||||
|
|
||||||
<div class="music-page" v-show="showMusic" :class="musicFullClass">
|
<transition name="musicPage">
|
||||||
<i class="iconfont icon-icon_error music-close" @click="closeMusic()"></i>
|
<div class="music-page" v-if="showMusic">
|
||||||
<div class="music-title">{{ recommendItem?.name }}</div>
|
<i class="iconfont icon-icon_error music-close" @click="closeMusic()"></i>
|
||||||
<!-- 歌单歌曲列表 -->
|
<div class="music-title">{{ recommendItem?.name }}</div>
|
||||||
<n-layout class="music-list" :native-scrollbar="false">
|
<!-- 歌单歌曲列表 -->
|
||||||
<div
|
<n-layout class="music-list" :native-scrollbar="false">
|
||||||
v-for="(item, index) in listDetail?.playlist.tracks"
|
<div
|
||||||
:key="item.id"
|
v-for="(item, index) in listDetail?.playlist.tracks"
|
||||||
:class="setAnimationClass('animate__bounceInUp')"
|
:key="item.id"
|
||||||
:style="setAnimationDelay(index, 50)"
|
:class="setAnimationClass('animate__bounceInUp')"
|
||||||
>
|
:style="setAnimationDelay(index, 50)"
|
||||||
<SongItem :item="formatDetail(item)" />
|
>
|
||||||
</div>
|
<SongItem :item="formatDetail(item)" />
|
||||||
</n-layout>
|
</div>
|
||||||
</div>
|
</n-layout>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -145,6 +147,14 @@ const formatDetail = computed(() => (detail: any) => {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.musicPage-enter-active {
|
||||||
|
animation: fadeInUp 0.8s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.musicPage-leave-active {
|
||||||
|
animation: fadeOutDown 0.8s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
.recommend {
|
.recommend {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 800px;
|
height: 800px;
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ const loginPhone = async () => {
|
|||||||
width: 350px;
|
width: 350px;
|
||||||
height: 550px;
|
height: 550px;
|
||||||
@apply rounded-2xl rounded-b-none bg-cover bg-no-repeat relative overflow-hidden;
|
@apply rounded-2xl rounded-b-none bg-cover bg-no-repeat relative overflow-hidden;
|
||||||
background-image: url(https://z3.ax1x.com/2021/09/30/4IMyUx.jpg);
|
background-image: url(http://tva4.sinaimg.cn/large/006opRgRgy1gw8nf6no7uj30rs15n0x7.jpg);
|
||||||
background-color: #383838;
|
background-color: #383838;
|
||||||
box-shadow: inset 0px 0px 20px 5px #0000005e;
|
box-shadow: inset 0px 0px 20px 5px #0000005e;
|
||||||
|
|
||||||
|
|||||||
@@ -26,11 +26,12 @@
|
|||||||
class="search-list"
|
class="search-list"
|
||||||
:class="setAnimationClass('animate__fadeInUp')"
|
:class="setAnimationClass('animate__fadeInUp')"
|
||||||
:native-scrollbar="false"
|
:native-scrollbar="false"
|
||||||
|
@scroll="searchScrolling"
|
||||||
>
|
>
|
||||||
<div class="title">{{ hotKeyword }}</div>
|
<div class="title">{{ hotKeyword }}</div>
|
||||||
<template v-if="searchDetail">
|
<template v-if="searchDetail">
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in searchDetail?.result.song.songs"
|
v-for="(item, index) in searchDetail?.result.songs"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:class="setAnimationClass('animate__bounceInRight')"
|
:class="setAnimationClass('animate__bounceInRight')"
|
||||||
:style="setAnimationDelay(index, 100)"
|
:style="setAnimationDelay(index, 100)"
|
||||||
@@ -55,7 +56,7 @@ import SongItem from "@/components/common/SongItem.vue";
|
|||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const searchDetail = ref<ISearchDetail>();
|
const searchDetail = ref<any>();
|
||||||
|
|
||||||
// 热搜列表
|
// 热搜列表
|
||||||
const hotSearchData = ref<IHotSearch>();
|
const hotSearchData = ref<IHotSearch>();
|
||||||
@@ -64,6 +65,10 @@ const loadHotSearch = async () => {
|
|||||||
hotSearchData.value = data;
|
hotSearchData.value = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function searchScrolling(e: any) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadHotSearch();
|
loadHotSearch();
|
||||||
@@ -88,14 +93,15 @@ const loadSearch = async (keyword: any) => {
|
|||||||
searchDetail.value = undefined;
|
searchDetail.value = undefined;
|
||||||
if (!keyword) return;
|
if (!keyword) return;
|
||||||
const { data } = await getSearch(keyword);
|
const { data } = await getSearch(keyword);
|
||||||
const songs = data.result.song.songs;
|
|
||||||
|
const songs = data.result.songs;
|
||||||
|
|
||||||
// songs map 替换属性
|
// songs map 替换属性
|
||||||
songs.map((item: any) => {
|
songs.map((item: any) => {
|
||||||
item.picUrl = item.al.picUrl;
|
item.picUrl = item.al.picUrl;
|
||||||
item.song = item;
|
item.song = item;
|
||||||
item.artists = item.ar;
|
item.artists = item.ar;
|
||||||
});
|
});
|
||||||
data.result.song.songs = songs;
|
|
||||||
searchDetail.value = data;
|
searchDetail.value = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+24
-16
@@ -133,26 +133,34 @@ const musicFullClass = computed(() => {
|
|||||||
</div>
|
</div>
|
||||||
</n-layout>
|
</n-layout>
|
||||||
</div>
|
</div>
|
||||||
|
<transition name="musicPage">
|
||||||
<div class="music-page" v-show="isShowList" :class="musicFullClass">
|
<div class="music-page" v-if="isShowList">
|
||||||
<i class="iconfont icon-icon_error music-close" @click="isShowList = false"></i>
|
<i class="iconfont icon-icon_error music-close" @click="isShowList = false"></i>
|
||||||
<div class="music-title">{{ list?.name }}</div>
|
<div class="music-title">{{ list?.name }}</div>
|
||||||
<!-- 歌单歌曲列表 -->
|
<!-- 歌单歌曲列表 -->
|
||||||
<n-layout class="music-list" :native-scrollbar="false">
|
<n-layout class="music-list" :native-scrollbar="false">
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in list?.tracks"
|
v-for="(item, index) in list?.tracks"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:class="setAnimationClass('animate__bounceInUp')"
|
:class="setAnimationClass('animate__bounceInUp')"
|
||||||
:style="setAnimationDelay(index, 100)"
|
:style="setAnimationDelay(index, 100)"
|
||||||
>
|
>
|
||||||
<SongItem :item="formatDetail(item)" />
|
<SongItem :item="formatDetail(item)" />
|
||||||
</div>
|
</div>
|
||||||
</n-layout>
|
</n-layout>
|
||||||
</div>
|
</div>
|
||||||
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.musicPage-enter-active {
|
||||||
|
animation: fadeInUp 0.8s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.musicPage-leave-active {
|
||||||
|
animation: fadeOutDown 0.8s ease-in-out;
|
||||||
|
}
|
||||||
.user-page {
|
.user-page {
|
||||||
@apply flex;
|
@apply flex;
|
||||||
.left {
|
.left {
|
||||||
|
|||||||
Reference in New Issue
Block a user