2022-05-20 16:12:27 +08:00
|
|
|
import { http } from '@/api/http'
|
|
|
|
import { httpErrorHandle } from '@/utils'
|
|
|
|
import { RequestHttpEnum, ModuleTypeEnum } from '@/enums/httpEnum'
|
|
|
|
|
2022-05-22 14:05:57 +08:00
|
|
|
// * 项目列表
|
|
|
|
export const projectListApi = async (data: object) => {
|
|
|
|
try {
|
|
|
|
const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.PROJECT}/list`, data);
|
|
|
|
return res;
|
|
|
|
} catch {
|
|
|
|
httpErrorHandle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-21 17:31:01 +08:00
|
|
|
// * 新增项目
|
|
|
|
export const createProjectApi = async (data: object) => {
|
|
|
|
try {
|
2022-05-21 18:03:15 +08:00
|
|
|
const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/create`, data);
|
2022-05-20 16:12:27 +08:00
|
|
|
return res;
|
|
|
|
} catch {
|
|
|
|
httpErrorHandle();
|
|
|
|
}
|
2022-05-22 15:25:07 +08:00
|
|
|
}
|
|
|
|
|
2022-05-22 22:11:56 +08:00
|
|
|
// * 获取项目
|
|
|
|
export const fetchProjectApi = async (data: object) => {
|
|
|
|
try {
|
|
|
|
const res = await http(RequestHttpEnum.GET)(`${ModuleTypeEnum.PROJECT}/getData`, data);
|
|
|
|
return res;
|
|
|
|
} catch {
|
|
|
|
httpErrorHandle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-23 23:50:35 +08:00
|
|
|
// * 保存项目
|
|
|
|
export const saveProjectApi = async (data: object) => {
|
|
|
|
try {
|
|
|
|
const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/save/data`, data);
|
|
|
|
return res;
|
|
|
|
} catch {
|
|
|
|
httpErrorHandle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// * 修改项目
|
|
|
|
export const updateProjectApi = async (data: object) => {
|
|
|
|
try {
|
|
|
|
const res = await http(RequestHttpEnum.POST)(`${ModuleTypeEnum.PROJECT}/edit`, data);
|
|
|
|
return res;
|
|
|
|
} catch {
|
|
|
|
httpErrorHandle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-22 22:11:56 +08:00
|
|
|
|
2022-05-22 15:25:07 +08:00
|
|
|
// * 删除项目
|
|
|
|
export const deleteProjectApi = async (data: object) => {
|
|
|
|
try {
|
|
|
|
const res = await http(RequestHttpEnum.DELETE)(`${ModuleTypeEnum.PROJECT}/delete`, data);
|
|
|
|
return res;
|
|
|
|
} catch {
|
|
|
|
httpErrorHandle();
|
|
|
|
}
|
2022-05-22 16:38:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// * 修改发布状态 [-1未发布,1发布]
|
|
|
|
export const changeProjectReleaseApi = async (data: object) => {
|
|
|
|
try {
|
|
|
|
const res = await http(RequestHttpEnum.PUT)(`${ModuleTypeEnum.PROJECT}/publish`, data);
|
|
|
|
return res;
|
|
|
|
} catch {
|
|
|
|
httpErrorHandle();
|
|
|
|
}
|
2022-05-20 16:12:27 +08:00
|
|
|
}
|