|
| 1 | +<template lang="pug"> |
| 2 | +v-card.printing-card.fill-height.d-flex.flex-column(v-box-shadow='6') |
| 3 | + v-lazy |
| 4 | + v-img.rounded-t( |
| 5 | + :src='`/src/nuxt-app/printing/${item.slug}/${item.cover}`', |
| 6 | + :alt='titleLocale(item).title', |
| 7 | + contain |
| 8 | + ) |
| 9 | + |
| 10 | + .grow |
| 11 | + v-card-title {{ titleLocale(item).title }} |
| 12 | + v-card-subtitle {{ formatDate(item.date) }} |
| 13 | + v-card-text(v-if='titleLocale(item).desc') {{ titleLocale(item).desc }} |
| 14 | + |
| 15 | + // ANCHOR process |
| 16 | + v-expansion-panels(flat, tile, accordion) |
| 17 | + v-expansion-panel.transparent(v-if='imgContent.length') |
| 18 | + v-expansion-panel-header.px-4 |
| 19 | + v-card-subtitle.pa-0.caption {{ $tc('process', 1) + ' + ' + $tc('result', 1).toLowerCase() }} |
| 20 | + v-icon(right, small) {{ mdiSwapHorizontal }} |
| 21 | + v-expansion-panel-content.px-0 |
| 22 | + v-slide-group.px-4(:show-arrows='!$vuetify.breakpoint.xs') |
| 23 | + v-slide-item(v-for='(p, i) in imgContent', :key='i') |
| 24 | + v-dialog(max-width='80vw', content-class='overflow-hidden') |
| 25 | + template(#activator='{ on: openImg }') |
| 26 | + v-sheet.d-flex.flex-column.mx-2.text-center.pa-2.cursor-pointer( |
| 27 | + outlined, |
| 28 | + rounded |
| 29 | + ) |
| 30 | + v-img.mb-1.grow( |
| 31 | + :src='p.src', |
| 32 | + contain, |
| 33 | + max-width='200', |
| 34 | + v-on='openImg' |
| 35 | + ) |
| 36 | + i.text-caption {{ p.caption }} |
| 37 | + v-sheet |
| 38 | + v-lazy |
| 39 | + v-img(:src='p.src', contain) |
| 40 | +</template> |
| 41 | + |
| 42 | +<script> |
| 43 | +import { mdiSwapHorizontal } from '@mdi/js' |
| 44 | +
|
| 45 | +export default { |
| 46 | + name: 'PrintingCard', |
| 47 | + props: { |
| 48 | + item: { |
| 49 | + type: Object, |
| 50 | + default: () => ({}), |
| 51 | + }, |
| 52 | + }, |
| 53 | + data: () => ({ |
| 54 | + mdiSwapHorizontal, |
| 55 | + }), |
| 56 | + computed: { |
| 57 | + imgContent() { |
| 58 | + const path = '/src/nuxt-app/printing' |
| 59 | + const p = this.item.folders.process || [] |
| 60 | + const r = this.item.folders.result || [] |
| 61 | +
|
| 62 | + const process = () => { |
| 63 | + return p?.map((e) => { |
| 64 | + return { |
| 65 | + src: `${path}/${this.item.slug}/process/${e}`, |
| 66 | + caption: e.split('.')[0], |
| 67 | + } |
| 68 | + }) |
| 69 | + } |
| 70 | +
|
| 71 | + const result = () => { |
| 72 | + return r?.map((e) => { |
| 73 | + return { |
| 74 | + src: `${path}/${this.item.slug}/result/${e}`, |
| 75 | + caption: e.split('.')[0], |
| 76 | + } |
| 77 | + }) |
| 78 | + } |
| 79 | +
|
| 80 | + return process().concat(result()) || [] |
| 81 | + }, |
| 82 | + }, |
| 83 | + methods: { |
| 84 | + titleLocale(item) { |
| 85 | + if (this.$i18n.locale === 'ru') { |
| 86 | + return { |
| 87 | + title: item.titleRu, |
| 88 | + desc: item.descRu, |
| 89 | + } |
| 90 | + } else if (this.$i18n.locale === 'en') { |
| 91 | + return { |
| 92 | + title: item.titleEn, |
| 93 | + desc: item.descEn, |
| 94 | + } |
| 95 | + } |
| 96 | + }, |
| 97 | + formatDate(date) { |
| 98 | + const options = { year: 'numeric', month: 'long', day: 'numeric' } |
| 99 | + return new Date(date).toLocaleDateString(`${this.$i18n.locale}`, options) |
| 100 | + }, |
| 101 | + }, |
| 102 | +} |
| 103 | +</script> |
| 104 | +
|
| 105 | +<style lang="sass"> |
| 106 | +.printing-card |
| 107 | + .v-slide-group |
| 108 | + &__next, |
| 109 | + &__prev |
| 110 | + min-width: 1.5rem |
| 111 | +
|
| 112 | + &:hover |
| 113 | + background-color: rgb(0 0 0 / 12%) |
| 114 | +
|
| 115 | + .v-expansion-panel-content |
| 116 | + &.px-0 |
| 117 | + .v-expansion-panel-content |
| 118 | + &__wrap |
| 119 | + padding-inline: 0 |
| 120 | +</style> |
0 commit comments