major change fixing bugs when running SSR in the project

This commit is contained in:
F4ilji
2025-04-26 22:59:46 +05:00
parent 1df1a1390f
commit 453fb4cccc
55 changed files with 414 additions and 362 deletions
+41 -23
View File
@@ -1,5 +1,5 @@
<template>
<header :class="[
<header v-bind="$attrs" :class="[
{ 'header-filter': headerFilter },
{ 'under-slider-bg': underSliderHeader },
isBviActive ? 'static' : 'fixed top-0 left-0 right-0'
@@ -11,8 +11,6 @@
<Link class="flex-none text-xl font-semibold"
:href="route('index')" aria-label="NTSPI">
<img :key="currentLogo" class="max-w-[300px] transition-all duration-300" :src="currentLogo" alt="Логотип">
</Link>
<div class="lg:hidden">
<button :class="{ 'text-black border-gray-500': underSliderHeader, 'text-white border-gray-200': !underSliderHeader }"
@@ -48,12 +46,11 @@
<MobileNavbar v-if="sections" :sections="sections" />
<SearchModal open_id="open-search-modal">
<ClientGlobalSearch :open_id="open_id" />
<ClientGlobalSearch />
</SearchModal>
<SearchModal open_id="open-search-sveden-modal">
<ClientStaticSearch :open_id="open_id" />
<ClientStaticSearch />
</SearchModal>
</template>
<script>
@@ -61,12 +58,13 @@ import { Link } from "@inertiajs/vue3";
import BasicIcon from "@/componentss/ui/icons/BasicIcon.vue";
import MobileNavbar from "@/Navbars/MobileNavbar.vue";
import DesktopNavBar from "@/Navbars/DesktopNavBar.vue";
import { mapGetters, mapActions } from "vuex";
import SearchModal from "@/componentss/shared/modals/SearchModal.vue";
import { helpers } from "@/mixins/Helpers.js";
import {defineAsyncComponent} from "vue";
import ClientGlobalSearch from "@/componentss/features/search/components/GlobalSearch.vue";
import ClientStaticSearch from "@/componentss/features/search/components/StaticSearch.vue";
export default {
inheritAttrs: false,
mixins: [helpers],
name: 'MainPageNavBar',
components: {
@@ -75,16 +73,13 @@ export default {
MobileNavbar,
BasicIcon,
Link,
ClientGlobalSearch: defineAsyncComponent(() =>
import('@/componentss/features/search/components/GlobalSearch.vue')
),
ClientStaticSearch: defineAsyncComponent(() =>
import('@/componentss/features/search/components/StaticSearch.vue')
),
ClientGlobalSearch,
ClientStaticSearch,
},
props: {
sections: {
type: Object,
default: () => ({}),
},
},
data() {
@@ -102,7 +97,8 @@ export default {
handleScroll() {
this.scrollPosition = window.pageYOffset;
if (this.lastSlider) {
// Используем Vuex только если $store доступен
if (this.$store && this.lastSlider) {
const slider = this.lastSlider;
if (this.IS_SAME_ROUTE(slider.url)) {
const isSliderVisible = slider.top <= this.scrollPosition && slider.bottom >= this.scrollPosition;
@@ -111,33 +107,55 @@ export default {
}
this.headerFilter = this.scrollPosition > 5;
},
}
},
watch: {
lastSlider(newVal) {
// Если Vuex не используется, просто игнорируем
if (!this.$store) return;
if (this.IS_SAME_ROUTE(newVal?.url)) {
this.underSliderHeader = newVal.bottom < 0;
}
},
}
},
mounted() {
window.addEventListener('scroll', this.handleScroll);
this.initializeBvi();
// Вызываем action, только если на клиенте и $store доступен
if (typeof window !== 'undefined' && this.$store && this.initializeBvi) {
this.initializeBvi();
}
},
beforeDestroy() {
window.removeEventListener('scroll', this.handleScroll);
},
computed: {
...mapGetters(['lastSlider', 'isBviActive']),
lastSlider() {
if (this.$store && this.$store.getters && this.$store.getters.lastSlider) {
return this.$store.getters.lastSlider;
}
return null;
},
isBviActive() {
// Для SSR возвращаем false по умолчанию
if (typeof window === 'undefined') return false;
return this.$store?.getters?.isBviActive ?? false;
},
currentLogo() {
if (this.isBviActive) {
return this.logos.default
return this.logos.default;
}
return this.underSliderHeader ? this.logos.alternate : this.logos.default;
},
}
},
created() {
this.initializeBvi = mapActions(['initializeBvi']).initializeBvi;
// Инициализацию Vuex экшенов проводим, только если $store есть
if (this.$store && this.$store.dispatch) {
this.initializeBvi = () => this.$store.dispatch('initializeBvi');
}
}
}
</script>
@@ -151,4 +169,4 @@ export default {
.under-slider-bg {
background: hsla(0,0%,100%,.6);
}
</style>
</style>
@@ -43,7 +43,7 @@ export default {
},
props: {
journals: {
type: Array,
type: Object,
},
seo: {
type: Object,
@@ -62,7 +62,7 @@ export default {
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation" />
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
<BasicPageContainer>
@@ -80,7 +80,7 @@ export default {
<template>
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation" />
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
@@ -94,7 +94,7 @@ export default {
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation" />
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
@@ -70,7 +70,7 @@ export default {
<template>
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation" />
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
<BasicPageContainer>
@@ -2,7 +2,7 @@
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation" />
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
<div class="relative mb-auto mx-auto mt-[67px] max-w-screen-xl px-4 py-10 md:flex md:flex-row md:py-10">
@@ -24,7 +24,7 @@ export default {
},
props: {
divisions: {
type: Array,
type: Object,
},
seo: {
type: Object,
@@ -42,7 +42,7 @@ export default {
<template>
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation"></MainPageNavBar>
<MainPageNavBar :sections="$page.props.navigation" />
<div class="flex flex-col h-screen">
<main class="flex-grow">
+1 -1
View File
@@ -2,7 +2,7 @@
<MetaTags :seo="seo" />
<div class="flex flex-col h-screen">
<MainPageNavBar class="border-b" :sections="$page.props.navigation"></MainPageNavBar>
<MainPageNavBar :sections="$page.props.navigation" />
<main class="flex-grow">
<div class="relative mb-auto mx-auto mt-[67px] max-w-screen-xl px-4 py-10 md:flex md:flex-row md:py-10">
+5 -5
View File
@@ -51,16 +51,16 @@ export default {
type: String,
},
eventDates: {
type: Array,
type: Object,
},
navigation: {
type: Object,
},
filters: {
type: Array,
type: Object,
},
categories: {
type: Array,
type: Object,
},
breadcrumbs: {
type: Object
@@ -81,7 +81,7 @@ export default {
<template>
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation"></MainPageNavBar>
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
<BasicPageContainer breakpoint="md">
@@ -129,7 +129,7 @@ export default {
</div>
</template>
</div>
<BasicPagination :links="events.links" />
<BasicPagination v-if="events.links.next" :links="events.links" />
</div>
</BasicPageContainer>
+5 -5
View File
@@ -40,19 +40,19 @@ export default {
type: Object,
},
currentDate: {
type: String,
type: Object,
},
eventDates: {
type: Array,
type: Object,
},
navigation: {
type: Object,
},
filters: {
type: Array,
type: Object,
},
categories: {
type: Array,
type: Object,
},
breadcrumbs: {
type: Object
@@ -72,7 +72,7 @@ export default {
<template>
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation"></MainPageNavBar>
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
<BasicPageContainer breakpoint="md">
+1 -1
View File
@@ -61,7 +61,7 @@ export default {
<template>
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation"></MainPageNavBar>
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
<BasicPageContainer>
@@ -45,7 +45,7 @@ export default {
},
props: {
faculties: {
type: Array,
type: Object,
},
seo: {
type: Object,
@@ -63,7 +63,7 @@ export default {
<template>
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation" />
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
<BasicPageContainer>
+1 -1
View File
@@ -1,7 +1,7 @@
<template>
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation" />
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
<div class="relative mx-auto mb-auto mt-[67px] max-w-screen-xl px-4 py-10 md:flex md:flex-row md:py-10">
+1 -1
View File
@@ -1,7 +1,7 @@
<template>
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation" />
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
+2 -7
View File
@@ -39,17 +39,12 @@ export default {
Link,
Head,
},
data() {
return {
};
},
props: {
posts: {
type: Object,
},
filters: {
type: Array,
type: Object,
},
categories: {
type: Object,
@@ -79,7 +74,7 @@ export default {
<template>
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation"></MainPageNavBar>
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
<BasicPageContainer>
+1 -1
View File
@@ -84,7 +84,7 @@ export default {
<ScrollTimeline />
<MainPageNavBar class="border-b" :sections="$page.props.navigation" />
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
<BasicPageContainer breakpoint="md">
<div class="space-y-5 md:space-y-10">
+7 -7
View File
@@ -44,22 +44,22 @@ export default {
type: String,
},
levelsEducational: {
type: Array,
type: Object,
},
naprs: {
type: Array
type: Object,
},
filters: {
type: Array,
type: Object,
},
formsEdu: {
type: Array,
type: Object,
},
budgetEdu: {
type: Array,
type: Object,
},
direction_studies: {
type: Array,
type: Object,
},
seo: {
type: Object,
@@ -91,7 +91,7 @@ export default {
<template>
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation" />
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
<BasicPageContainer>
+3 -3
View File
@@ -63,10 +63,10 @@ export default {
},
props: {
program: {
type: Array,
type: Object,
},
formsEdu: {
type: Array
type: Object
},
seo: {
type: Object,
@@ -78,7 +78,7 @@ export default {
<template>
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation" />
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
<BasicPageContainer>
@@ -146,7 +146,7 @@ export default {
<template>
<MetaTags :seo="this.seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation" />
<MainPageNavBar :sections="$page.props.navigation" />
<div class="flex flex-col h-screen">
<main class="flex-grow">
+1 -1
View File
@@ -79,7 +79,7 @@ export default {
</script>
<template>
<MainPageNavBar class="border-b" :sections="$page.props.navigation"></MainPageNavBar>
<MainPageNavBar :sections="$page.props.navigation" />
+1 -1
View File
@@ -6,7 +6,7 @@
<div class="flex flex-col h-screen justify-between">
<MainPageNavBar class="border-b" :sections="$page.props.navigation"></MainPageNavBar>
<MainPageNavBar :sections="$page.props.navigation" />
<div class="max-w-[50rem] flex flex-col mx-auto size-full">
<!-- ========== HEADER ========== -->
<!-- ========== END HEADER ========== -->
+1 -1
View File
@@ -2,7 +2,7 @@
<MetaTags :seo="seo" />
<MainPageNavBar class="border-b" :sections="$page.props.navigation" />
<MainPageNavBar :sections="$page.props.navigation" />
<BasicPageWrapper>
<div class="relative mx-auto mb-auto mt-[67px] max-w-screen-xl w-full px-4 py-10 md:flex md:flex-row md:py-10">
+1 -1
View File
@@ -34,7 +34,7 @@ export default {
</script>
<template>
<MainPageNavBar class="border-b" :sections="$page.props.navigation"></MainPageNavBar>
<MainPageNavBar :sections="$page.props.navigation" />
<div class="relative mx-auto mt-[67px] max-w-screen-xl px-4 py-10 md:flex md:flex-row md:py-10">
<article class="w-full min-w-0 mt-4 px-1 md:px-6">
@@ -43,7 +43,7 @@
</Link>
</li>
<li class="text-sm">
<Link :href="this.$inertia.page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<Link :href="$page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -72,7 +72,7 @@
</Link>
</li>
<li class="text-sm">
<Link :href="this.$inertia.page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<Link :href="$page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -54,7 +54,7 @@
</Link>
</li>
<li class="text-sm">
<Link :href="this.$inertia.page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<Link :href="$page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -94,7 +94,7 @@
</Link>
</li>
<li class="text-sm">
<Link :href="this.$inertia.page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<Link :href="$page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -43,7 +43,7 @@
</Link>
</li>
<li class="text-sm">
<Link :href="this.$inertia.page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<Link :href="$page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -72,7 +72,7 @@
</Link>
</li>
<li class="text-sm">
<Link :href="this.$inertia.page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<Link :href="$page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -43,7 +43,7 @@
</Link>
</li>
<li class="text-sm">
<Link :href="this.$inertia.page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<Link :href="$page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -72,7 +72,7 @@
</Link>
</li>
<li class="text-sm">
<Link :href="this.$inertia.page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<Link :href="$page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -56,7 +56,7 @@ export default {
props: {
dates: {
type: Array,
type: Object,
},
currentDate: {
type: String,
@@ -43,7 +43,7 @@
</Link>
</li>
<li class="text-sm">
<Link :href="this.$inertia.page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<Link :href="$page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -72,7 +72,7 @@
</Link>
</li>
<li class="text-sm">
<Link :href="this.$inertia.page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<Link :href="$page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-primary-hover">
<svg class="flex-shrink-0 mx-2 overflow-visible h-2.5 w-2.5 text-gray-400"
width="16" height="16"
viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -103,7 +103,7 @@ export default {
},
props: {
headerNavs: {
type: Array,
type: Object,
},
},
};
@@ -40,7 +40,7 @@ export default {
props: {
authors: {
type: Array,
type: Object,
},
},
}
@@ -94,7 +94,7 @@ export default {
props: {
images: {
type: Array,
type: Object,
},
title: {
type: String,
@@ -48,7 +48,7 @@ export default {
},
props: {
categories: {
type: Array,
type: Object,
},
search: {
type: String,
@@ -28,7 +28,7 @@
name="hs-as-table-product-review-search"
class="py-1 placeholder-[#8F8F8F] font-light px-2 block flex-1 w-full border-none text-lg focus:z-10 border-transparent focus:border-transparent focus:ring-0"
placeholder="Поиск по сайту">
<button v-if='this.searchInput !== ""' @click="clearSearch" class="items-center flex justify-end px-2" type="button">
<button v-if='searchInput !== ""' @click="clearSearch" class="items-center flex justify-end px-2" type="button">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5 hover:text-gray-300 text-gray-500 duration-150 font-bold">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12" />
</svg>
@@ -178,11 +178,6 @@ export default {
this.search()
}
},
props: {
open_id: {
type: String,
}
}
}
</script>
@@ -1,38 +1,40 @@
<template>
<Link data-hs-overlay="#hs-basic-modal" :href="route('client.post.index')" class="my-1 flex gap-3 px-2 py-2 items-center hover:bg-[#F2F2F2] rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 flex-shrink-0">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 7.5h1.5m-1.5 3h1.5m-7.5 3h7.5m-7.5 3h7.5m3-9h3.375c.621 0 1.125.504 1.125 1.125V18a2.25 2.25 0 0 1-2.25 2.25M16.5 7.5V18a2.25 2.25 0 0 0 2.25 2.25M16.5 7.5V4.875c0-.621-.504-1.125-1.125-1.125H4.125C3.504 3.75 3 4.254 3 4.875V18a2.25 2.25 0 0 0 2.25 2.25h13.5M6 7.5h3v3H6v-3Z" />
</svg>
<span class="text-sm">Новости</span>
</Link>
<Link data-hs-overlay="#hs-basic-modal" :href="route('client.event.index')" class="my-1 flex gap-3 px-2 py-2 items-center hover:bg-[#F2F2F2] rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="M18 18.72a9.094 9.094 0 0 0 3.741-.479 3 3 0 0 0-4.682-2.72m.94 3.198.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0 1 12 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 0 1 6 18.719m12 0a5.971 5.971 0 0 0-.941-3.197m0 0A5.995 5.995 0 0 0 12 12.75a5.995 5.995 0 0 0-5.058 2.772m0 0a3 3 0 0 0-4.681 2.72 8.986 8.986 0 0 0 3.74.477m.94-3.197a5.971 5.971 0 0 0-.94 3.197M15 6.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm6 3a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Zm-13.5 0a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Z" />
</svg>
<div>
<Link data-hs-overlay="#hs-basic-modal" :href="route('client.post.index')" class="my-1 flex gap-3 px-2 py-2 items-center hover:bg-[#F2F2F2] rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 flex-shrink-0">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 7.5h1.5m-1.5 3h1.5m-7.5 3h7.5m-7.5 3h7.5m3-9h3.375c.621 0 1.125.504 1.125 1.125V18a2.25 2.25 0 0 1-2.25 2.25M16.5 7.5V18a2.25 2.25 0 0 0 2.25 2.25M16.5 7.5V4.875c0-.621-.504-1.125-1.125-1.125H4.125C3.504 3.75 3 4.254 3 4.875V18a2.25 2.25 0 0 0 2.25 2.25h13.5M6 7.5h3v3H6v-3Z" />
</svg>
<span class="text-sm">Новости</span>
</Link>
<Link data-hs-overlay="#hs-basic-modal" :href="route('client.event.index')" class="my-1 flex gap-3 px-2 py-2 items-center hover:bg-[#F2F2F2] rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="M18 18.72a9.094 9.094 0 0 0 3.741-.479 3 3 0 0 0-4.682-2.72m.94 3.198.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0 1 12 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 0 1 6 18.719m12 0a5.971 5.971 0 0 0-.941-3.197m0 0A5.995 5.995 0 0 0 12 12.75a5.995 5.995 0 0 0-5.058 2.772m0 0a3 3 0 0 0-4.681 2.72 8.986 8.986 0 0 0 3.74.477m.94-3.197a5.971 5.971 0 0 0-.94 3.197M15 6.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm6 3a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Zm-13.5 0a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Z" />
</svg>
<span class="text-sm">Мероприятия</span>
</Link>
<Link data-hs-overlay="#hs-basic-modal" :href="route('client.program.index')" class="my-1 flex gap-3 px-2 py-2 items-center hover:bg-[#F2F2F2] rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6.042A8.967 8.967 0 0 0 6 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 0 1 6 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 0 1 6-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0 0 18 18a8.967 8.967 0 0 0-6 2.292m0-14.25v14.25" />
</svg>
<span class="text-sm">Мероприятия</span>
</Link>
<Link data-hs-overlay="#hs-basic-modal" :href="route('client.program.index')" class="my-1 flex gap-3 px-2 py-2 items-center hover:bg-[#F2F2F2] rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6.042A8.967 8.967 0 0 0 6 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 0 1 6 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 0 1 6-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0 0 18 18a8.967 8.967 0 0 0-6 2.292m0-14.25v14.25" />
</svg>
<span class="text-sm">Приемная компания</span>
</Link>
<Link data-hs-overlay="#hs-basic-modal" :href="route('client.program.index')" class="my-1 flex gap-3 px-2 py-2 items-center hover:bg-[#F2F2F2] rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0 1 18 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3 1.5 1.5 3-3.75" />
</svg>
<span class="text-sm">Приемная компания</span>
</Link>
<Link data-hs-overlay="#hs-basic-modal" :href="route('client.program.index')" class="my-1 flex gap-3 px-2 py-2 items-center hover:bg-[#F2F2F2] rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0 1 18 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3 1.5 1.5 3-3.75" />
</svg>
<span class="text-sm">Образовательные программы</span>
</Link>
<Link data-hs-overlay="#hs-basic-modal" :href="route('client.additionalEducation.index')" class="my-1 flex gap-3 px-2 py-2 items-center hover:bg-[#F2F2F2] rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 7.125C2.25 6.504 2.754 6 3.375 6h6c.621 0 1.125.504 1.125 1.125v3.75c0 .621-.504 1.125-1.125 1.125h-6a1.125 1.125 0 0 1-1.125-1.125v-3.75ZM14.25 8.625c0-.621.504-1.125 1.125-1.125h5.25c.621 0 1.125.504 1.125 1.125v8.25c0 .621-.504 1.125-1.125 1.125h-5.25a1.125 1.125 0 0 1-1.125-1.125v-8.25ZM3.75 16.125c0-.621.504-1.125 1.125-1.125h5.25c.621 0 1.125.504 1.125 1.125v2.25c0 .621-.504 1.125-1.125 1.125h-5.25a1.125 1.125 0 0 1-1.125-1.125v-2.25Z" />
</svg>
<span class="text-sm">Образовательные программы</span>
</Link>
<Link data-hs-overlay="#hs-basic-modal" :href="route('client.additionalEducation.index')" class="my-1 flex gap-3 px-2 py-2 items-center hover:bg-[#F2F2F2] rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 7.125C2.25 6.504 2.754 6 3.375 6h6c.621 0 1.125.504 1.125 1.125v3.75c0 .621-.504 1.125-1.125 1.125h-6a1.125 1.125 0 0 1-1.125-1.125v-3.75ZM14.25 8.625c0-.621.504-1.125 1.125-1.125h5.25c.621 0 1.125.504 1.125 1.125v8.25c0 .621-.504 1.125-1.125 1.125h-5.25a1.125 1.125 0 0 1-1.125-1.125v-8.25ZM3.75 16.125c0-.621.504-1.125 1.125-1.125h5.25c.621 0 1.125.504 1.125 1.125v2.25c0 .621-.504 1.125-1.125 1.125h-5.25a1.125 1.125 0 0 1-1.125-1.125v-2.25Z" />
</svg>
<span class="text-sm">Курсы дополнительного образования</span>
</Link>
<span class="text-sm">Курсы дополнительного образования</span>
</Link>
</div>
</template>
<script>
@@ -28,7 +28,7 @@
name="hs-as-table-product-review-search"
class="py-1 placeholder-[#8F8F8F] font-light px-2 block flex-1 w-full border-none text-lg focus:z-10 border-transparent focus:border-transparent focus:ring-0"
placeholder="Поиск по сведениям об образовательной организации">
<button v-if='this.searchInput !== ""' @click="clearFilters" class="items-center flex justify-end px-2" type="button">
<button v-if='searchInput !== ""' @click="clearFilters" class="items-center flex justify-end px-2" type="button">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5 hover:text-gray-300 text-gray-500 duration-150 font-bold">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12" />
</svg>
@@ -198,12 +198,6 @@ export default {
}
},
props: {
open_id: {
type: String,
}
}
}
</script>
@@ -102,7 +102,7 @@ export default {
name: 'SliderBody',
props: {
slides: {
type: Array,
type: Object,
}
},
data() {
@@ -59,7 +59,7 @@ export default {
},
props: {
blocks: {
type: Array,
type: Object,
required: true,
},
},
@@ -53,7 +53,7 @@ export default {
},
props: {
block: {
type: Array,
type: Object,
},
},
methods: {
@@ -25,7 +25,7 @@ export default {
required: true,
},
items: {
type: Array,
type: Object,
required: true,
},
},
@@ -25,7 +25,7 @@ export default {
required: true,
},
items: {
type: Array,
type: Object,
required: true,
},
},
@@ -40,89 +40,88 @@
import {Link} from "@inertiajs/vue3";
import BasicIcon from "@/componentss/ui/icons/BasicIcon.vue";
import {debounce} from "lodash";
export default {
name: "CategoryFilter",
components: {
BasicIcon,
Link
},
data() {
return {
category_slug: this.category_filter.value || [],
searchTerm: '',
filteredItems: this.categories.data, // Изначально все элементы
}
},
methods: {
filter: debounce(function () {
let url = new URL(window.location.href);
// Создаем массив для хранения всех ключей, которые нужно удалить
const keysToDelete = [];
name: "CategoryFilter",
components: {
BasicIcon,
Link
},
data() {
return {
category_slug: this.category_filter.value || [],
searchTerm: '',
}
},
methods: {
filter: debounce(function () {
let url = new URL(window.location.href);
const keysToDelete = [];
// Перебираем все параметры и добавляем ключи, начинающиеся с 'category', в массив
for (const [key] of url.searchParams) {
if (key.startsWith('category')) {
keysToDelete.push(key);
}
}
// Удаляем все ключи из массива
keysToDelete.forEach(key => url.searchParams.delete(key));
url.searchParams.delete('page');
let newUrl = url.toString();
this.$inertia.visit(newUrl, {
method: 'get',
preserveState: true,
data: {
category: this.category_slug,
},
});
}, 500),
clearFilter() {
let url = new URL(window.location.href);
// Создаем массив для хранения всех ключей, которые нужно удалить
const keysToDelete = [];
for (const [key] of url.searchParams) {
if (key.startsWith('category')) {
keysToDelete.push(key);
}
}
// Перебираем все параметры и добавляем ключи, начинающиеся с 'category', в массив
for (const [key] of url.searchParams) {
if (key.startsWith('category')) {
keysToDelete.push(key);
}
}
// Удаляем все ключи из массива
keysToDelete.forEach(key => url.searchParams.delete(key));
this.category_slug = [];
this.searchTerm = ''; // Сбросить поле поиска
let newUrl = url.toString();
this.$inertia.visit(newUrl, {
method: 'get',
preserveState: true,
});
},
},
computed: {
filteredItems() {
if (!this.searchTerm) {
return this.categories.data; // Возвращаем все элементы, если ничего не введено
}
const term = this.searchTerm.toLowerCase(); // Приводим к нижнему регистру для нечувствительности к регистру
return this.categories.data.filter(item =>
item.title.toLowerCase().includes(term) // Фильтруем по заголовку
);
}
},
props: {
categories: {
type: Object,
},
category_filter: {
type: Object,
},
},
keysToDelete.forEach(key => url.searchParams.delete(key));
url.searchParams.delete('page');
let newUrl = url.toString();
this.$inertia.visit(newUrl, {
method: 'get',
preserveState: true,
data: {
category: this.category_slug,
},
});
}, 500),
clearFilter() {
let url = new URL(window.location.href);
const keysToDelete = [];
for (const [key] of url.searchParams) {
if (key.startsWith('category')) {
keysToDelete.push(key);
}
}
keysToDelete.forEach(key => url.searchParams.delete(key));
this.category_slug = [];
this.searchTerm = '';
let newUrl = url.toString();
this.$inertia.visit(newUrl, {
method: 'get',
preserveState: true,
});
},
},
computed: {
filteredItems() {
if (!this.searchTerm) {
return this.categories.data;
}
const term = this.searchTerm.toLowerCase();
return this.categories.data.filter(item =>
item.title.toLowerCase().includes(term)
);
}
},
props: {
categories: {
type: Object,
required: true // Добавляем required для ясности
},
category_filter: {
type: Object,
default: () => ({ value: [] }) // Добавляем значение по умолчанию
},
}
}
</script>
<style scoped>
</style>
@@ -51,7 +51,6 @@ export default {
return {
tag_slug: this.tag_filter.value || [],
searchTerm: '',
filteredItems: this.tags, // Изначально все элементы
}
},
methods: {
@@ -26,7 +26,8 @@ import {defineAsyncComponent} from "vue";
export default {
name: 'SearchModal',
inheritAttrs: false,
name: 'SearchModal',
props: {
open_id: {
type: String,
@@ -95,7 +95,7 @@ export default {
},
props: {
headerNavs: {
type: Array,
type: Object,
},
},
};
@@ -1,23 +1,23 @@
<template>
<div class="mt-10 flex items-center justify-center">
<nav class="flex items-center gap-x-1" aria-label="Pagination">
<Link :href="links.links[0].url" as="button" class="min-h-9.5 min-w-9.5 py-2 px-2.5 inline-flex justify-center items-center gap-x-2 text-sm rounded-lg border border-transparent text-gray-800 hover:bg-gray-100 focus:outline-hidden focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none" aria-label="Previous">
<a :href="links.links[0].url" class="min-h-9.5 min-w-9.5 py-2 px-2.5 inline-flex justify-center items-center gap-x-2 text-sm rounded-lg border border-transparent text-gray-800 hover:bg-gray-100 focus:outline-hidden focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none" aria-label="Previous">
<svg class="shrink-0 size-3.5" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="m15 18-6-6 6-6"></path>
</svg>
<span class="sr-only">Previous</span>
</Link>
</a>
<div class="flex items-center gap-x-1">
<Link v-for="link in getPageLinks(links)" as="button" :href="link.url"
<a v-for="link in getPageLinks(links)" :href="link.url"
:class="link.active ? 'border-gray-200 text-gray-800' : 'border-transparent hover:bg-gray-100'"
class="min-h-9.5 min-w-9.5 flex justify-center items-center border py-2 px-3 text-sm rounded-lg focus:outline-hidden focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none">{{ link.label }}</Link>
class="min-h-9.5 min-w-9.5 flex justify-center items-center border py-2 px-3 text-sm rounded-lg focus:outline-hidden focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none">{{ link.label }}</a>
</div>
<Link :href="links.links.slice(-1).pop().url" as="button" class="min-h-9.5 min-w-9.5 py-2 px-2.5 inline-flex justify-center items-center gap-x-2 text-sm rounded-lg border border-transparent text-gray-800 hover:bg-gray-100 focus:outline-hidden focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none" aria-label="Next">
<a :href="links.links.slice(-1).pop().url" class="min-h-9.5 min-w-9.5 py-2 px-2.5 inline-flex justify-center items-center gap-x-2 text-sm rounded-lg border border-transparent text-gray-800 hover:bg-gray-100 focus:outline-hidden focus:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none" aria-label="Next">
<span class="sr-only">Next</span>
<svg class="shrink-0 size-3.5" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="m9 18 6-6-6-6"></path>
</svg>
</Link>
</a>
</nav>
</div>
</template>
+44 -21
View File
@@ -1,43 +1,66 @@
import slugify from "slugify";
import process from "@inertiajs/inertia-vue3/.eslintrc.js";
export const helpers = {
data() {
},
methods: {
HAS_ACTIVE_PAGE(section) {
if (!this.$page?.props?.ziggy) return false;
if (section.pages) {
return section.pages.some(page => this.IS_SAME_ROUTE(page.path));
}
if (section.subSections) {
return section.subSections.some(subSection => this.HAS_ACTIVE_PAGE(subSection));
}
return false;
},
IS_SAME_ROUTE(route) {
if (route === this.$page.props.ziggy.location) {
if (!this.$page?.props?.ziggy) return false;
const currentLocation = this.$page.props.ziggy.location;
if (!currentLocation) return false;
if (route === currentLocation) {
return true;
}
const currentLocation = this.$page.props.ziggy.location;
const currentUrl = this.$page.props.ziggy.url + '/' + route;
return currentLocation === currentUrl;
},
TEXT_LIMIT(text, symbols) {
if (text.length > symbols) {
let LimitedText
LimitedText = text.substring(0, symbols)
return LimitedText + "..."
try {
const currentUrl = this.$page.props.ziggy.url + '/' + route;
return currentLocation === currentUrl;
} catch {
return false;
}
return text
},
GENERATE_SLUG: function (text) {
return slugify(text, {
lower: true,
strict: true,
locale: 'ru'
});
TEXT_LIMIT(text, symbols) {
if (!text) return '';
if (typeof text !== 'string') return String(text);
return text.length > symbols
? text.substring(0, symbols) + "..."
: text;
},
GENERATE_SLUG(text) {
if (typeof text !== 'string') return '';
try {
return slugify(text, {
lower: true,
strict: true,
locale: 'ru'
});
} catch {
return text.toLowerCase().replace(/\s+/g, '-');
}
},
GET_BASE_URL() {
if (typeof window === 'undefined') {
return process.env.APP_URL || '/'; // Используем env-переменную на сервере
}
return window.location.origin + '/';
}
},
}
};