|
@@ -0,0 +1,48 @@ |
|
|
|
|
|
import request from '@/request'; |
|
|
|
|
|
import { CategoryVO, CategoryPageReqVO, PageData } from '@/models'; |
|
|
|
|
|
|
|
|
|
|
|
const BASE_URL = '/admin-api/main/category'; |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
|
|
|
|
|
|
|
// 修改类目 |
|
|
|
|
|
updateCategoryApi: (data: CategoryVO) => { |
|
|
|
|
|
return request.put(`${BASE_URL}/update`, data); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 创建类目 |
|
|
|
|
|
createCategoryApi: (data: CategoryVO) => { |
|
|
|
|
|
return request.post(`${BASE_URL}/create`, data); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获得类目分页 |
|
|
|
|
|
getCategoryPageApi: () => { |
|
|
|
|
|
return request.get<PageData<CategoryVO>>(`${BASE_URL}/page`); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 获得所有类目(树结构) |
|
|
|
|
|
getCategoryTreeApi: (params: CategoryPageReqVO) => { |
|
|
|
|
|
return request.get<CategoryVO[]>(`${BASE_URL}/categoryAllTree`, { params }) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 查询类目详情 |
|
|
|
|
|
getCategoryApi: (id: number) => { |
|
|
|
|
|
return request.get(`${BASE_URL}/get?id=${id}`); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 删除类目 |
|
|
|
|
|
deleteCategoryApi: (id: number) => { |
|
|
|
|
|
return request.delete(`${BASE_URL}/delete?id=${id}`); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 类目名称唯一校验 |
|
|
|
|
|
categoryNameVerifyUnique: (categoryName: string) => { |
|
|
|
|
|
return request.delete(`${BASE_URL}/categoryNameVerifyUnique?categoryName=${categoryName}`); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 类目英文名称唯一校验 |
|
|
|
|
|
categoryNameEnVerifyUnique: (categoryNameEn: string) => { |
|
|
|
|
|
return request.delete(`${BASE_URL}/categoryNameEnVerifyUnique?categoryNameEn=${categoryNameEn}`); |
|
|
|
|
|
}, |
|
|
|
|
|
}; |