优化网站导航模块
This commit is contained in:
106
modules/api/booking_____/lesson/index.ts
Normal file
106
modules/api/booking_____/lesson/index.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Lesson, LessonParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询课程管理
|
||||
*/
|
||||
export async function pageLesson(params: LessonParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Lesson>>>(
|
||||
MODULES_API_URL + '/booking/lesson/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课程管理列表
|
||||
*/
|
||||
export async function listLesson(params?: LessonParam) {
|
||||
const res = await request.get<ApiResult<Lesson[]>>(
|
||||
MODULES_API_URL + '/booking/lesson',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加课程管理
|
||||
*/
|
||||
export async function addLesson(data: Lesson) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/lesson',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改课程管理
|
||||
*/
|
||||
export async function updateLesson(data: Lesson) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/lesson',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课程管理
|
||||
*/
|
||||
export async function removeLesson(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/lesson/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除课程管理
|
||||
*/
|
||||
export async function removeBatchLesson(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/booking/lesson/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询课程管理
|
||||
*/
|
||||
export async function getLesson(id: number) {
|
||||
const res = await request.get<ApiResult<Lesson>>(
|
||||
MODULES_API_URL + '/booking/lesson/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
43
modules/api/booking_____/lesson/model/index.ts
Normal file
43
modules/api/booking_____/lesson/model/index.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 课程管理
|
||||
*/
|
||||
export interface Lesson {
|
||||
// ID
|
||||
lessonId?: number;
|
||||
// 课程名称
|
||||
lessonName?: string;
|
||||
// 图标
|
||||
image?: string;
|
||||
// 分类ID
|
||||
categoryId?: number;
|
||||
// 老师ID
|
||||
teacherId?: number;
|
||||
// 商户ID
|
||||
merchantId?: number;
|
||||
// 上课时间
|
||||
startTime?: string;
|
||||
// 报名人数上限
|
||||
maxNumber?: number;
|
||||
// 上课地点
|
||||
address?: string;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 状态
|
||||
status?: number;
|
||||
// 排序号
|
||||
sortNumber?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 课程管理搜索条件
|
||||
*/
|
||||
export interface LessonParam extends PageParam {
|
||||
lessonId?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user