zmena implementacie suborov, ukladanie na filesystem a nie do DB

This commit is contained in:
2025-05-17 15:06:04 +02:00
parent d6be781024
commit c7dcdf228e
3 changed files with 109 additions and 19 deletions

View File

@ -84,7 +84,9 @@
v-else-if="attachment.attachment_type == 'file'"
class="attachment-file"
>
<img :src="attachment.attachment_content" />
<a :href="attachment.attachment_content" target="_blank">Stiahnut {{ attachment.attachment_content.split('/').pop().split('?')[0].split('#')[0] }}</a>
<br>
<img :src="attachment.attachment_content" v-if="isImageUrl(attachment.attachment_content)" />
</div>
<div v-else class="attachment-content">
Neznamy typ prilohy: <strong>{{ attachment.attachment_type }}</strong>
@ -222,7 +224,10 @@ export default {
this.loading = true;
for (let i = 0; i < this.selectedFiles.length; i++) {
backend
.attachmentAdd(this.report_id, "file", this.selectedFilesContent[i])
.attachmentAdd(this.report_id, "file", {
'filename': this.selectedFiles[i].name,
'base64': this.selectedFilesContent[i]
})
.then(() => {
for_upload--;
if (for_upload == 0) {
@ -279,6 +284,9 @@ export default {
return (size / (1024 * 1024)).toFixed(2) + " MB";
}
},
isImageUrl(url) {
return /\.(jpg|jpeg|png|gif|svg|webp)$/.test(url);
}
},
};
</script>