diff --git a/src/api/indexEval.js b/src/api/indexEval.js index 7f2da7ce..396d5b15 100644 --- a/src/api/indexEval.js +++ b/src/api/indexEval.js @@ -45,29 +45,39 @@ export const fileUp = (data) => headers: { "Content-Type": "multipart/form-data" }, }); -//删除测评信息 -export const deleteEvaluationById = (obj) => http.post('/evaluation/deleteEvaluationById', { params: obj }, { - header: { - 'token': '123', - } -}) +//上传文件 +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,{ + http.post("/evaluation/queryEvaluationDetailById", obj, { headers: { - 'token': '123', - 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', - } -}); + 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) => +export const choiceEvaluation = (obj) => http.post("/evaluation/choiceEvaluation", obj); // 测试方法 @@ -79,9 +89,9 @@ export const updateEvaluation = (obj) => // }) //根据name获取测评信息详情 export const getEvalListByName = (obj) => - http.post("/evaluation/queryEvaluationDetailById", obj,{ + http.post("/evaluation/queryEvaluationDetailById", obj, { headers: { - 'token': '123', - 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', - } -}); \ No newline at end of file + token: "123", + "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8", + }, + }); diff --git a/src/components/vote/AddVote.vue b/src/components/vote/AddVote.vue index 4c2a5f77..0c87fcd5 100644 --- a/src/components/vote/AddVote.vue +++ b/src/components/vote/AddVote.vue @@ -121,16 +121,22 @@ 基础投票数:
- --> + - + +
@@ -178,6 +184,7 @@ import { RouterEditTask } from "@/api/indexTask"; import dayjs from "dayjs"; import * as apiTask from "../../api/indexTaskadd"; import { addTempTask } from "../../api/indexTaskadd"; +import { baseVoteupload } from "../../api/indexEval"; export default { name: "AddVote", @@ -278,13 +285,9 @@ export default { }; // 限制文件格式上传 - const beforeUpload = (obj) => { - console.log(obj); - }; - - const handleChange = (info) => { - console.log(info.file.type, info.file.type.indexOf("sheet")); - if (info.file.type.indexOf("sheet") == -1) { + const beforeUpload = (file) => { + console.log(file); + if (file.type.indexOf("sheet") == -1) { message.destroy(); message.error("请上传正确的文件格式"); @@ -294,18 +297,25 @@ export default { return; } - let resFileList = [...info.fileList]; + // let resFileList = [...info.fileList]; - resFileList.map((file) => { - if (file.response) { - // Component will show file.url as link - file.url = file.response.url; - console.log("file========", file); - console.log("file========", file.response); - state.voteCount = file.response.data; + // resFileList.map((file) => { + // if (file.response) { + // // Component will show file.url as link + // file.url = file.response.url; + // console.log("file========", file); + // console.log("file========", file.response); + // state.voteCount = file.response.data; + // } + // }); + + const formData = new FormData(); + formData.append("uploadFile", file); + baseVoteupload(formData).then((res) => { + if (res.data.code === 200) { + console.log(res); } }); - //fileList.value = resFileList; }; //删除题干信息接口 @@ -470,7 +480,6 @@ export default { updateVoteInfo, queryStem, closeStem, - handleChange, beforeUpload, handlelog, }; diff --git a/src/views/courselibrary/CoursewareManage.vue b/src/views/courselibrary/CoursewareManage.vue index 46e7b971..24002989 100644 --- a/src/views/courselibrary/CoursewareManage.vue +++ b/src/views/courselibrary/CoursewareManage.vue @@ -3101,7 +3101,8 @@ const columns1 = [ customRender: ({ text }) => { return text ? text : "-"; }, - },{ + }, + { title: " 所属路径", width: 250, dataIndex: "routerName",