14
14
<h3 >{{ $t("message.gallery_empty") }}</h3 >
15
15
</template >
16
16
<template v-else >
17
- <v-card >
18
- <v-container grid-list-sm fluid >
19
- <v-layout row wrap >
20
- <v-flex v-for =" n in photos.length" :key =" n" xs3 d-flex >
21
- <v-card text tile class =" d-flex" >
22
- <v-layout column >
23
- <div class =" subheading" >{{ photos[n-1].name }} <v-btn
24
- v-on:click =" deletePhoto(photos[n-1].name)" text icon color =" red lighten-2" >
25
- <v-icon >delete</v-icon >
26
- </v-btn >
27
- </div >
28
- <a :href =" CBv1+'/photos/'+photos[n-1].name" target =" _blank" >
29
- <v-img :src =" CBv1+'/photos/'+photos[n-1].name" aspect-ratio =" 1" class =" grey lighten-2" >
30
- <v-layout slot =" placeholder" fill-height align-center justify-center ma-0 >
31
- <v-progress-circular indeterminate color =" grey lighten-5" ></v-progress-circular >
32
- </v-layout >
33
- </v-img >
34
- </a >
17
+ <v-container grid-list-sm fluid >
18
+ <v-layout row wrap >
19
+ <v-flex v-for =" n in photos.length" :key =" n" xs3 d-flex >
20
+ <v-card
21
+ class =" mx-auto my-12"
22
+ max-width =" 256"
23
+ >
24
+ <a class =" text-decoration-none" @click =" photo=photos[n-1]; gallery_detail=true" >
25
+ <v-img v-if =" photos[n-1].type=='jpg'" :src =" CBv1+'/photos/'+photos[n-1].thumbName" class =" grey lighten-2" >
26
+ <v-layout slot =" placeholder" fill-height align-center justify-center ma-2 >
27
+ <v-progress-circular indeterminate color =" grey lighten-5" ></v-progress-circular >
35
28
</v-layout >
36
- </v-card >
37
- </v-flex >
38
- </v-layout >
39
- </v-container >
40
- </v-card >
29
+ </v-img >
30
+ <v-img v-else-if =" photos[n-1].type=='mp4'" :src =" CBv1+'/photos/'+photos[n-1].thumbName" class =" grey lighten-2" >
31
+ <v-layout slot =" placeholder" fill-height align-center justify-center ma-0 >
32
+ <v-progress-circular indeterminate color =" grey lighten-5" ></v-progress-circular >
33
+ </v-layout >
34
+ </v-img >
35
+ <v-card-title class =" subheading" >
36
+ {{ photos[n-1].name }}
37
+ </v-card-title >
38
+ </a >
39
+ <v-card-actions >
40
+ <v-btn
41
+ v-on:click =" deletePhoto(photos[n-1].fileName)" text icon color =" red lighten-2" >
42
+ <v-icon >delete</v-icon >
43
+ </v-btn >
44
+ </v-card-actions >
45
+ </v-card >
46
+ </v-flex >
47
+ </v-layout >
48
+ </v-container >
49
+ <v-dialog v-model =" gallery_detail" >
50
+ <v-card class =" mx-auto my-12" max-width =" 640" >
51
+ <v-card-title class =" text-h5 grey lighten-2" >
52
+ {{ photo.name }}
53
+ </v-card-title >
54
+ <v-img v-if =" photo.type=='jpg'" :src =" CBv1+'/photos/'+photo.fileName" aspect-ratio =" 1" class =" grey lighten-2" >
55
+ <v-layout slot =" placeholder" fill-height align-center justify-center ma-0 >
56
+ <v-progress-circular indeterminate color =" grey lighten-5" ></v-progress-circular >
57
+ </v-layout >
58
+ </v-img >
59
+ <video v-else-if =" photo.type=='mp4'" controls autoplay :src =" CBv1+'/photos/'+photo.fileName" />
60
+ <v-card-actions >
61
+ <v-spacer ></v-spacer >
62
+ <v-btn
63
+ color =" primary"
64
+ text
65
+ @click =" gallery_detail = false"
66
+ >
67
+ {{ $t("message.close") }}
68
+ </v-btn >
69
+ </v-card-actions >
70
+ </v-card >
71
+ </v-dialog >
41
72
</template >
42
73
</v-flex >
43
74
</v-layout >
@@ -62,9 +93,20 @@ export default {
62
93
const {
63
94
CBv1
64
95
} = this ;
96
+ this .photos = [];
65
97
axios .get (` ${ CBv1} /photos` )
66
98
.then ((response ) => {
67
- this .photos = response .data ;
99
+ response .data .forEach ((element ) => {
100
+ this .photos .push (
101
+ {
102
+ name: element .name .substring (0 , element .name .indexOf (' .' )),
103
+ type: element .name .substring (element .name .indexOf (' .' ) + 1 ),
104
+ thumbName: ` ${ element .name .substring (0 , element .name .indexOf (' .' ))} _thumb.jpg` ,
105
+ fileName: element .name
106
+ }
107
+ );
108
+ });
109
+ this .photo = {};
68
110
});
69
111
},
70
112
deletePhoto (name ) {
@@ -89,8 +131,13 @@ export default {
89
131
photos: [],
90
132
drawer: null ,
91
133
l: null ,
134
+ photo: null ,
135
+ gallery_detail: null
92
136
};
93
137
},
138
+ computed: {
139
+
140
+ }
94
141
};
95
142
</script >
96
143
<style scoped>
0 commit comments