🌈 style: 优化类型

This commit is contained in:
alger
2024-05-21 11:01:23 +08:00
parent e4c1f855fb
commit c37ad07f93
9 changed files with 15 additions and 15 deletions

View File

@@ -38,7 +38,7 @@ export function logout() {
// 手机号登录
// /login/cellphone
export function loginByCellphone(phone: any, password: any) {
export function loginByCellphone(phone: string, password: string) {
return request.post('/login/cellphone', {
phone,
password,

View File

@@ -44,7 +44,7 @@ const loadPlaylistCategory = async () => {
};
const router = useRouter();
const handleClickPlaylistType = (type: any) => {
const handleClickPlaylistType = (type: string) => {
router.push({
path: '/list',
query: {

View File

@@ -61,7 +61,7 @@ const isPlaying = computed(() => {
const emits = defineEmits(['play']);
// 播放音乐 设置音乐详情 打开音乐底栏
const playMusicEvent = async (item: any) => {
const playMusicEvent = async (item: SongResult) => {
if (playMusic.value.id === item.id) {
return;
}

View File

@@ -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);
if (index !== -1) {
musicHistory.value.splice(index, 1);

View File

@@ -82,7 +82,7 @@ export const reduceCorrectionTime = (time: number) => {
correctionTime.value -= time;
};
export const isCurrentLrc = (index: any, time: number) => {
export const isCurrentLrc = (index: number, time: number) => {
const currentTime = Number(lrcTimeArray.value[index]);
const nextTime = Number(lrcTimeArray.value[index + 1]);
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.play();
};
// 计算这个歌词的播放时间
const getLrcTime = (index: any) => {
const getLrcTime = (index: number) => {
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 nextTime = Number(lrcTimeArray.value[index + 1]);
return { currentTime, nextTime };

View File

@@ -54,7 +54,7 @@ watch(
},
);
const iconStyle = (index: any) => {
const iconStyle = (index: number) => {
const style = {
fontSize: props.size,
color: path.value === props.menus[index].path ? props.selectColor : props.color,

View File

@@ -184,7 +184,7 @@ function handlePrev() {
const MusicFullRef = ref<any>(null);
function handleGetAudioTime(this: any) {
function handleGetAudioTime(this: HTMLAudioElement) {
// 监听音频播放的实时时间事件
const audio = this as HTMLAudioElement;
// 获取当前播放时间

View File

@@ -24,8 +24,8 @@ export const secondToMinute = (s: number) => {
};
// 格式化数字 千,万, 百万, 千万,亿
export const formatNumber = (num: any) => {
num *= 1;
export const formatNumber = (num: string | number) => {
num = Number(num);
if (num < 10000) {
return num;
}

View File

@@ -23,7 +23,7 @@ const selectRecommendItem = async (item: IRecommendItem) => {
const route = useRoute();
const listTitle = ref(route.query.type || '歌单列表');
const loadList = async (type: any) => {
const loadList = async (type: string) => {
const params = {
cat: type || '',
limit: 30,
@@ -34,7 +34,7 @@ const loadList = async (type: any) => {
};
if (route.query.type) {
loadList(route.query.type);
loadList(route.query.type as string);
} else {
getRecommendList().then((res: { data: { result: any } }) => {
recommendList.value = res.data.result;
@@ -45,7 +45,7 @@ watch(
() => route.query,
async (newParams) => {
if (newParams.type) {
loadList(newParams.type);
loadList(newParams.type as string);
}
},
);