Authored by htoooth

fix

@@ -50,7 +50,7 @@ export default { @@ -50,7 +50,7 @@ export default {
50 'defaultFile': { 50 'defaultFile': {
51 type: String 51 type: String
52 }, 52 },
53 - bucket: { 53 + 'bucket': {
54 type: String, 54 type: String,
55 default() { 55 default() {
56 return 'goodsimg'; 56 return 'goodsimg';
@@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
14 <div class="upload-item"> 14 <div class="upload-item">
15 <div class="upload-item-img"> 15 <div class="upload-item-img">
16 <drag-file-upload 16 <drag-file-upload
  17 + :bucket="bucket"
17 :default-file="shopData.shopLogo" 18 :default-file="shopData.shopLogo"
18 @on-success="uploadImageSuccess" 19 @on-success="uploadImageSuccess"
19 @on-remove="uploadImageRemove"> 20 @on-remove="uploadImageRemove">
@@ -76,7 +77,8 @@ @@ -76,7 +77,8 @@
76 align: 'center' 77 align: 'center'
77 } 78 }
78 ], 79 ],
79 - tableData: [] 80 + tableData: [],
  81 + bucket: 'yhb-img01'
80 }; 82 };
81 }, 83 },
82 methods: { 84 methods: {
@@ -29,7 +29,7 @@ let domainApis = { @@ -29,7 +29,7 @@ let domainApis = {
29 getProduct: '/SellerProductController/getProduct', 29 getProduct: '/SellerProductController/getProduct',
30 getShopDetailById: '/SellerShopController/getShopDetailById', 30 getShopDetailById: '/SellerShopController/getShopDetailById',
31 updateShopBaseInfoById: '/SellerShopController/updateShopBaseInfoById', 31 updateShopBaseInfoById: '/SellerShopController/updateShopBaseInfoById',
32 - upload: '/fileupload/upload' 32 + uploads: '/fileupload/uploads'
33 }, 33 },
34 shop: { 34 shop: {
35 login: '/login' 35 login: '/login'
@@ -48,13 +48,12 @@ class FileController extends Context { @@ -48,13 +48,12 @@ class FileController extends Context {
48 }); 48 });
49 } 49 }
50 50
51 - let fileData = {  
52 - fileData: req.body.files  
53 - };  
54 51
55 - if (req.body.bucket) {  
56 - fileData.project = req.body.bucket;  
57 - this.api.upload("http://upload.static.yohobuy.com", fileData).then(result => { 52 + if (req.body.bucket === 'goodsimg') {
  53 + this.api.upload("http://upload.static.yohobuy.com", {
  54 + fileData: req.body.files,
  55 + project: req.body.bucket
  56 + }).then(result => {
58 if (result.code === 200 && _.get(result, 'data.imagesList.length', 0)) { 57 if (result.code === 200 && _.get(result, 'data.imagesList.length', 0)) {
59 result.data.imagesList = _.map(result.data.imagesList, imgUrl => { 58 result.data.imagesList = _.map(result.data.imagesList, imgUrl => {
60 return this.fileService.getAbsoluteUrl(imgUrl, req.body.bucket); 59 return this.fileService.getAbsoluteUrl(imgUrl, req.body.bucket);
@@ -63,11 +62,20 @@ class FileController extends Context { @@ -63,11 +62,20 @@ class FileController extends Context {
63 res.json(result); 62 res.json(result);
64 }).catch(next); 63 }).catch(next);
65 } else { 64 } else {
66 - this.api.upload(apiDomain.platform.upload, fileData).then(result => { 65 + this.api.upload(apiDomain.platform.uploads, {
  66 + files: req.body.files,
  67 + bucket: req.body.bucket
  68 + }).then(result => {
  69 + let newResult = {
  70 + code: result.code,
  71 + data: {},
  72 + message: result.message
  73 + };
  74 +
67 if (result.code === 200) { 75 if (result.code === 200) {
68 - result.data.imagesList = [result.data]; 76 + newResult.data.imagesList = [result.data[0]];
69 } 77 }
70 - res.json(result); 78 + res.json(newResult);
71 }).catch(next); 79 }).catch(next);
72 } 80 }
73 } 81 }