52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
//
|
|
import { request, serializeQuery } from '@/utils/request'
|
|
import type {
|
|
CaseSelectionModel,
|
|
ProjectCaseAndCaseCountVo,
|
|
ProjectCaseUserBo,
|
|
ProjectCaseVo,
|
|
} from '@/types/business/cases'
|
|
|
|
export function getCaseList(
|
|
bo: ProjectCaseUserBo,
|
|
pageNum: number,
|
|
pageSize: number,
|
|
): Promise<ProjectCaseAndCaseCountVo> {
|
|
return request<ProjectCaseAndCaseCountVo>({
|
|
url: '/web/projectCase/list',
|
|
method: 'get',
|
|
params: { ...bo, pageNum, pageSize },
|
|
paramsSerializer: { serialize: serializeQuery },
|
|
})
|
|
}
|
|
|
|
export function getCaseDetail(id: string): Promise<ProjectCaseVo | null> {
|
|
return request<ProjectCaseVo | null>({
|
|
url: `/web/projectCase/${id}`,
|
|
method: 'get',
|
|
})
|
|
}
|
|
|
|
export function collectCase(id: string): Promise<void> {
|
|
return request<void>({
|
|
url: '/web/projectCase/collect',
|
|
method: 'post',
|
|
data: { id },
|
|
})
|
|
}
|
|
|
|
export function getCaseCategories(): Promise<CaseSelectionModel> {
|
|
return request<CaseSelectionModel>({
|
|
url: '/web/projectCase/categories',
|
|
method: 'get',
|
|
})
|
|
}
|
|
|
|
export function getFeaturedCases(type?: string): Promise<ProjectCaseVo[]> {
|
|
return request<ProjectCaseVo[]>({
|
|
url: '/web/projectCase/mostViewed',
|
|
method: 'get',
|
|
params: type ? { type } : undefined,
|
|
})
|
|
}
|