Authored by htoooth

fix

... ... @@ -50,7 +50,7 @@ export default {
'defaultFile': {
type: String
},
bucket: {
'bucket': {
type: String,
default() {
return 'goodsimg';
... ...
... ... @@ -14,6 +14,7 @@
<div class="upload-item">
<div class="upload-item-img">
<drag-file-upload
:bucket="bucket"
:default-file="shopData.shopLogo"
@on-success="uploadImageSuccess"
@on-remove="uploadImageRemove">
... ... @@ -76,7 +77,8 @@
align: 'center'
}
],
tableData: []
tableData: [],
bucket: 'yhb-img01'
};
},
methods: {
... ...
... ... @@ -29,7 +29,7 @@ let domainApis = {
getProduct: '/SellerProductController/getProduct',
getShopDetailById: '/SellerShopController/getShopDetailById',
updateShopBaseInfoById: '/SellerShopController/updateShopBaseInfoById',
upload: '/fileupload/upload'
uploads: '/fileupload/uploads'
},
shop: {
login: '/login'
... ...
... ... @@ -48,13 +48,12 @@ class FileController extends Context {
});
}
let fileData = {
fileData: req.body.files
};
if (req.body.bucket) {
fileData.project = req.body.bucket;
this.api.upload("http://upload.static.yohobuy.com", fileData).then(result => {
if (req.body.bucket === 'goodsimg') {
this.api.upload("http://upload.static.yohobuy.com", {
fileData: req.body.files,
project: req.body.bucket
}).then(result => {
if (result.code === 200 && _.get(result, 'data.imagesList.length', 0)) {
result.data.imagesList = _.map(result.data.imagesList, imgUrl => {
return this.fileService.getAbsoluteUrl(imgUrl, req.body.bucket);
... ... @@ -63,11 +62,20 @@ class FileController extends Context {
res.json(result);
}).catch(next);
} else {
this.api.upload(apiDomain.platform.upload, fileData).then(result => {
this.api.upload(apiDomain.platform.uploads, {
files: req.body.files,
bucket: req.body.bucket
}).then(result => {
let newResult = {
code: result.code,
data: {},
message: result.message
};
if (result.code === 200) {
result.data.imagesList = [result.data];
newResult.data.imagesList = [result.data[0]];
}
res.json(result);
res.json(newResult);
}).catch(next);
}
}
... ...