优化网站导航模块
This commit is contained in:
106
modules/api/booking_____/category/index.ts
Normal file
106
modules/api/booking_____/category/index.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Category, CategoryParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询课程分类
|
||||
*/
|
||||
export async function pageCategory(params: CategoryParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Category>>>(
|
||||
MODULES_API_URL + '/booking/category/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课程分类列表
|
||||
*/
|
||||
export async function listCategory(params?: CategoryParam) {
|
||||
const res = await request.get<ApiResult<Category[]>>(
|
||||
MODULES_API_URL + '/booking/category',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加课程分类
|
||||
*/
|
||||
export async function addCategory(data: Category) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/category',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改课程分类
|
||||
*/
|
||||
export async function updateCategory(data: Category) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/category',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课程分类
|
||||
*/
|
||||
export async function removeCategory(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/category/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除课程分类
|
||||
*/
|
||||
export async function removeBatchCategory(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/category/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询课程分类
|
||||
*/
|
||||
export async function getCategory(id: number) {
|
||||
const res = await request.get<ApiResult<Category>>(
|
||||
MODULES_API_URL + '/booking/category/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
57
modules/api/booking_____/category/model/index.ts
Normal file
57
modules/api/booking_____/category/model/index.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 课程分类
|
||||
*/
|
||||
export interface Category {
|
||||
// 商品分类ID
|
||||
categoryId?: number;
|
||||
// 分类标识
|
||||
categoryCode?: string;
|
||||
// 分类名称
|
||||
title?: string;
|
||||
// 类型 0列表 1单页 2外链
|
||||
type?: number;
|
||||
// 分类图片
|
||||
image?: string;
|
||||
// 上级分类ID
|
||||
parentId?: number;
|
||||
// 路由/链接地址
|
||||
path?: string;
|
||||
// 组件路径
|
||||
component?: string;
|
||||
// 绑定的页面
|
||||
pageId?: number;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 商品数量
|
||||
count?: number;
|
||||
// 排序(数字越小越靠前)
|
||||
sortNumber?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)
|
||||
hide?: number;
|
||||
// 是否推荐
|
||||
recommend?: number;
|
||||
// 是否显示在首页
|
||||
showIndex?: number;
|
||||
// 状态, 0正常, 1禁用
|
||||
status?: number;
|
||||
// 是否删除, 0否, 1是
|
||||
deleted?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 注册时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 课程分类搜索条件
|
||||
*/
|
||||
export interface CategoryParam extends PageParam {
|
||||
categoryId?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user