Files
fe-manage/src/api/index.js
2022-10-27 15:45:28 +08:00

63 lines
2.0 KiB
JavaScript
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 http from "./config";
// import qs from 'qs';
/**
* 接口传参数方式get
* axios.get('/user', {
* params: {
* id: 12345
* name: user
* }
* }).then(res => console.log(res))
*
* 接口传参三种方式post/put/patch
*
* 1.'Content-Type'= 'multipart/form-data',传参格式为 formData。
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded'
* request的Header:'Content-Type'= 'multipart/form-data'
* var formData=new FormData();
* formData.append('user',123456);formData.append('pass',12345678);
* axios.post("/notice",formData).then()
*
* 2.'Content-Type'= 'application/x-www-form-urlencoded',传参格式为 query 形式,使用$qs.stringify。
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded'
* request的Header:'Content-Type'= 'application/x-www-form-urlencoded'
* let data = {"code":"1234","name":"yyyy"};
* axios.post(`${this.$url}/test/testRequest`,qs.stringify({data})).then()
*
* 3.'Content-Type'= 'application/json传参格式为 raw (JSON格式)。
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded'
* request的Header:'Content-Type'= 'application/json;charset=UTF-8'
* let data = {"code":"1234","name":"yyyy"}
* axios.post(`${this.$url}/test/testRequest`,data).then()
*
*/
// 接口-请求
// 创建编辑单层项目
export const createProject = (obj) => http.post('/admin/project/edit', {
"attach": obj.attach,
"beginTime": obj.beginTime,
"boeFlag": obj.boeFlag,
"category": obj.category,
"courseSyncFlag": obj.courseSyncFlag,
"endTime": obj.endTime,
"level": obj.level,
"manager": obj.manager,
"managerId": obj.managerId,
"name": obj.name,
"notice": obj.notice,
"noticeFlag": obj.noticeFlag,
"parentId": obj.parentId,
"picUrl": obj.picUrl,
"projectId": obj.projectId,
"remark": obj.remark,
"sourceBelongId": obj.sourceBelongId,
"status": obj.status,
"systemId": obj.systemId,
"templateId": obj.templateId,
"type": obj.type
})