新增:md说明文档
This commit is contained in:
106
src/api/booking/course/index.ts
Normal file
106
src/api/booking/course/index.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Course, CourseParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询课程管理
|
||||
*/
|
||||
export async function pageCourse(params: CourseParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Course>>>(
|
||||
MODULES_API_URL + '/booking/course/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课程管理列表
|
||||
*/
|
||||
export async function listCourse(params?: CourseParam) {
|
||||
const res = await request.get<ApiResult<Course[]>>(
|
||||
MODULES_API_URL + '/booking/course',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加课程管理
|
||||
*/
|
||||
export async function addCourse(data: Course) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/course',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改课程管理
|
||||
*/
|
||||
export async function updateCourse(data: Course) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/course',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课程管理
|
||||
*/
|
||||
export async function removeCourse(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/course/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除课程管理
|
||||
*/
|
||||
export async function removeBatchCourse(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/course/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询课程管理
|
||||
*/
|
||||
export async function getCourse(id: number) {
|
||||
const res = await request.get<ApiResult<Course>>(
|
||||
MODULES_API_URL + '/booking/course/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
55
src/api/booking/course/model/index.ts
Normal file
55
src/api/booking/course/model/index.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 课程管理
|
||||
*/
|
||||
export interface Course {
|
||||
// ID
|
||||
lessonId?: number;
|
||||
// 课程名称
|
||||
lessonName?: string;
|
||||
// 封面图
|
||||
image?: string;
|
||||
// 分类ID
|
||||
categoryId?: number;
|
||||
// 课程价格
|
||||
price?: string;
|
||||
// 老师ID
|
||||
teacherId?: number;
|
||||
// 上课时间
|
||||
startTime?: string;
|
||||
// 课时
|
||||
classPeriod?: number;
|
||||
// 报名人数上限
|
||||
maxNumber?: number;
|
||||
// 上课地点
|
||||
address?: string;
|
||||
// 详细介绍
|
||||
content?: string;
|
||||
// 课程相册
|
||||
files?: string;
|
||||
// 年龄限制
|
||||
ageLimit?: string;
|
||||
// 报名时间
|
||||
bmTime?: string;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 商户ID
|
||||
merchantId?: number;
|
||||
// 状态
|
||||
status?: number;
|
||||
// 排序号
|
||||
sortNumber?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 课程管理搜索条件
|
||||
*/
|
||||
export interface CourseParam extends PageParam {
|
||||
lessonId?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
106
src/api/booking/courseCategory/index.ts
Normal file
106
src/api/booking/courseCategory/index.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { CourseCategory, CourseCategoryParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询课程分类
|
||||
*/
|
||||
export async function pageCourseCategory(params: CourseCategoryParam) {
|
||||
const res = await request.get<ApiResult<PageResult<CourseCategory>>>(
|
||||
MODULES_API_URL + '/booking/course-category/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课程分类列表
|
||||
*/
|
||||
export async function listCourseCategory(params?: CourseCategoryParam) {
|
||||
const res = await request.get<ApiResult<CourseCategory[]>>(
|
||||
MODULES_API_URL + '/booking/course-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 addCourseCategory(data: CourseCategory) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/course-category',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改课程分类
|
||||
*/
|
||||
export async function updateCourseCategory(data: CourseCategory) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/course-category',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课程分类
|
||||
*/
|
||||
export async function removeCourseCategory(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/course-category/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除课程分类
|
||||
*/
|
||||
export async function removeBatchCourseCategory(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/course-category/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询课程分类
|
||||
*/
|
||||
export async function getCourseCategory(id: number) {
|
||||
const res = await request.get<ApiResult<CourseCategory>>(
|
||||
MODULES_API_URL + '/booking/course-category/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
41
src/api/booking/courseCategory/model/index.ts
Normal file
41
src/api/booking/courseCategory/model/index.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 课程分类
|
||||
*/
|
||||
export interface CourseCategory {
|
||||
// 商品分类ID
|
||||
id?: number;
|
||||
// 分类名称
|
||||
name?: string;
|
||||
// 分类标识
|
||||
code?: string;
|
||||
// 分类图片
|
||||
image?: string;
|
||||
// 上级分类ID
|
||||
parentId?: number;
|
||||
// 排序(数字越小越靠前)
|
||||
sortNumber?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 是否推荐
|
||||
recommend?: number;
|
||||
// 状态, 0正常, 1禁用
|
||||
status?: number;
|
||||
// 是否删除, 0否, 1是
|
||||
deleted?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 课程分类搜索条件
|
||||
*/
|
||||
export interface CourseCategoryParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user