From 26058b1501dcaaddbb4b80134bea482814dd2b53 Mon Sep 17 00:00:00 2001 From: lmj <3407000732@qq.com> Date: Tue, 13 Dec 2022 18:14:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E9=A2=98=E7=AE=A1=E7=90=86=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/exam/Question.vue | 103 ++++++++++++++++++++++++++++++++---- 1 file changed, 94 insertions(+), 9 deletions(-) diff --git a/src/views/exam/Question.vue b/src/views/exam/Question.vue index f3ea1bb9..7ff11095 100644 --- a/src/views/exam/Question.vue +++ b/src/views/exam/Question.vue @@ -116,32 +116,65 @@ --> + placeholder="请输入题干"> + + + 点击上传图片 +
只能上传jpg/png文件,且不超过500kb
+
-
+
+ placeholder="填写选择题的选项内容"> + + + + + + + + 正确 正确 + style="width: 80px; margin-right: 10px">正确 + 删除 +
添加选项 @@ -298,12 +331,13 @@ const questionData = { project: "", createPerson: "", moduel: "", + images:"", statue: 0, optionList: [ - { content: "", score: "", isAnswer: false }, - { content: "", score: "", isAnswer: false }, - { content: "", score: "", isAnswer: false }, - { content: "", score: "", isAnswer: false }, + { content: "", score: "", isAnswer: false ,images:""}, + { content: "", score: "", isAnswer: false ,images:""}, + { content: "", score: "", isAnswer: false ,images:""}, + { content: "", score: "", isAnswer: false ,images:""}, ], // resSysId: [], // 试题目录 difficulty: "", // 难度 @@ -317,6 +351,9 @@ export default { }, data() { return { + curOption:[], + uploadImgUrl: process.env.VUE_APP_BASE_API + "/xboe/sys/xuploader/file/upload", // 上传的图片服务器地址 + fileList:[], resOwnerListMap: [], // resOwnerName: resOwnerIndexName, ownership: [], @@ -377,11 +414,34 @@ export default { this.loadData(1); }, mounted() { + this.getResOwnerTree().then(rs=>{ this.resOwnerListMap=rs; }); }, methods: { + handleUploadOptionsSuccess(res){ + this.curOption.push(res.result.filePath); + questionData.optionList[0].images = this.curOption[0]; + questionData.optionList[1].images = this.curOption[1]; + questionData.optionList[2].images = this.curOption[2]; + questionData.optionList[3].images = this.curOption[3]; + console.log(questionData) + }, + handleUploadSuccess(res) { + console.log(res.result.filePath); + questionData.images = res.result.filePath; + console.log(questionData.images) + }, + handleRemove(file, fileList) { + console.log(file, fileList); + }, + handleExceed(files, fileList) { + this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); + }, + beforeRemove(file, fileList) { + return this.$confirm(`确定移除 ${ file.name }?`); + }, downloadTemplate(){ let fileName = "试题导入模板.xls"; let link = document.createElement('a'); //创建a标签 @@ -514,6 +574,7 @@ export default { // 判断题没有optionList this.question.optionList = []; } + console.log(questionData,'llkk') examQuestionApi .save(this.question) .then((res) => { @@ -614,7 +675,7 @@ export default { }, addOption() { if (this.question.optionList.length < 10) { - this.question.optionList.push({ content: "", score: "", isAnswer: 0 }); + this.question.optionList.push({ content: "", score: "", isAnswer: 0 ,images:""}); } }, removeOption(i) { @@ -627,6 +688,30 @@ export default {