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

62 lines
1.4 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 getClientsList 分页查询客户
* @method addClients 添加客户
* @method getClientsDetail 获取客户详情
* @method updateClients 更新客户
* @method deleteClients 删除客户
* @method uploadFile 上传客户
*/
export function clientsApi() {
return {
getClientsList: (params: object) => {
return request({
url: baseUrlHost + '/mbUser',
method: 'get',
params,
});
},
addClients: (data: object) => {
return request({
url: baseUrlHost + '/cpClients',
method: 'post',
data,
});
},
getClientsDetail: (id: Number) => {
return request({
url: baseUrlHost + `/cpClients/${id}`,
method: 'get',
});
},
updateClients: (data: object) => {
return request({
url: baseUrlHost + '/cpClients',
method: 'put',
data,
})
},
deleteClients: (id: Number) => {
return request({
url: baseUrlHost + `/cpClients/${id}`,
method: 'delete',
});
},
uploadFile: (data: object) => {
return request({
url: baseUrlHost + '/enAttachment/upload',
method: 'post',
data,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
})
}
};
}