From 351af19d7dee1e7c222c2b31e977daadc6aedeab Mon Sep 17 00:00:00 2001 From: daihh Date: Wed, 21 Dec 2022 17:09:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=97=A0=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/exam/Question.vue | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/src/views/exam/Question.vue b/src/views/exam/Question.vue index eb28b9ce..18b897b6 100644 --- a/src/views/exam/Question.vue +++ b/src/views/exam/Question.vue @@ -107,8 +107,7 @@ :action="uploadImgUrl" :on-success="handleUploadSuccess" :on-remove="handleRemove" - :limit="1" - :on-exceed="handleExceed"> + :limit="1"> 点击上传图片
jpg/png文件不超过500kb
@@ -130,12 +129,10 @@ class="upload-demo Optionsimage" :action="uploadImgUrl" :data="opt" - :before-upload="handleBeforeUploadOption" :on-success="(response)=>handleUploadOptionsSuccess(i,response)" :on-remove="handleRemove" :before-remove="beforeRemove" :limit="1" - :on-exceed="handleExceed" :file-list="opt.imgList" list-type="picture"> 点击上传图片 @@ -198,8 +195,7 @@ :action="uploadImgUrl" :on-success="handleUploadSuccess" :on-remove="handleRemove" - :limit="1" - :on-exceed="handleExceed"> + :limit="1"> 点击上传图片
jpg/png文件不超过500kb
@@ -376,33 +372,26 @@ export default { }); }, methods: { - handleBeforeUploadOption(file){ - //上传前的处理,与data关联 - console.log(file); - return true; - }, + handleUploadOptionsSuccess(optIdx,res){ - console.log(optIdx,'optIdx'); - console.log(res,'res'); + //console.log(optIdx,'optIdx'); + //console.log(res,'res'); this.question.optionList[optIdx].images=res.result.filePath; this.question.optionList[optIdx].imgList=[ {url:res.result.httpPath}, ] }, handleUploadSuccess(res) { - console.log(res.result.filePath); + //console.log(res.result.filePath); this.question.images=res.result.filePath; - }, - handleRemove(file, fileList) { + 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(`您确定移除图片吗?`); - }, + //需要同时删除已上传的图片,后续完善要加上 + }, + beforeRemove(file, fileList) { + return this.$confirm(`您确定移除图片吗?`); + }, downloadTemplate(){ let fileName = "试题导入模板.xls"; let link = document.createElement('a'); //创建a标签