👽 Update to use new attachment id

This commit is contained in:
LittleSheep 2024-08-18 23:20:01 +08:00
parent ceca94c712
commit 6aadffb72b
4 changed files with 7 additions and 11 deletions

View File

@ -8,7 +8,7 @@
> >
<v-carousel-item v-for="item in metadata" class="fill-height"> <v-carousel-item v-for="item in metadata" class="fill-height">
<nuxt-link v-if="item.mimetype.split('/')[0] == 'image' && !props.noClickableAttachment" <nuxt-link v-if="item.mimetype.split('/')[0] == 'image' && !props.noClickableAttachment"
:to="`/gallery/${item.id}`"> :to="`/gallery/${item.rid}`">
<attachment-renderer :item="item" /> <attachment-renderer :item="item" />
</nuxt-link> </nuxt-link>
<div v-else> <div v-else>
@ -19,7 +19,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps<{ attachments: number[], noClickableAttachment?: boolean }>() const props = defineProps<{ attachments: string[], noClickableAttachment?: boolean }>()
const emits = defineEmits(["update:metadata"]) const emits = defineEmits(["update:metadata"])
const config = useRuntimeConfig() const config = useRuntimeConfig()
@ -30,8 +30,4 @@ const metadata = computed(() => data.value.data)
watch(metadata, (value) => { watch(metadata, (value) => {
emits("update:metadata", value) emits("update:metadata", value)
}, { deep: true, immediate: true }) }, { deep: true, immediate: true })
function getAttachmentUrl(id: number) {
return `${config.public.solarNetworkApi}/cgi/uc/attachments/${id}`
}
</script> </script>

View File

@ -17,9 +17,9 @@
</v-col> </v-col>
</v-row> </v-row>
</v-sheet> </v-sheet>
<v-img v-else-if="item.mimetype.split('/')[0] == 'image'" :src="getAttachmentUrl(item.id)" :alt="item.alt" <v-img v-else-if="item.mimetype.split('/')[0] == 'image'" :src="getAttachmentUrl(item.rid)" :alt="item.alt"
class="w-full h-full" cover /> class="w-full h-full" cover />
<video v-else-if="item.mimetype.split('/')[0] == 'video'" :src="getAttachmentUrl(item.id)" class="w-full h-full" <video v-else-if="item.mimetype.split('/')[0] == 'video'" :src="getAttachmentUrl(item.rid)" class="w-full h-full"
controls @click.stop /> controls @click.stop />
<v-sheet v-else color="rgba(0, 0, 0, .4)" height="calc(100% + 24px)" class="p-5"> <v-sheet v-else color="rgba(0, 0, 0, .4)" height="calc(100% + 24px)" class="p-5">
<v-row class="fill-height" align="center" justify="center"> <v-row class="fill-height" align="center" justify="center">
@ -55,7 +55,7 @@ const item = computed(() => props.item)
const showMature = ref(false) const showMature = ref(false)
function getAttachmentUrl(id: number) { function getAttachmentUrl(id: string) {
return `${config.public.solarNetworkApi}/cgi/uc/attachments/${id}` return `${config.public.solarNetworkApi}/cgi/uc/attachments/${id}`
} }
</script> </script>

View File

@ -6,7 +6,7 @@
</div> </div>
<div class="album"> <div class="album">
<v-card v-for="item in items" class="album-item mb-3" :to="`/gallery/${item.id}`"> <v-card v-for="item in items" class="album-item mb-3" :to="`/gallery/${item.rid}`">
<attachment-renderer :item="item" /> <attachment-renderer :item="item" />
</v-card> </v-card>

View File

@ -6,7 +6,7 @@
</div> </div>
<div class="album"> <div class="album">
<v-card v-for="item in items" class="album-item mb-3" :to="`/gallery/${item.id}`"> <v-card v-for="item in items" class="album-item mb-3" :to="`/gallery/${item.rid}`">
<attachment-renderer :item="item" /> <attachment-renderer :item="item" />
</v-card> </v-card>