mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-11 20:06:47 +08:00
104 lines
3.1 KiB
JavaScript
104 lines
3.1 KiB
JavaScript
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 createEvaluation = (obj) =>
|
||
http.post("/evaluation/createEvaluation", obj);
|
||
|
||
//上传组件
|
||
export const fileUp = (data) =>
|
||
http.post("/file/upload", data, {
|
||
headers: { "Content-Type": "multipart/form-data" },
|
||
});
|
||
|
||
//上传文件
|
||
export const baseVoteupload = (data) =>
|
||
http.post("/vote/baseVoteupload", data, {
|
||
headers: { "Content-Type": "multipart/form-data" },
|
||
});
|
||
|
||
//删除测评信息
|
||
export const deleteEvaluationById = (obj) =>
|
||
http.post(
|
||
"/evaluation/deleteEvaluationById",
|
||
{ params: obj },
|
||
{
|
||
header: {
|
||
token: "123",
|
||
},
|
||
}
|
||
);
|
||
|
||
//根据ID获取测评信息详情
|
||
export const queryEvaluationDetailById = (obj) =>
|
||
http.post("/evaluation/queryEvaluationDetailById", obj, {
|
||
headers: {
|
||
token: "123",
|
||
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
||
},
|
||
});
|
||
export const queryEvaluationMessageById = (obj) =>
|
||
http.post("/evaluation/queryEvaluationMessageById", obj, {
|
||
headers: {
|
||
token: "123",
|
||
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
||
},
|
||
});
|
||
//修改测评信息
|
||
export const updateEvaluation = (obj) =>
|
||
http.post("/evaluation/updateEvaluation", obj);
|
||
|
||
//测评列表查询接口
|
||
export const choiceEvaluation = (obj) =>
|
||
http.post("/evaluation/choiceEvaluation", obj);
|
||
|
||
// 测试方法
|
||
// import * as api from '../../api/index'
|
||
// api.getLearnPath({}).then(res => {
|
||
// console.log(res)
|
||
// }).catch(err => {
|
||
// console.log(err)
|
||
// })
|
||
//根据name获取测评信息详情
|
||
export const getEvalListByName = (obj) =>
|
||
http.post("/evaluation/queryEvaluationDetailById", obj, {
|
||
headers: {
|
||
token: "123",
|
||
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
||
},
|
||
});
|