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

店铺 上传图片接口修改

上级 ea05584a
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
}, },
// 禁止粘贴图片 // 禁止粘贴图片
clipboard: { clipboard: {
matchers: [[Node.ELEMENT_NODE, this.handleCustomMatcher]] //matchers: [[Node.ELEMENT_NODE, this.handleCustomMatcher]]
} }
} }
}, },
...@@ -87,8 +87,8 @@ ...@@ -87,8 +87,8 @@
methods: { methods: {
handleCustomMatcher(node, Delta) { handleCustomMatcher(node, Delta) {
let ops = [] let ops = []
//debugger
console.log(123); console.log(123);
debugger
Delta.ops.forEach(op => { Delta.ops.forEach(op => {
if (op.insert && typeof op.insert === 'string') {// 如果粘贴了图片,这里会是一个对象,所以可以这样处理 if (op.insert && typeof op.insert === 'string') {// 如果粘贴了图片,这里会是一个对象,所以可以这样处理
ops.push({ ops.push({
...@@ -110,6 +110,7 @@ ...@@ -110,6 +110,7 @@
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() {
...@@ -129,7 +130,7 @@ ...@@ -129,7 +130,7 @@
let quill = this.$refs.myTextEditor.quill; let quill = this.$refs.myTextEditor.quill;
let length = quill.getSelection().index; let length = quill.getSelection().index;
// 插入图片 res.data.url为服务器返回的图片地址 // 插入图片 res.data.url为服务器返回的图片地址
quill.insertEmbed(length, 'image', res.data.image_url) quill.insertEmbed(length, 'image)', res.data.image_url)
// 调整光标到最后 // 调整光标到最后
quill.setSelection(length + 1) quill.setSelection(length + 1)
if(this.index < this.indexall){ if(this.index < this.indexall){
......
...@@ -399,7 +399,7 @@ ...@@ -399,7 +399,7 @@
for (let itemKey in itemObj) { for (let itemKey in itemObj) {
//---------------- //----------------
// 有多余字段,可能为空,需要对有效字段单独判断 // 有多余字段,可能为空,需要对有效字段单独判断
if ( !itemObj['js_price'] || !itemObj['sl_price'] || !itemObj['price'] || !itemObj['sc_price'] || !itemObj['stock'] || !itemObj['weight']) { if ( (itemObj['js_price'] === '') || (itemObj['sl_price'] === '') || (itemObj['price'] === '') || (itemObj['sc_price'] === '') || (itemObj['stock'] === '') || (itemObj['weight'] === '') ) {
isGoodsPrice = false; isGoodsPrice = false;
break break
} else { } else {
......
...@@ -492,10 +492,10 @@ ...@@ -492,10 +492,10 @@
this.getBase64(param.file).then((res) => { this.getBase64(param.file).then((res) => {
let result = res.split(","); let result = res.split(",");
this.Base64img = result[1]; this.Base64img = result[1];
let data = {"image": this.Base64img}; let data = {"img_data": this.Base64img};
upLoadImg(data).then((res) => { upLoadImg(data).then((res) => {
if (res && res.data.code == 1) { if (res && res.code === 1) {
this.brandImgFileList.push({'url': res.data.data.imageUrl}); this.brandImgFileList.push({'url': res.data.image_url});
this.$message('上传成功'); this.$message('上传成功');
this.$refs.brandForm.clearValidate('brand_logo'); this.$refs.brandForm.clearValidate('brand_logo');
//this.$refs.logoImg.clearValidate(); //this.$refs.logoImg.clearValidate();
...@@ -539,10 +539,10 @@ ...@@ -539,10 +539,10 @@
this.getBase64(param.file).then((res) => { this.getBase64(param.file).then((res) => {
let result = res.split(","); let result = res.split(",");
this.Base64img = result[1]; this.Base64img = result[1];
let data = {"image": this.Base64img}; let data = {"img_data": this.Base64img};
upLoadImg(data).then((res) => { upLoadImg(data).then((res) => {
if (res && res.data.code == 1) { if (res && res.code === 1) {
this.certImgFileList.push({'url': res.data.data.imageUrl}); this.certImgFileList.push({'url': res.data.image_url});
this.$message('上传成功'); this.$message('上传成功');
this.$refs.brandForm.clearValidate('brand_register_cert'); this.$refs.brandForm.clearValidate('brand_register_cert');
//this.$refs.logoImg.clearValidate(); //this.$refs.logoImg.clearValidate();
...@@ -570,10 +570,10 @@ ...@@ -570,10 +570,10 @@
this.getBase64(param.file).then((res) => { this.getBase64(param.file).then((res) => {
let result = res.split(","); let result = res.split(",");
this.Base64img = result[1]; this.Base64img = result[1];
let data = {"image":this.Base64img}; let data = {"img_data":this.Base64img};
upLoadImg(data).then((res) => { upLoadImg(data).then((res) => {
if(res && res.data.code == 1){ if(res && res.code === 1){
this.factoryImgFileList.push({'url':res.data.data.imageUrl}); this.factoryImgFileList.push({'url':res.data.image_url});
this.$refs.brandForm.clearValidate('brand_auth'); this.$refs.brandForm.clearValidate('brand_auth');
this.$message('上传成功'); this.$message('上传成功');
} }
...@@ -616,10 +616,10 @@ ...@@ -616,10 +616,10 @@
this.getBase64(param.file).then((res) => { this.getBase64(param.file).then((res) => {
let result = res.split(","); let result = res.split(",");
this.Base64img = result[1]; this.Base64img = result[1];
let data = {"image":this.Base64img}; let data = {"img_data":this.Base64img};
upLoadImg(data).then((res) => { upLoadImg(data).then((res) => {
if(res && res.data.code == 1){ if(res && res.code === 1){
this.shopImgFileList.push({'url':res.data.data.imageUrl}); this.shopImgFileList.push({'url':res.data.image_url});
this.$message('上传成功'); this.$message('上传成功');
this.$refs.brandForm.clearValidate('brand_business_auth'); this.$refs.brandForm.clearValidate('brand_business_auth');
} }
......
...@@ -743,10 +743,10 @@ ...@@ -743,10 +743,10 @@
this.getBase64(param.file).then((res) => { this.getBase64(param.file).then((res) => {
let result = res.split(","); let result = res.split(",");
this.Base64img = result[1]; this.Base64img = result[1];
let data = {"image":this.Base64img}; let data = {"img_data":this.Base64img};
upLoadImg(data).then((res) => { upLoadImg(data).then((res) => {
if(res && res.data.code == 1){ if(res && res.code == 1){
this.logoImgFileList.push({'url':res.data.data.imageUrl}); this.logoImgFileList.push({'url':res.data.image_url});
this.$message('上传成功'); this.$message('上传成功');
this.$refs.storeForm.clearValidate('shop_logo'); this.$refs.storeForm.clearValidate('shop_logo');
} }
...@@ -758,10 +758,10 @@ ...@@ -758,10 +758,10 @@
this.getBase64(param.file).then((res) => { this.getBase64(param.file).then((res) => {
let result = res.split(","); let result = res.split(",");
this.Base64img = result[1]; this.Base64img = result[1];
let data = {"image":this.Base64img}; let data = {"img_data":this.Base64img};
upLoadImg(data).then((res) => { upLoadImg(data).then((res) => {
if(res && res.data.code == 1){ if(res && res.code == 1){
this.businessImgFileList.push({'url':res.data.data.imageUrl}); this.businessImgFileList.push({'url':res.data.image_url});
this.$message('上传成功'); this.$message('上传成功');
this.$refs.storeForm.clearValidate('business_auth'); this.$refs.storeForm.clearValidate('business_auth');
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论