feat: 搜索页面和一堆更新

This commit is contained in:
qier222 2022-03-29 00:11:05 +08:00
parent 4d7bc14827
commit b4590c3c34
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
17 changed files with 279 additions and 87 deletions

View file

@ -7,22 +7,22 @@ export enum SearchApiNames {
// 搜索
export enum SearchTypes {
SINGLE = 1,
ALBUM = 10,
ARTIST = 100,
PLAYLIST = 1000,
USER = 1002,
MV = 1004,
LYRICS = 1006,
RADIO = 1009,
VIDEO = 1014,
ALL = 1018,
SINGLE = '1',
ALBUM = '10',
ARTIST = '100',
PLAYLIST = '1000',
USER = '1002',
MV = '1004',
LYRICS = '1006',
RADIO = '1009',
VIDEO = '1014',
ALL = '1018',
}
export interface SearchParams {
keywords: string
limit?: number // 返回数量 , 默认为 30
offset?: number // 偏移数量,用于分页 , 如 : 如 :( 页数 -1)*30, 其中 30 为 limit 的值 , 默认为 0
type?: SearchTypes // type: 搜索类型
type: keyof typeof SearchTypes // type: 搜索类型
}
interface SearchResponse {
code: number
@ -71,7 +71,10 @@ export function search(params: SearchParams): Promise<SearchResponse> {
return request({
url: '/search',
method: 'get',
params: params,
params: {
...params,
type: SearchTypes[params.type ?? SearchTypes.ALL],
},
})
}