PixelAI-admin/src/api/photos/index.ts

85 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import request from '/@/utils/request';
import { baseUrlHost } from '../baseUrlHost';
/**
* (不建议写成 request.post(xxx),因为这样 post 时,无法 params 与 data 同时传参)
* 注意在写get请求时参数是params而不是data要标注好
*
* 登录api接口集合
* @method getModuleList 获取模块列表
* @method getLabelList 获取标签列表
* @method getPhotosList 分页查询图片
* @method addPhotos 添加图片
* @method getPhotosDetail 获取图片详情
* @method updatePhotos 更新图片
* @method deletePhotos 删除图片
* @method uploadFile 上传图片
* @method uploadPictrue 公开图片上传返回图片id
*/
export function photosApi() {
return {
getModuleList: () => {
return request({
url: baseUrlHost + '/cpModule/all',
method: 'get',
});
},
getLabelList: (moduleid: Number) => {
return request({
url: baseUrlHost + `/cpLabel/moduleid/${moduleid}`,
method: 'get',
});
},
getPhotosList: (params: object) => {
return request({
url: baseUrlHost + '/cpPhoto',
method: 'get',
params,
});
},
addPhotos: (data: object) => {
return request({
url: baseUrlHost + '/cpPhoto',
method: 'post',
data,
});
},
getPhotosDetail: (id: Number) => {
return request({
url: baseUrlHost + `/cpPhoto/${id}`,
method: 'get',
});
},
updatePhotos: (data: object) => {
return request({
url: baseUrlHost + '/cpPhoto',
method: 'put',
data,
})
},
deletePhotos: (id: Number) => {
return request({
url: baseUrlHost + `/cpPhoto/${id}`,
method: 'delete',
});
},
uploadFile: (data: object) => {
return request({
url: baseUrlHost + '/enAttachment/upload',
method: 'post',
data,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
})
},
uploadPictrue:(data: object) => {
return request({
url: baseUrlHost + '/cpPhoto/uploadPictrue',
method: 'post',
data,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
})
},
};
}