From 5f6aeb8d47782250c5f28e81261fa304e84fd505 Mon Sep 17 00:00:00 2001 From: Baghi Date: Tue, 6 May 2025 10:29:18 +0330 Subject: [PATCH] =?UTF-8?q?=D8=B1=DB=8C=D8=B3=D9=BE=D8=A7=D9=86=D8=B3?= =?UTF-8?q?=DB=8C=D9=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/haditha/search/index.vue | 103 +++++++++++++++++---------------- 1 file changed, 52 insertions(+), 51 deletions(-) diff --git a/pages/haditha/search/index.vue b/pages/haditha/search/index.vue index 7ad5d0c..3163cc4 100644 --- a/pages/haditha/search/index.vue +++ b/pages/haditha/search/index.vue @@ -167,19 +167,20 @@ const backgroundImageStyle = computed(() => { // }); let optimizedImageUrl = "/img/haditha/background.webp"; - if (!showNoData.value) { + if (showNoData.value) { // optimizedImageUrl = img("/img/haditha/sub-header-bgi.webp", { // quality: 80, // }); optimizedImageUrl = "/img/haditha/sub-header-bgi.webp"; return { - backgroundImage: `url(${optimizedImageUrl}), linear-gradient(199.05deg, #ffffff 9.99%, #e4fff7 42.07%, #ffffff 97.12%)`, + backgroundImage: `url(${optimizedImageUrl})`, + // backgroundImage: `url(${optimizedImageUrl}), linear-gradient(199.05deg, #ffffff 9.99%, #e4fff7 42.07%, #ffffff 97.12%)`, }; } return { - backgroundImage: `url(${optimizedImageUrl}), linear-gradient(199.05deg, #ffffff 9.99%, #e4fff7 42.07%, #ffffff 97.12%)`, + backgroundImage: `url(${optimizedImageUrl})`, }; }); const searchButtonIcon = computed(() => { @@ -229,7 +230,9 @@ const sendQuery = async (payload = {}) => { ); // if (route.query.f_aik?.length) url += `&f_aik=${route.query.f_aik}`; - } + } else url = url.replace("@q=none", "q=none"); + + console.info(url); return await httpService.postRequest(url, payload).then((res) => { total.value = res.hits.total.value ?? 0; @@ -247,8 +250,11 @@ const sendQuery = async (payload = {}) => { // Server-side initial load const { data: loadedItems } = await useAsyncData("search", () => sendQuery(), { transform: (data) => data.hits.hits, + getCachedData: (key) => { + return useNuxtApp().payload.data[key] || useNuxtApp().static.data[key]; + }, }); -showNoData.value = loadedItems.value?.length == 0; +showNoData.value = Boolean(loadedItems.value?.length); const onBeforeSendQuery = (from) => { if (loading.value) return; @@ -265,12 +271,11 @@ const onBeforeSendQuery = (from) => { if (searchTerm.value?.length) { sendQuery().then((res) => { loadedItems.value = res.hits.hits; - showNoData.value = loadedItems.value?.length == 0; + showNoData.value = Boolean(loadedItems.value?.length); loading.value = false; }); } else { searchTerm.value = ""; - loading.value = false; loadedItems.value = []; showNoData.value = false; loading.value = false; @@ -305,17 +310,19 @@ const onSearchButtonClick = () => { if (loading.value) return; loading.value = true; - sendQuery().then((res) => { - loadedItems.value = res.hits.hits; - showNoData.value = loadedItems.value?.length == 0; + // showclearButton.value = true; + if (searchTerm.value?.length) { + searchTerm.value = ""; + loadedItems.value = []; + showNoData.value = false; loading.value = false; - }); -}; -const resetForm = () => { - searchTerm.value = ""; - loadedItems.value = []; - showNoData.value = false; - loading.value = false; + } else { + sendQuery().then((res) => { + loadedItems.value = res.hits.hits; + showNoData.value = Boolean(loadedItems.value?.length); + loading.value = false; + }); + } }; // وقتی کاربر کلیدی فشار میدهد @@ -337,7 +344,7 @@ const setType = (type: string) => { offset.value = 0; sendQuery().then((res) => { loadedItems.value = res.hits.hits; - showNoData.value = loadedItems.value?.length == 0; + showNoData.value = Boolean(loadedItems.value?.length); }); }; // const setKey = (type: string) => { @@ -378,7 +385,7 @@ const onTypeSelectChanged = (value: string) => { sendQuery().then((res) => { loadedItems.value = res.hits.hits; - showNoData.value = loadedItems.value?.length == 0; + showNoData.value = Boolean(loadedItems.value?.length); }); }; @@ -432,7 +439,7 @@ const prepareSynonym = () => { const onUpdateSwitch = () => { sendQuery(prepareSynonym()).then((res) => { loadedItems.value = res.hits.hits; - showNoData.value = loadedItems.value?.length == 0; + showNoData.value = Boolean(loadedItems.value?.length); }); }; const onUpdateSubTitle = (subTitle) => { @@ -440,7 +447,7 @@ const onUpdateSubTitle = (subTitle) => { sendQuery(prepareSynonym()).then((res) => { loadedItems.value = res.hits.hits; - showNoData.value = loadedItems.value?.length == 0; + showNoData.value = Boolean(loadedItems.value?.length); }); }; const onAddNewTitle = (subTitles) => { @@ -452,7 +459,7 @@ const onAddNewTitle = (subTitles) => { sendQuery(prepareSynonym()).then((res) => { loadedItems.value = res.hits.hits; - showNoData.value = loadedItems.value?.length == 0; + showNoData.value = Boolean(loadedItems.value?.length); }); }; // #endregion methods @@ -476,19 +483,19 @@ const SearchList = defineAsyncComponent(
-
+
-
+
-
+
{{ route.query.f_aik }} @@ -535,26 +542,20 @@ const SearchList = defineAsyncComponent(
- - - -
@@ -782,7 +783,7 @@ const SearchList = defineAsyncComponent(
@@ -826,6 +827,11 @@ const SearchList = defineAsyncComponent(

"نتیجه‌ای یافت نشد!

-->
+ +
@@ -869,14 +875,9 @@ const SearchList = defineAsyncComponent( } } -.search-box-container { +/* .search-box-container { padding-top: 0.7em; - padding-bottom: 4em; /*64px */ - - &.pb-0 { - padding-bottom: 0 !important; - } -} +} */ .search-list-contianer { position: relative; @@ -913,7 +914,7 @@ const SearchList = defineAsyncComponent( } .haditha-search-root-wrapper { - max-width: 656px; + max-width: 1200px; width: 100%; margin: 0 1em; @@ -1072,7 +1073,7 @@ const SearchList = defineAsyncComponent( .search-filter { .filter-item { /* width: 81px; */ - height: 40px; + height: 56px; border-radius: 12px; border-width: 0.3px; padding-top: 8px;