storage url o'zgartirildi
This commit is contained in:
@@ -309,7 +309,6 @@
|
||||
<input
|
||||
class="form-control"
|
||||
@change="posterFile($event)"
|
||||
onchange="PreviewImage();"
|
||||
type="file"
|
||||
id="poster"
|
||||
/>
|
||||
@@ -670,6 +669,7 @@
|
||||
:theme="'default'"
|
||||
:multiple="true"
|
||||
:deletable="true"
|
||||
:linkable="true"
|
||||
:meta="true"
|
||||
:accept="'image/*'"
|
||||
:maxSize="'10MB'"
|
||||
@@ -679,10 +679,13 @@
|
||||
type: 'Invalid file type. Only images or zip Allowed',
|
||||
size: 'Files should not exceed 10MB in size',
|
||||
}"
|
||||
@select="
|
||||
filesSelected($event, index)
|
||||
"
|
||||
@beforedelete="
|
||||
onBeforeDelete(
|
||||
$event,
|
||||
index
|
||||
)
|
||||
"
|
||||
@delete="
|
||||
fileDeleted($event, index)
|
||||
"
|
||||
v-model="color.screens"
|
||||
@@ -1352,18 +1355,6 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.products.childrens[i].filesDataForUpload) {
|
||||
for (
|
||||
let f = 0;
|
||||
f < this.products.childrens[i].filesDataForUpload.length;
|
||||
f++
|
||||
) {
|
||||
formData.append(
|
||||
"colors[" + i + "][screens][new_" + f + "][image]",
|
||||
this.products.childrens[i].filesDataForUpload[f].file
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.deletes.childrens.length; i++) {
|
||||
@@ -1394,7 +1385,12 @@ export default {
|
||||
.catch((error) => {
|
||||
if (error.response) {
|
||||
this.error = true;
|
||||
this.errors = error.response.data.errors;
|
||||
this.errors = error.response.data.errors || {
|
||||
product: [
|
||||
error.response.data.messages ||
|
||||
"Ошибка при сохранении",
|
||||
],
|
||||
};
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -1488,26 +1484,19 @@ export default {
|
||||
this.products.childrens[index].sizes.splice(indexx, 1);
|
||||
},
|
||||
|
||||
filesSelected: function (filesDataNewlySelected, index) {
|
||||
let validFilesData = filesDataNewlySelected.filter(
|
||||
(fileData) => !fileData.error
|
||||
);
|
||||
this.products.childrens[index].filesDataForUpload =
|
||||
this.products.childrens[index].filesDataForUpload.concat(
|
||||
validFilesData
|
||||
);
|
||||
onBeforeDelete: function (fileData, index) {
|
||||
const agent = Array.isArray(this.$refs.vueFileAgent)
|
||||
? this.$refs.vueFileAgent[index]
|
||||
: this.$refs.vueFileAgent;
|
||||
|
||||
if (agent) {
|
||||
agent.deleteFileRecord(fileData);
|
||||
}
|
||||
},
|
||||
|
||||
fileDeleted: function (fileData, index) {
|
||||
let i = this.products.childrens[index].screens.indexOf(fileData);
|
||||
|
||||
if (i !== -1) {
|
||||
this.products.childrens[index].screens.splice(i, 1);
|
||||
let id = fileData.id ? fileData.id : null;
|
||||
|
||||
if (fileData.id) {
|
||||
this.deletes.screens.push(id);
|
||||
}
|
||||
fileDeleted: function (fileData) {
|
||||
if (fileData.id && !this.deletes.screens.includes(fileData.id)) {
|
||||
this.deletes.screens.push(fileData.id);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user