From 710bb6cbccca0f4187aa6c61bdaac52ab718c04d Mon Sep 17 00:00:00 2001 From: zakhy <=> Date: Mon, 23 Dec 2024 12:02:34 +0700 Subject: [PATCH] release --- app/cybercode/settings.py | 2 +- app/static/cybercode/js/script.js | 124 +++++++++++++++---------- app/static/cybercode/styles/style.css | 19 ++++ app/static/cybercode/styles/swiper.css | 2 +- app/templates/index.html | 15 +-- 5 files changed, 106 insertions(+), 56 deletions(-) diff --git a/app/cybercode/settings.py b/app/cybercode/settings.py index 835599b..157eb1e 100644 --- a/app/cybercode/settings.py +++ b/app/cybercode/settings.py @@ -95,7 +95,7 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' # AUTH_USER_MODEL = 'users.User' LOGIN_URL = '/users/login' -APP_VERSION = '1.0.0.8' +APP_VERSION = '1.0.1.0' MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') CSRF_TRUSTED_ORIGINS = ["https://cybercode.pro", "http://cybercode.pro"] diff --git a/app/static/cybercode/js/script.js b/app/static/cybercode/js/script.js index d22c98f..60e769b 100644 --- a/app/static/cybercode/js/script.js +++ b/app/static/cybercode/js/script.js @@ -55,7 +55,6 @@ if (targetSlide !== null && !isNaN(targetSlide)) { } - function truncateText(text, wordLimit) { const words = text.split(' '); if (words.length > wordLimit) { @@ -121,63 +120,58 @@ function truncateText(text, wordLimit) { projectSlides.appendChild(projectSlide) } // вложенный свайпер -const innerSwiper = document.querySelector('.innerSwiper') -if (innerSwiper) { - var innerSwiperObj = new Swiper(innerSwiper, { - effect: "coverflow", - grabCursor: true, - centeredSlides: true, - slidesPerView: "auto", - loop: true, - spaceBetween: 70, - coverflowEffect: { - rotate: 0, - stretch: 0, - depth: 100, - modifier: 1, - slideShadows: true, - }, - pagination: { - el: ".swiper-pagination", - clickable: true, - }, - navigation: { - nextEl: ".swiper-button-next", - prevEl: ".swiper-button-prev", - }, - }); -} + const innerSwiper = document.querySelector('.innerSwiper') + if (innerSwiper) { + var innerSwiperObj = new Swiper(innerSwiper, { + effect: "coverflow", + grabCursor: true, + centeredSlides: true, + slidesPerView: "auto", + loop: true, + spaceBetween: 70, + coverflowEffect: { + rotate: 0, + stretch: 0, + depth: 100, + modifier: 1, + slideShadows: true, + }, + pagination: { + el: ".swiper-pagination", + clickable: true, + }, + navigation: { + nextEl: ".swiper-button-next", + prevEl: ".swiper-button-prev", + }, + }); + } })(); // Услуги (async () => { function createServiceItem(service) { - const colDiv = document.createElement('div'); - colDiv.classList.add('col-lg-4', 'col-md-6', 'col-sm-12'); - - // Создание элемента a с классами 'color-white' и 'text-decoration-none' + // Создаем элемент const link = document.createElement('a'); link.href = `services/${service.slug}/`; - link.classList.add('color-white', 'text-decoration-none'); + link.classList.add( + 'service-slide', + 'color-white', + 'rounded', + 'd-flex', + 'justify-content-center', + 'align-items-center', + 'text-decoration-none', + ); - // Создание div для блока услуги с классами и стилями - const serviceDiv = document.createElement('div'); - serviceDiv.classList.add('p-3', 'rounded', 'd-flex', 'justify-content-center', 'align-items-center', 'service-item'); - serviceDiv.style.backgroundColor = 'rgba(0, 0, 0, 0.3)'; - - // Создание заголовка h4 с текстом + // Создаем элемент

для текста const serviceTitle = document.createElement('h4'); serviceTitle.textContent = service.name; - // Вложение заголовка в блок услуги - serviceDiv.appendChild(serviceTitle); + // Вкладываем заголовок внутрь ссылки + link.appendChild(serviceTitle); - // Вложение блока услуги в ссылку - link.appendChild(serviceDiv); - - // Вложение ссылки в основной контейнер - colDiv.appendChild(link); - - return colDiv; + // Возвращаем готовый элемент + return link; } const response = await fetch('services/') @@ -188,4 +182,38 @@ if (innerSwiper) { let serviceItem = createServiceItem(service) servicesWrapper.appendChild(serviceItem) } -})(); \ No newline at end of file +})(); + +new Swiper('#indexSliderService', { + slidesPerView: 1, + slideClass: 'service-slide', + grid: { + rows: 4, // По умолчанию одна строка + fill: 'row', // Заполняем ряды + }, + spaceBetween: 20, // Расстояние между элементами + navigation: { + nextEl: '.swiper-button-next', + prevEl: '.swiper-button-prev', + }, + breakpoints: { + 576: { // Экран от 576px + slidesPerView: 2, + grid: { + rows: 4, + }, + }, + 768: { // Экран от 768px + slidesPerView: 3, + grid: { + rows: 2, + }, + }, + 1200: { // Экран от 1200px + slidesPerView: 3, + grid: { + rows: 4, + }, + }, + }, +}); \ No newline at end of file diff --git a/app/static/cybercode/styles/style.css b/app/static/cybercode/styles/style.css index b0561f3..841a416 100644 --- a/app/static/cybercode/styles/style.css +++ b/app/static/cybercode/styles/style.css @@ -472,4 +472,23 @@ article p a { background-color: #f9f9fd; } +} + +.service-slide { + background-color: rgba(0, 0, 0, 0.3); + text-align: center; + display: flex; + justify-content: center; + align-items: center; + height: 100%; + min-height: 125px; + padding: 30px; +} + +a.service-slide { + height: 100%; +} + +@media (max-width: 500px) { + .service-slide } \ No newline at end of file diff --git a/app/static/cybercode/styles/swiper.css b/app/static/cybercode/styles/swiper.css index 056d9b9..58e1300 100755 --- a/app/static/cybercode/styles/swiper.css +++ b/app/static/cybercode/styles/swiper.css @@ -10,7 +10,7 @@ .slider .swiper-slide { background: none; - overflow: hidden; + overflow: hidden !important; position: relative; height: 100%; text-align: start; diff --git a/app/templates/index.html b/app/templates/index.html index 61d095d..d49fa1d 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -54,13 +54,15 @@

Наши услуги

- {#
    #} - {#
#} -
-
+ {#
#} +
+
- +
+
+ + {#
#}
@@ -93,7 +95,8 @@
- {{ contacts.phone_number.content|safe }} + {{ contacts.phone_number.content|safe }}