提交 ee889536 authored 作者: huaxinzhu's avatar huaxinzhu

商品添加和编辑时,连续同一张图片时,后续上传失效问题

上级 54b11697
...@@ -44,12 +44,10 @@ ...@@ -44,12 +44,10 @@
loading: false, loading: false,
goodsDeForm: { goodsDeForm: {
description: '', description: '',
}, },
// goodsDeRules: { // goodsDeRules: {
// description:[{required: true, message: '请上传商品详情图片', validator: checkImg}] // description:[{required: true, message: '请上传商品详情图片', validator: checkImg}]
// }, // },
goodsDetailsImgFileList: [], goodsDetailsImgFileList: [],
editorOption: { editorOption: {
placeholder: '', placeholder: '',
...@@ -61,6 +59,7 @@ ...@@ -61,6 +59,7 @@
'image': function (value) { 'image': function (value) {
if (value) { if (value) {
// 触发input框选择图片文件 // 触发input框选择图片文件
document.querySelector('#file').value = '' // 清空是为了解决,联系上传同一张图片时,后续上传失效问题
document.querySelector('#file').click() document.querySelector('#file').click()
} else { } else {
this.quill.format('image', false); this.quill.format('image', false);
...@@ -68,7 +67,7 @@ ...@@ -68,7 +67,7 @@
} }
} }
}, },
// // 禁止粘贴图片 // 禁止粘贴图片
clipboard: { clipboard: {
matchers: [[Node.ELEMENT_NODE, this.handleCustomMatcher]] matchers: [[Node.ELEMENT_NODE, this.handleCustomMatcher]]
} }
...@@ -107,11 +106,9 @@ ...@@ -107,11 +106,9 @@
insert: '' insert: ''
}) })
Delta.ops = ops; Delta.ops = ops;
// console.log('我是粘贴的');
} }
}) })
// //
//console.log(113,Delta);
return Delta return Delta
}, },
...@@ -125,7 +122,6 @@ ...@@ -125,7 +122,6 @@
const list = this.$refs.file.files; const list = this.$refs.file.files;
this.indexall = list.length this.indexall = list.length
this.uploadImgs() this.uploadImgs()
//debugger
}, },
// 向后台 传输 base64的图片数据 // 向后台 传输 base64的图片数据
uploadImgs() { uploadImgs() {
...@@ -133,8 +129,6 @@ ...@@ -133,8 +129,6 @@
let result = res.split(","); let result = res.split(",");
this.Base64img = result[1]; this.Base64img = result[1];
let data = {"img_data": this.Base64img} let data = {"img_data": this.Base64img}
//debugger
// this.loading = true;
UploadImg(data).then(res => { UploadImg(data).then(res => {
//debugger //debugger
if (res && res.code === 1) { if (res && res.code === 1) {
...@@ -149,6 +143,7 @@ ...@@ -149,6 +143,7 @@
// 调整光标到最后 // 调整光标到最后
quill.setSelection(length + 1) quill.setSelection(length + 1)
if(this.index < this.indexall){ if(this.index < this.indexall){
debugger
this.uploadImgs() this.uploadImgs()
}else{ }else{
this.index = 0 this.index = 0
...@@ -163,18 +158,12 @@ ...@@ -163,18 +158,12 @@
// //
onEditorChange({editor, html, text}) { onEditorChange({editor, html, text}) {
this.goodsDeForm.description = html; this.goodsDeForm.description = html;
// console.log( 100,this.$refs.file.files );
// console.log( 200,this.goodsDeForm.description );
// console.log( 300,this.goodsDetailsImgFileList );
// if( this.goodsDeForm.description.indexOf('img') < -1 ) { // if( this.goodsDeForm.description.indexOf('img') < -1 ) {
// this.goodsDetailsImgFileList = []; // this.goodsDetailsImgFileList = [];
// } // }
}, },
//失去焦点事件
onEditorBlur(){//失去焦点事件 onEditorBlur(){},
},
// 商品详情 子组件 form表单校验, 在父组件中被调用 // 商品详情 子组件 form表单校验, 在父组件中被调用
// validateGoodsDeImgForm() { // validateGoodsDeImgForm() {
// let flag = null // let flag = null
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论