feat: monorepo

This commit is contained in:
qier222 2022-05-12 02:45:43 +08:00
parent 4d54060a4f
commit 42089d4996
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
200 changed files with 1530 additions and 1521 deletions

188
packages/web/api/user.ts Normal file
View file

@ -0,0 +1,188 @@
import request from '@/web/utils/request'
import {
FetchUserAccountResponse,
FetchUserPlaylistsParams,
FetchUserPlaylistsResponse,
FetchUserLikedTracksIDsParams,
FetchUserLikedTracksIDsResponse,
FetchUserAlbumsParams,
FetchUserAlbumsResponse,
FetchUserArtistsResponse,
} from '@/shared/api/User'
/**
*
* 说明 : 登录后调用此接口 , id,
* - uid : 用户 id
* @param {number} uid
*/
export function userDetail(uid: number) {
return request({
url: '/user/detail',
method: 'get',
params: {
uid,
timestamp: new Date().getTime(),
},
})
}
// 获取账号详情
export function fetchUserAccount(): Promise<FetchUserAccountResponse> {
return request({
url: '/user/account',
method: 'get',
params: {
timestamp: new Date().getTime(),
},
})
}
// 获取用户歌单
export function fetchUserPlaylists(
params: FetchUserPlaylistsParams
): Promise<FetchUserPlaylistsResponse> {
return request({
url: '/user/playlist',
method: 'get',
params,
})
}
export function fetchUserLikedTracksIDs(
params: FetchUserLikedTracksIDsParams
): Promise<FetchUserLikedTracksIDsResponse> {
return request({
url: '/likelist',
method: 'get',
params: {
uid: params.uid,
timestamp: new Date().getTime(),
},
})
}
/**
*
* 说明 : 调用此接口可签到获取积分
* - type: , 0, 0 ,1 web/PC
* @param {number} type
*/
export function dailySignin(type = 0) {
return request({
url: '/daily_signin',
method: 'post',
params: {
type,
timestamp: new Date().getTime(),
},
})
}
export function fetchUserAlbums(
params: FetchUserAlbumsParams
): Promise<FetchUserAlbumsResponse> {
return request({
url: '/album/sublist',
method: 'get',
params: {
...params,
timestamp: new Date().getTime(),
},
})
}
// 获取收藏的歌手
export function fetchUserArtists(): Promise<FetchUserArtistsResponse> {
return request({
url: '/artist/sublist',
method: 'get',
params: {
timestamp: new Date().getTime(),
},
})
}
/**
* MV
* 说明 : 调用此接口可获取到用户收藏的MV
*/
// export function likedMVs(params) {
// return request({
// url: '/mv/sublist',
// method: 'get',
// params: {
// limit: params.limit,
// timestamp: new Date().getTime(),
// },
// })
// }
/**
*
*/
// export function uploadSong(file) {
// let formData = new FormData()
// formData.append('songFile', file)
// return request({
// url: '/cloud',
// method: 'post',
// params: {
// timestamp: new Date().getTime(),
// },
// data: formData,
// headers: {
// 'Content-Type': 'multipart/form-data',
// },
// timeout: 200000,
// }).catch(error => {
// alert(`上传失败Error: ${error}`)
// })
// }
/**
*
* 说明 : 登录后调用此接口 , , url, /song/url url
* - limit : 返回数量 , 200
* - offset : 偏移数量 , :( -1)*200, 200 limit , 0
* @param {Object} params
* @param {number} params.limit
* @param {number=} params.offset
*/
// export function cloudDisk(params = {}) {
// params.timestamp = new Date().getTime()
// return request({
// url: '/user/cloud',
// method: 'get',
// params,
// })
// }
/**
*
*/
// export function cloudDiskTrackDetail(id) {
// return request({
// url: '/user/cloud/detail',
// method: 'get',
// params: {
// timestamp: new Date().getTime(),
// id,
// },
// })
// }
/**
*
* @param {Array} id
*/
// export function cloudDiskTrackDelete(id) {
// return request({
// url: '/user/cloud/del',
// method: 'get',
// params: {
// timestamp: new Date().getTime(),
// id,
// },
// })
// }