@lancom/shared 0.0.461 → 0.0.462
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/assets/js/api/admin.js
CHANGED
|
@@ -329,6 +329,9 @@ export default {
|
|
|
329
329
|
importProductImagesJson(productId, images) {
|
|
330
330
|
return _post(`admin/products/${productId}/import-images-json`, { images });
|
|
331
331
|
},
|
|
332
|
+
importProductDocumentsJson(productId, documents) {
|
|
333
|
+
return _post(`admin/products/${productId}/import-documents-json`, { documents });
|
|
334
|
+
},
|
|
332
335
|
fetchProductsKits(params) {
|
|
333
336
|
return _get('admin/products-kit', params);
|
|
334
337
|
},
|
package/assets/js/api/index.js
CHANGED
|
@@ -178,6 +178,16 @@ const api = {
|
|
|
178
178
|
}
|
|
179
179
|
return _post(requestUrl, formData, config);
|
|
180
180
|
},
|
|
181
|
+
uploadFile(file, progressCallback = Function.prototype, requestUrl = 'file/upload') {
|
|
182
|
+
const config = {
|
|
183
|
+
onUploadProgress: ({ loaded, total }) => {
|
|
184
|
+
progressCallback(Math.round((loaded * 100) / total));
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
const formData = new FormData();
|
|
188
|
+
formData.set('file', file);
|
|
189
|
+
return _post(requestUrl, formData, config);
|
|
190
|
+
},
|
|
181
191
|
sendFailedConversionFile(data, shop) {
|
|
182
192
|
return _post(`shop/${shop}/image/send-failed-conversion`, data);
|
|
183
193
|
},
|
|
@@ -54,6 +54,7 @@ export default {
|
|
|
54
54
|
hasUploadLink: { type: Boolean, default: false },
|
|
55
55
|
hasConversionErrorModal: { type: Boolean, default: true },
|
|
56
56
|
showErrorMessage: { type: Boolean, default: true },
|
|
57
|
+
checkStaticUrl: { type: Boolean, default: true },
|
|
57
58
|
url: { type: String },
|
|
58
59
|
accept: { type: String, default: 'all' }
|
|
59
60
|
},
|
|
@@ -116,7 +117,7 @@ export default {
|
|
|
116
117
|
try {
|
|
117
118
|
const image = await api.uploadImage(this.file, this.onProgress, this.url, this.convert);
|
|
118
119
|
this.onProgress(0);
|
|
119
|
-
const url = image && staticLink(image.thumb || image.origin);
|
|
120
|
+
const url = this.checkStaticUrl ? (image && staticLink(image.thumb || image.origin)) : image?.url;
|
|
120
121
|
this.$emit('onuploaded', { ...image, url });
|
|
121
122
|
} catch (e) {
|
|
122
123
|
console.dir(e);
|