feat [X-01]: я тут накоммитил

This commit is contained in:
Denzel committed 2025-02-07 08:49:11 +03:00
1 parent 28f6d1ae2d
commit aa7d224b79
72 files changed
+749 -435

No files matched your search

+4 -1
View File
@@ -1,11 +1,14 @@
<template>
<!-- Инициализация проекта -->
<router-view />
</template>
<script setup>
import { useAccountStore } from '@/store/AccountStore';
/**
* Получаем информацию о юзере из стора.
*/
const accountStore = useAccountStore();
accountStore.setUser(accountStore.getuserFromStorage());
</script>
+79 -48
View File
@@ -1,66 +1,97 @@
<!-- Обратный отсчет: Компонент для отображения оставшегося времени голосования -->
<template>
<h6>ДО КОНЦА ГОЛОСОВАНИЯ ОСТАЛОСЬ:</h6>
<div class="text-red text-h6">{{ displayDays }} дней {{ displayHours }} часов {{ displayMinutes }} минут</div>
<h6>ДО КОНЦА ГОЛОСОВАНИЯ ОСТАЛОСЬ:</h6>
<div class="text-red text-h6">
{{ displayDays }} дней {{ displayHours }} часов {{ displayMinutes }} минут
</div>
</template>
<script>
import { onMounted, ref } from 'vue';
export default {
data: () => ({
displayDays: 0,
displayHours: 0,
displayMinutes: 0
}),
setup() {
/**
* Хранит количество оставшихся дней.
*/
const displayDays = ref(0);
computed: {
_seconds: () => 1000,
_minutes() {
return this._seconds * 60
},
_hours() {
return this._minutes * 60
},
_days() {
return this._hours * 24
/**
* Хранит количество оставшихся часов.
*/
const displayHours = ref(0);
/**
* Хранит количество оставшихся минут.
*/
const displayMinutes = ref(0);
/**
* Определяет количество миллисекунд в одной секунде.
*/
const _seconds = 1000;
/**
* Определяет количество миллисекунд в одной минуте.
*/
const _minutes = _seconds * 60;
/**
* Определяет количество миллисекунд в одном часе.
*/
const _hours = _minutes * 60;
/**
* Определяет количество миллисекунд в одном дне.
*/
const _days = _hours * 24;
/**
* @arrowFunc
* Обрабатывает обратный отсчет до окончания голосования.
*/
const countDown = () => {
const timer = setInterval(() => {
const now = new Date();
// Здесь задается конец отчета (год, месяц, день, часы, минуты, секунды)
const end = new Date(2025, 0, 13, 23, 59, 59);
const distance = end.getTime() - now.getTime();
if (distance < 0) {
clearInterval(timer);
return;
}
},
mounted() {
this.countDown();
},
const daysLeft = Math.floor(distance / _days);
const hoursLeft = Math.floor((distance % _days) / _hours);
const minutesLeft = Math.floor((distance % _hours) / _minutes);
methods: {
countDown() {
const timer = setInterval(() => {
const now = new Date();
// здесь задается конец отчета (гггг, мм, дд, остальные цифры не меняются)
const end = new Date(2025, 0, 13, 23, 59, 59);
const distance = end.getTime() - now.getTime();
if (distance < 0) {
clearInterval(timer);
return
}
const days = Math.floor(distance / this._days);
const hours = Math.floor((distance % this._days) / this._hours);
const minutes = Math.floor((distance % this._hours) / this._minutes);
this.displayMinutes = minutes < 10 ? "0" + minutes : minutes;
this.displayHours = minutes < 10 & minutes > 10 ? "0" + hours : hours;
this.displayDays = days;
}, 1000)
}
}
displayDays.value = daysLeft;
displayHours.value = hoursLeft < 10 ? '0' + hoursLeft : hoursLeft;
displayMinutes.value = minutesLeft < 10 ? '0' + minutesLeft : minutesLeft;
}, 1000);
};
onMounted(() => {
countDown();
});
return {
displayDays,
displayHours,
displayMinutes,
};
},
};
</script>
<style>
.card-count {
font-size: 3em;
color: #ff0000;
font-size: 3em;
color: #ff0000;
}
.card-sub-title {
font-size: 1.2em;
font-size: 1.2em;
}
</style>
</style>
+44 -12
View File
@@ -1,4 +1,5 @@
<template>
<!-- Карусель: Компонент для отображения изображений и видео с сервера в виде карусели -->
<v-carousel
v-model="currentslide"
:interval="interval"
@@ -14,7 +15,7 @@
<template v-for="(x, i) in carous" :key="i">
<v-carousel-item v-if="!x.link.endsWith('mp4')" :src="`${burl}${x.link}`" cover eager>
<v-container fill-height fluid pa-0 ma-0 pb-3 class="flex-column h-100 d-flex">
<v-card v-if="x.text != '' || x.title != null" class="bgCard h-100 d-flex flex-column">
<v-card v-if="x.text !== '' || x.title != null" class="bgCard h-100 d-flex flex-column">
<v-card-title
v-if="x.title != null"
class="text-h3 text-uppercase titles text-text_carous ma-1 mb-0"
@@ -29,7 +30,7 @@
</v-row>
</v-card-title>
<v-card-text
v-if="x.text != ''"
v-if="x.text !== ''"
class="w-50 flex-grow-0 text-h6 bgText overflow-auto ma-1 pa-0"
>
<v-textarea
@@ -58,11 +59,9 @@
@loadedmetadata="interval = 10000000000"
>
<source :src="`${burl}${x.link}`" type="video/mp4" />
Текущий браузер не поддерживает воспроизведение этого видео.
</video>
</div>
<!-- currentslide=currentslide<carous.length-1?currentslide+1:0 -->
</v-carousel-item>
</template>
</v-carousel>
@@ -76,15 +75,43 @@ import { useAlertStore } from '@/store/useAlertStore';
export default {
setup() {
/**
* Хранит индекс текущего слайда карусели.
*/
const currentslide = ref(0);
/**
* Базовый URL для загрузки медиа.
*/
const burl = baseURL.slice(0, -1);
/**
* Ссылка на элемент видео.
*/
const videoElement = ref(null);
/**
* Хранит массив данных карусели, по умолчанию содержит одно изображение.
*/
const carous = ref([{ link: `/media/newsimage/scales.jpg`, title: null, text: '' }]);
/**
* Получает объект alert из хранилища alert для уведомлений.
*/
const feedalert = useAlertStore().alert;
/**
* Интервал переключения слайдов в миллисекундах.
*/
const interval = ref(10000);
/**
* @arrowFunc
* Обрабатывает запрос для получения данных карусели с сервера.
*/
const getfromserver = () => {
axiosApiInstance.get('api/navigation/carousels/').then((result) => {
if (result.data.mess != '') {
if (result.data.mess !== '') {
feedalert.alert = true;
feedalert.text = result.data.mess;
feedalert.color = 'red-darken-2';
@@ -98,18 +125,18 @@ export default {
};
getfromserver();
const interval = ref(10000);
/**
* @arrowFunc
* Управляет изменением слайда и переключением интервала в зависимости от типа медиа.
*/
const slidechanged = () => {
if (carous.value[currentslide.value].link.endsWith('mp4')) {
// При переключении на видео, останавливаем все другие видео
videoElement.value.forEach((e) => {
if (e.currentSrc != burl + carous.value[currentslide.value].link) {
if (e.currentSrc !== burl + carous.value[currentslide.value].link) {
e.pause();
}
// else{
// console.log("sdflkhlh");
// e.play()
// }
});
}
@@ -119,6 +146,12 @@ export default {
interval.value = 10000;
}
};
/**
* @arrowFunc
* Обрабатывает окончание воспроизведения видео и переключает слайд.
* @param {Object} val Событие окончания воспроизведения видео.
*/
const ended = (val) => {
val.target.currentTime = 0;
val.target.pause();
@@ -132,7 +165,6 @@ export default {
videoElement,
currentslide,
interval,
burl,
carous,
ended,
+52 -80
View File
@@ -1,101 +1,73 @@
<template>
<v-card class="d-flex ml-3">
<v-sheet
class="mx-auto"
elevation="0"
max-width="813"
>
<v-slide-group
v-model="model"
class="pa-0"
selected-class="bg-primary"
mandatory
show-arrows
>
<v-slide-group-item
v-for="n in digitalData"
:key="n"
>
<v-card
class="ma-2 mt-4 d-flex flex-column"
height="100"
width="169"
elevation="0"
>
<!-- <v-img
height="100"
:src="`${burl}${n.img}`"
cover
class="text-white"
> -->
<v-card class="h-100 text-center g text-black_grey">
<v-card-title class="statstyle my-2 py-0 text-overline font-weight-bold">
{{n.status}}
</v-card-title>
<v-card-text class="numstyle mt-4 py-0 font-weight-bold">
<vue3-autocounter ref='counter' :startAmount='0' :endAmount='Number(n.num)' :duration='1'/>
</v-card-text>
</v-card>
<!-- </v-img> -->
</v-card>
</v-slide-group-item>
</v-slide-group>
</v-sheet>
<!-- Компонент данных: Отображает цифры в виде слайд-группы карточек с анимацией счетчика -->
<v-card class="d-flex ml-3">
<v-sheet class="mx-auto" elevation="0" max-width="813">
<v-slide-group v-model="model" class="pa-0" mandatory selected-class="bg-primary" show-arrows>
<v-slide-group-item v-for="n in digitalData" :key="n">
<v-card class="ma-2 mt-4 d-flex flex-column" elevation="0" height="100" width="169">
<v-card class="h-100 text-center g text-black_grey">
<v-card-title class="statstyle my-2 py-0 text-overline font-weight-bold">
{{ n.status }}
</v-card-title>
<v-card-text class="numstyle mt-4 py-0 font-weight-bold">
<vue3-autocounter
ref="counter"
:duration="1"
:endAmount="Number(n.num)"
:startAmount="0"
/>
</v-card-text>
</v-card>
</v-card>
</v-slide-group-item>
</v-slide-group>
</v-sheet>
</v-card>
</template>
<script>
import { ref } from 'vue'
import { baseURL } from '@/utils/axios-api'
import { ref } from 'vue';
import { baseURL } from '@/utils/axios-api';
export default {
props: {
digitalData: {
type: Object,
default: {}
}
props: {
digitalData: {
type: Object,
default: () => {},
comment: 'Объект с данными для отображения',
},
},
setup() {
const burl = baseURL.slice(0,-1)
const model = ref(false)
setup() {
/**
* Получает базовый URL из конфигурации axios.
*/
const burl = baseURL.slice(0, -1);
return {model, burl}
}
}
/**
* Хранит выбранное значение модели для v-slide-group.
*/
const model = ref(false);
return { model, burl };
},
};
</script>
<style>
.numstyle {
font-size: 2.875rem!important;
line-height: 2.5rem!important;
font-family: cursive !important;
background: #ffffffb0;
font-size: 2.875rem !important;
line-height: 2.5rem !important;
font-family: cursive !important;
background: #ffffffb0;
}
.statstyle {
background: #ffffffb0;
font-size: 1rem!important;
background: #ffffffb0;
font-size: 1rem !important;
}
.g {
/* background-color: rgb(240 248 255 / 35%);; */
background-color: rgb(255 255 255);;
background-color: rgb(255, 255, 255);
}
</style>
</style>