183 lines
4.3 KiB
Vue
183 lines
4.3 KiB
Vue
<script setup>
|
|
import hadithaApi from "@haditha/apis/hadithaApi";
|
|
|
|
definePageMeta({
|
|
layout: false,
|
|
name: "hadithaLibrary",
|
|
});
|
|
useHead({
|
|
name: "hadithaLibrary",
|
|
title: `${import.meta.env.VITE_HADITH_PAGE_TITLE} | کتابخانه`,
|
|
meta: [
|
|
{ name: "description", content: "کاوش با هوش مصنوعی در احادیث اسلامی" },
|
|
{
|
|
name: "msapplication-TileImage",
|
|
content: "/img/haditha/fav-icons/ms-icon-144x144.png",
|
|
},
|
|
{ name: "theme-color", content: "#ffffff" },
|
|
],
|
|
bodyAttrs: {
|
|
class: import.meta.env.VITE_HADITH_SYSTEM,
|
|
},
|
|
link: [
|
|
{
|
|
rel: "icon",
|
|
type: "image/x-icon",
|
|
href: "/img/haditha/fav-icons/favicon.ico",
|
|
},
|
|
{ rel: "manifest", href: "/img/haditha/fav-icons/manifest.json" },
|
|
// rel: icon
|
|
{
|
|
rel: "icon",
|
|
type: "image/png",
|
|
sizes: "16x16",
|
|
href: "/img/haditha/fav-icons/favicon-16x16.png",
|
|
},
|
|
{
|
|
rel: "icon",
|
|
type: "image/png",
|
|
sizes: "32x32",
|
|
href: "/img/haditha/fav-icons/favicon-32x32.png",
|
|
},
|
|
{
|
|
rel: "icon",
|
|
type: "image/png",
|
|
sizes: "96x96",
|
|
href: "/img/haditha/fav-icons/favicon-96x96.png",
|
|
},
|
|
{
|
|
rel: "icon",
|
|
sizes: "192x192",
|
|
type: "image/png",
|
|
href: "/img/haditha/fav-icons/android-icon-192x192.png",
|
|
},
|
|
// rel: apple
|
|
{
|
|
rel: "apple-touch-icon",
|
|
sizes: "57x57",
|
|
href: "/img/haditha/fav-icons/apple-icon-57x57.png",
|
|
},
|
|
{
|
|
rel: "apple-touch-icon",
|
|
sizes: "60x60",
|
|
href: "/img/haditha/fav-icons/android-icon-60x60.png",
|
|
},
|
|
{
|
|
rel: "apple-touch-icon",
|
|
sizes: "72x72",
|
|
href: "/img/haditha/fav-icons/android-icon-72x72.png",
|
|
},
|
|
{
|
|
rel: "apple-touch-icon",
|
|
sizes: "76x76",
|
|
href: "/img/haditha/fav-icons/android-icon-76x76.png",
|
|
},
|
|
{
|
|
rel: "apple-touch-icon",
|
|
sizes: "114x114",
|
|
href: "/img/haditha/fav-icons/android-icon-114x114.png",
|
|
},
|
|
{
|
|
rel: "apple-touch-icon",
|
|
sizes: "120x120",
|
|
href: "/img/haditha/fav-icons/android-icon-120x120.png",
|
|
},
|
|
{
|
|
rel: "apple-touch-icon",
|
|
sizes: "144x144",
|
|
href: "/img/haditha/fav-icons/android-icon-144x144.png",
|
|
},
|
|
{
|
|
rel: "apple-touch-icon",
|
|
sizes: "152x152",
|
|
href: "/img/haditha/fav-icons/android-icon-152x152.png",
|
|
},
|
|
{
|
|
rel: "apple-touch-icon",
|
|
sizes: "180x180",
|
|
href: "/img/haditha/fav-icons/android-icon-180x180.png",
|
|
},
|
|
],
|
|
});
|
|
|
|
// #region refs
|
|
const loading = ref(false);
|
|
const httpService = useNuxtApp()["$http"];
|
|
|
|
// #endregion refs
|
|
|
|
// #region reactive
|
|
const state = reactive({
|
|
list: [],
|
|
counts: [],
|
|
totalCounts: [],
|
|
libraryList: new Array(20).fill(0),
|
|
});
|
|
// #endregion reactive
|
|
|
|
// #region methods
|
|
|
|
const getLibraryList = async (dataType = "bookmark") => {
|
|
if (loading.value) return;
|
|
|
|
loading.value = true;
|
|
|
|
let url = repoUrl() + hadithaApi.library.list;
|
|
url = url.replace("@field_collapsed", "normal");
|
|
url = url.replace("@offset", 0);
|
|
url = url.replace("@limit", 20);
|
|
url = url.replace("@q", "none");
|
|
|
|
return await httpService
|
|
.postRequest(url)
|
|
.then((res) => {
|
|
state.libraryList = res.hits.hits;
|
|
console.info(state.libraryList)
|
|
})
|
|
.catch((err) => {
|
|
console.info(err);
|
|
loading.value = false;
|
|
})
|
|
.finally(() => (loading.value = false));
|
|
};
|
|
// #endregion methods
|
|
|
|
// #region hooks
|
|
onMounted(() => {
|
|
getLibraryList();
|
|
});
|
|
// #endregion methods
|
|
|
|
// components declaration
|
|
const HadithaLayout = defineAsyncComponent(() =>
|
|
import("@haditha/layouts/HadithaLayout.vue")
|
|
);
|
|
const NavigationMenu = defineAsyncComponent(() =>
|
|
import("@haditha/components/haditha/NavigationMenu.vue")
|
|
);
|
|
const CardList = defineAsyncComponent(() =>
|
|
import("@haditha/components/haditha/CardList.vue")
|
|
);
|
|
</script>
|
|
|
|
<template>
|
|
<HadithaLayout>
|
|
<div class="search-box-container h-full flex flex-col justify-center">
|
|
<navigation-menu></navigation-menu>
|
|
|
|
<card-list
|
|
no-data-text="هنوز چیزی ذخیره نکردهاید!"
|
|
no-data-icon="/img/haditha/no-data.png"
|
|
:list="state.libraryList"
|
|
></card-list>
|
|
</div>
|
|
</HadithaLayout>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.search-box-container {
|
|
padding-top: 8.3em;
|
|
background: #f7fffd;
|
|
}
|
|
</style>
|