mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-28 10:57:23 +08:00
🌈 style: 优化类型
This commit is contained in:
+1
-1
@@ -38,7 +38,7 @@ export function logout() {
|
|||||||
|
|
||||||
// 手机号登录
|
// 手机号登录
|
||||||
// /login/cellphone
|
// /login/cellphone
|
||||||
export function loginByCellphone(phone: any, password: any) {
|
export function loginByCellphone(phone: string, password: string) {
|
||||||
return request.post('/login/cellphone', {
|
return request.post('/login/cellphone', {
|
||||||
phone,
|
phone,
|
||||||
password,
|
password,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const loadPlaylistCategory = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const handleClickPlaylistType = (type: any) => {
|
const handleClickPlaylistType = (type: string) => {
|
||||||
router.push({
|
router.push({
|
||||||
path: '/list',
|
path: '/list',
|
||||||
query: {
|
query: {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ const isPlaying = computed(() => {
|
|||||||
const emits = defineEmits(['play']);
|
const emits = defineEmits(['play']);
|
||||||
|
|
||||||
// 播放音乐 设置音乐详情 打开音乐底栏
|
// 播放音乐 设置音乐详情 打开音乐底栏
|
||||||
const playMusicEvent = async (item: any) => {
|
const playMusicEvent = async (item: SongResult) => {
|
||||||
if (playMusic.value.id === item.id) {
|
if (playMusic.value.id === item.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export const useMusicHistory = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const delMusic = (music: any) => {
|
const delMusic = (music: SongResult) => {
|
||||||
const index = musicHistory.value.findIndex((item) => item.id === music.id);
|
const index = musicHistory.value.findIndex((item) => item.id === music.id);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
musicHistory.value.splice(index, 1);
|
musicHistory.value.splice(index, 1);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ export const reduceCorrectionTime = (time: number) => {
|
|||||||
correctionTime.value -= time;
|
correctionTime.value -= time;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const isCurrentLrc = (index: any, time: number) => {
|
export const isCurrentLrc = (index: number, time: number) => {
|
||||||
const currentTime = Number(lrcTimeArray.value[index]);
|
const currentTime = Number(lrcTimeArray.value[index]);
|
||||||
const nextTime = Number(lrcTimeArray.value[index + 1]);
|
const nextTime = Number(lrcTimeArray.value[index + 1]);
|
||||||
const nowTime = time + correctionTime.value;
|
const nowTime = time + correctionTime.value;
|
||||||
@@ -108,13 +108,13 @@ export const getLrcIndex = (time: number) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 设置当前播放时间
|
// 设置当前播放时间
|
||||||
export const setAudioTime = (index: any, audio: HTMLAudioElement) => {
|
export const setAudioTime = (index: number, audio: HTMLAudioElement) => {
|
||||||
audio.currentTime = lrcTimeArray.value[index] as number;
|
audio.currentTime = lrcTimeArray.value[index] as number;
|
||||||
audio.play();
|
audio.play();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 计算这个歌词的播放时间
|
// 计算这个歌词的播放时间
|
||||||
const getLrcTime = (index: any) => {
|
const getLrcTime = (index: number) => {
|
||||||
return Number(lrcTimeArray.value[index]);
|
return Number(lrcTimeArray.value[index]);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ export const getCurrentLrc = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 获取一句歌词播放时间是 几秒到几秒
|
// 获取一句歌词播放时间是 几秒到几秒
|
||||||
export const getLrcTimeRange = (index: any) => {
|
export const getLrcTimeRange = (index: number) => {
|
||||||
const currentTime = Number(lrcTimeArray.value[index]);
|
const currentTime = Number(lrcTimeArray.value[index]);
|
||||||
const nextTime = Number(lrcTimeArray.value[index + 1]);
|
const nextTime = Number(lrcTimeArray.value[index + 1]);
|
||||||
return { currentTime, nextTime };
|
return { currentTime, nextTime };
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ watch(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const iconStyle = (index: any) => {
|
const iconStyle = (index: number) => {
|
||||||
const style = {
|
const style = {
|
||||||
fontSize: props.size,
|
fontSize: props.size,
|
||||||
color: path.value === props.menus[index].path ? props.selectColor : props.color,
|
color: path.value === props.menus[index].path ? props.selectColor : props.color,
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ function handlePrev() {
|
|||||||
|
|
||||||
const MusicFullRef = ref<any>(null);
|
const MusicFullRef = ref<any>(null);
|
||||||
|
|
||||||
function handleGetAudioTime(this: any) {
|
function handleGetAudioTime(this: HTMLAudioElement) {
|
||||||
// 监听音频播放的实时时间事件
|
// 监听音频播放的实时时间事件
|
||||||
const audio = this as HTMLAudioElement;
|
const audio = this as HTMLAudioElement;
|
||||||
// 获取当前播放时间
|
// 获取当前播放时间
|
||||||
|
|||||||
+2
-2
@@ -24,8 +24,8 @@ export const secondToMinute = (s: number) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 格式化数字 千,万, 百万, 千万,亿
|
// 格式化数字 千,万, 百万, 千万,亿
|
||||||
export const formatNumber = (num: any) => {
|
export const formatNumber = (num: string | number) => {
|
||||||
num *= 1;
|
num = Number(num);
|
||||||
if (num < 10000) {
|
if (num < 10000) {
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const selectRecommendItem = async (item: IRecommendItem) => {
|
|||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const listTitle = ref(route.query.type || '歌单列表');
|
const listTitle = ref(route.query.type || '歌单列表');
|
||||||
|
|
||||||
const loadList = async (type: any) => {
|
const loadList = async (type: string) => {
|
||||||
const params = {
|
const params = {
|
||||||
cat: type || '',
|
cat: type || '',
|
||||||
limit: 30,
|
limit: 30,
|
||||||
@@ -34,7 +34,7 @@ const loadList = async (type: any) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (route.query.type) {
|
if (route.query.type) {
|
||||||
loadList(route.query.type);
|
loadList(route.query.type as string);
|
||||||
} else {
|
} else {
|
||||||
getRecommendList().then((res: { data: { result: any } }) => {
|
getRecommendList().then((res: { data: { result: any } }) => {
|
||||||
recommendList.value = res.data.result;
|
recommendList.value = res.data.result;
|
||||||
@@ -45,7 +45,7 @@ watch(
|
|||||||
() => route.query,
|
() => route.query,
|
||||||
async (newParams) => {
|
async (newParams) => {
|
||||||
if (newParams.type) {
|
if (newParams.type) {
|
||||||
loadList(newParams.type);
|
loadList(newParams.type as string);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user