2024-08-11 14:17:22 +00:00
|
|
|
<template>
|
|
|
|
<v-container fluid>
|
|
|
|
<div class="mt-3 mb-6.5 mx-[3.5ch] text-center">
|
|
|
|
<h1 class="text-2xl">Gallery</h1>
|
|
|
|
<span>Explore files that uploaded by Solar Network users.</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="album">
|
2024-08-11 15:49:15 +00:00
|
|
|
<v-card v-for="item in items" class="album-item mb-3" :to="`/gallery/${item.id}`">
|
|
|
|
<attachment-renderer :item="item" />
|
2024-08-11 14:17:22 +00:00
|
|
|
</v-card>
|
|
|
|
|
|
|
|
<div class="flex p-5 justify-center items-center">
|
|
|
|
<v-btn variant="outlined" text="Load more" :loading="loading" @click="load" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</v-container>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2024-08-11 14:26:29 +00:00
|
|
|
useHead({
|
|
|
|
title: 'Gallery',
|
|
|
|
})
|
|
|
|
|
2024-08-11 14:17:22 +00:00
|
|
|
const config = useRuntimeConfig()
|
|
|
|
|
|
|
|
const items = ref<any[]>([])
|
|
|
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
|
|
|
async function load() {
|
|
|
|
loading.value = true
|
|
|
|
|
|
|
|
const res = await fetch(`${config.public.solarNetworkApi}/cgi/files/attachments?take=20&offset=${items.value.length}&original=true`)
|
|
|
|
const result = await res.json()
|
|
|
|
|
|
|
|
items.value.push(...result.data)
|
|
|
|
|
|
|
|
loading.value = false
|
|
|
|
}
|
|
|
|
|
|
|
|
function getAttachmentUrl(id: number) {
|
|
|
|
return `${config.public.solarNetworkApi}/cgi/files/attachments/${id}`
|
|
|
|
}
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
load()
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.album {
|
|
|
|
columns: 20rem;
|
|
|
|
column-gap: 1rem;
|
|
|
|
}
|
|
|
|
</style>
|