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标签