@7365admin1/layer-common 3.1.3-staging.41 → 3.1.3-staging.42
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.
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
<v-list-item class="cursor-pointer" @click="openMediaViewer(item._id, item.mimeType)">
|
|
49
49
|
<template #prepend>
|
|
50
50
|
<v-avatar size="36" rounded="sm" class="mr-3">
|
|
51
|
-
<v-img :src="
|
|
51
|
+
<v-img :src="imageCover(item._id)" cover>
|
|
52
52
|
<template #error>
|
|
53
53
|
<v-icon color="green" size="20">mdi-image</v-icon>
|
|
54
54
|
</template>
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
</v-row>
|
|
98
98
|
|
|
99
99
|
<!-- Media Carousel (images + videos) -->
|
|
100
|
-
<ImageCarousel v-model="showCarousel" :active-file-id="activeFileId" :files="carouselFiles" />
|
|
100
|
+
<ImageCarousel v-model="showCarousel" :active-file-id="activeFileId" :files="carouselFiles" :anpr="anpr" :site="site" />
|
|
101
101
|
|
|
102
102
|
<!-- Document Viewer -->
|
|
103
103
|
<DocumentViewer v-model="showDocumentViewer" :file-id="activeFileId" :file-name="activeFileName"
|
|
@@ -123,10 +123,18 @@ const props = defineProps({
|
|
|
123
123
|
showFileTypeTitle: {
|
|
124
124
|
type: Boolean,
|
|
125
125
|
default: false,
|
|
126
|
+
},
|
|
127
|
+
anpr: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: false
|
|
130
|
+
},
|
|
131
|
+
site: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: ""
|
|
126
134
|
}
|
|
127
135
|
});
|
|
128
136
|
|
|
129
|
-
const { getFileUrl, urlToFile, getFileById } = useFile();
|
|
137
|
+
const { getFileUrl, urlToFile, getFileById, getFileUrlAnpr } = useFile();
|
|
130
138
|
|
|
131
139
|
const rawFileArray = ref<{ file: File, _id: string, preview: boolean, mimeType: string }[]>([]);
|
|
132
140
|
const loading = ref(true);
|
|
@@ -159,6 +167,12 @@ function openDocumentViewer(id: string, name: string, mimeType: string) {
|
|
|
159
167
|
showDocumentViewer.value = true;
|
|
160
168
|
}
|
|
161
169
|
|
|
170
|
+
const imageCover = (id: string) => {
|
|
171
|
+
if(props.anpr && props.site){
|
|
172
|
+
return getFileUrlAnpr(`${props.site}/${id}`)
|
|
173
|
+
} else return getFileUrl(id)
|
|
174
|
+
}
|
|
175
|
+
|
|
162
176
|
function getFileIcon(mimeType: string): string {
|
|
163
177
|
if (mimeType.startsWith('image/')) return 'mdi-image';
|
|
164
178
|
if (mimeType.startsWith('video/')) return 'mdi-video';
|
|
@@ -206,7 +220,11 @@ watchEffect(async () => {
|
|
|
206
220
|
|
|
207
221
|
try {
|
|
208
222
|
// Try to get the actual file with proper MIME type detection from blob
|
|
209
|
-
const fileUrl = getFileUrl(item.id);
|
|
223
|
+
// const fileUrl = getFileUrl(item.id);
|
|
224
|
+
let fileUrl = ""
|
|
225
|
+
if(props.anpr && props.site){
|
|
226
|
+
fileUrl = getFileUrlAnpr(`${props.site}/${item.id}`)
|
|
227
|
+
} else fileUrl = getFileUrl(item.id);
|
|
210
228
|
file = await urlToFile(fileUrl, item.name);
|
|
211
229
|
mimeType = file.type || 'application/octet-stream';
|
|
212
230
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<template v-if="fileTypes?.[x] === 'image'">
|
|
8
8
|
<v-carousel-item height="100%" width="100%" rounded="lg">
|
|
9
9
|
<v-row no-gutters class="w-100 h-100" align="center">
|
|
10
|
-
<v-img :lazy-src="
|
|
10
|
+
<v-img :lazy-src="getFinalUrl(x)" :src="getFinalUrl(x)" width="70%" height="70%"
|
|
11
11
|
:alt="'Image Viewer Card -' + index"></v-img>
|
|
12
12
|
</v-row>
|
|
13
13
|
<template v-slot:placeholder>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<v-carousel-item>
|
|
22
22
|
<v-row no-gutters class="h-100 w-100" align="center" justify="center">
|
|
23
23
|
<video width="80%" height="80%" controls>
|
|
24
|
-
<source :src="
|
|
24
|
+
<source :src="getFinalUrl(x)" />
|
|
25
25
|
</video>
|
|
26
26
|
</v-row>
|
|
27
27
|
<template v-slot:placeholder>
|
|
@@ -78,11 +78,19 @@ const props = defineProps({
|
|
|
78
78
|
files: {
|
|
79
79
|
type: Array as PropType<string[]>,
|
|
80
80
|
default: []
|
|
81
|
+
},
|
|
82
|
+
site: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: ""
|
|
85
|
+
},
|
|
86
|
+
anpr: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: false
|
|
81
89
|
}
|
|
82
90
|
});
|
|
83
91
|
|
|
84
92
|
|
|
85
|
-
const { getFileUrl, urlToFile } = useFile()
|
|
93
|
+
const { getFileUrl, urlToFile, getFileUrlAnpr } = useFile()
|
|
86
94
|
const overlay = defineModel({ required: true, default: false });
|
|
87
95
|
const activeIndex = ref(0);
|
|
88
96
|
const fileTypes = ref<Record<string, "image" | "video" | "other">>({});
|
|
@@ -107,10 +115,13 @@ async function resolveFileTypes() {
|
|
|
107
115
|
|
|
108
116
|
for (const x of props.files) {
|
|
109
117
|
try {
|
|
110
|
-
|
|
118
|
+
let url = ""
|
|
119
|
+
if (props.anpr && props.site) {
|
|
120
|
+
url = getFileUrlAnpr(`${props.site}/${x}`)
|
|
121
|
+
} else url = getFileUrl(x);
|
|
111
122
|
const file = await urlToFile(url, x);
|
|
112
123
|
const type = file?.type;
|
|
113
|
-
|
|
124
|
+
|
|
114
125
|
|
|
115
126
|
if (type?.startsWith("video")) fileTypes.value[x] = "video";
|
|
116
127
|
else if (type?.startsWith("image")) fileTypes.value[x] = "image";
|
|
@@ -129,6 +140,13 @@ watch(
|
|
|
129
140
|
);
|
|
130
141
|
|
|
131
142
|
|
|
143
|
+
const getFinalUrl = (id: string) => {
|
|
144
|
+
if (props.anpr && props.site) {
|
|
145
|
+
return getFileUrlAnpr(`${props.site}/${id}`)
|
|
146
|
+
} else return getFileUrl(id)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
132
150
|
</script>
|
|
133
151
|
|
|
134
152
|
<style scoped>
|
|
@@ -675,6 +675,24 @@
|
|
|
675
675
|
/>
|
|
676
676
|
</div>
|
|
677
677
|
</span>
|
|
678
|
+
<span
|
|
679
|
+
v-else-if="
|
|
680
|
+
key === 'snapshotEntryImage' || key === 'snapshotExitImage'
|
|
681
|
+
"
|
|
682
|
+
class="d-flex flex-column"
|
|
683
|
+
>
|
|
684
|
+
<strong class="w-full">{{ label }}:</strong>
|
|
685
|
+
<div class="d-flex flex-wrap ga-2">
|
|
686
|
+
<AttachmentsViewer
|
|
687
|
+
:files="
|
|
688
|
+
mappedSnapshots([selectedVisitorObject.snapshotEntryImage])
|
|
689
|
+
"
|
|
690
|
+
anpr
|
|
691
|
+
:site="siteId"
|
|
692
|
+
title="Snapshot"
|
|
693
|
+
/>
|
|
694
|
+
</div>
|
|
695
|
+
</span>
|
|
678
696
|
|
|
679
697
|
<span
|
|
680
698
|
v-else-if="selectedVisitorObject[key]"
|
|
@@ -1438,6 +1456,15 @@ function mappedAttachments(attachments: string[]) {
|
|
|
1438
1456
|
});
|
|
1439
1457
|
}
|
|
1440
1458
|
|
|
1459
|
+
function mappedSnapshots(attachments: string[]) {
|
|
1460
|
+
return attachments.map((x, index) => {
|
|
1461
|
+
return {
|
|
1462
|
+
id: x,
|
|
1463
|
+
name: `Snapshot - ${x}`,
|
|
1464
|
+
};
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1441
1468
|
function normalizeDateOnly(value: string) {
|
|
1442
1469
|
if (!value) return "";
|
|
1443
1470
|
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) return value;
|