feat: первое подключение фронтенда
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 8s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 54s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 27s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 6s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 8s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 54s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 27s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 6s
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { computed, onMounted } from 'vue'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import GlassCard from '@/components/ui/GlassCard.vue'
|
||||
import AchievementBadge from '@/components/ui/AchievementBadge.vue'
|
||||
import EmptyState from '@/components/ui/EmptyState.vue'
|
||||
|
||||
const userStore = useUserStore()
|
||||
const auth = useAuthStore()
|
||||
const unlocked = computed(() => userStore.achievements.filter(a => a.unlocked))
|
||||
const locked = computed(() => userStore.achievements.filter(a => !a.unlocked))
|
||||
|
||||
@@ -14,6 +17,10 @@ const rewards = [
|
||||
{ id: 'r3', title: 'Доп. консультация преподавателя', price: 220, available: false },
|
||||
{ id: 'r4', title: 'Цифровой бейдж «Research Explorer»', price: 60, available: true },
|
||||
]
|
||||
|
||||
onMounted(() => {
|
||||
if (auth.user) void userStore.fetchStudentData(auth.user.id)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -22,7 +29,12 @@ const rewards = [
|
||||
|
||||
<section>
|
||||
<h2 class="section-title">Полученные достижения</h2>
|
||||
<div class="list">
|
||||
<EmptyState
|
||||
v-if="!unlocked.length"
|
||||
title="Полученных достижений пока нет"
|
||||
subtitle="Они появятся после участия в лекциях и отзывах."
|
||||
/>
|
||||
<div v-else class="list">
|
||||
<AchievementBadge
|
||||
v-for="a in unlocked"
|
||||
:key="a.id"
|
||||
@@ -38,7 +50,12 @@ const rewards = [
|
||||
|
||||
<section>
|
||||
<h2 class="section-title">Заблокированные</h2>
|
||||
<div class="list">
|
||||
<EmptyState
|
||||
v-if="!locked.length"
|
||||
title="Нет заблокированных достижений"
|
||||
subtitle="Backend пока не вернул список будущих достижений."
|
||||
/>
|
||||
<div v-else class="list">
|
||||
<AchievementBadge
|
||||
v-for="a in locked"
|
||||
:key="a.id"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, inject, ref } from 'vue'
|
||||
import { computed, inject, onMounted, ref } from 'vue'
|
||||
import { useLecturesStore } from '@/stores/lectures'
|
||||
import SearchInput from '@/components/ui/SearchInput.vue'
|
||||
import LectureCard from '@/components/ui/LectureCard.vue'
|
||||
@@ -21,6 +21,10 @@ const onlyFree = ref(false)
|
||||
const filtersOpen = ref(false)
|
||||
const addToast = inject('addToast') as ((message: string, type?: 'success' | 'error' | 'info') => void) | undefined
|
||||
|
||||
onMounted(() => {
|
||||
if (!lecturesStore.all.length) void lecturesStore.fetchLectures()
|
||||
})
|
||||
|
||||
const tagFilters = ref([
|
||||
{ label: '#ML', value: '#ML', active: false },
|
||||
{ label: '#ИИ', value: '#ИИ', active: false },
|
||||
@@ -97,9 +101,13 @@ const calendarGroups = computed(() => {
|
||||
return Object.entries(groups)
|
||||
})
|
||||
|
||||
function registerLecture(id: string) {
|
||||
lecturesStore.register(id)
|
||||
addToast?.('Вы записаны на лекцию. Напоминание придет за сутки.', 'success')
|
||||
async function registerLecture(id: string) {
|
||||
try {
|
||||
await lecturesStore.register(id)
|
||||
addToast?.('Вы записаны на лекцию. Напоминание придет за сутки.', 'success')
|
||||
} catch (err) {
|
||||
addToast?.(err instanceof Error ? err.message : 'Не удалось записаться на лекцию.', 'error')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -179,7 +187,15 @@ function registerLecture(id: string) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="filtered.length === 0">
|
||||
<GlassCard v-if="lecturesStore.loading">
|
||||
<div class="text-secondary">Загружаем лекции...</div>
|
||||
</GlassCard>
|
||||
|
||||
<div v-else-if="lecturesStore.error">
|
||||
<EmptyState title="Не удалось загрузить каталог" :subtitle="lecturesStore.error" />
|
||||
</div>
|
||||
|
||||
<div v-else-if="filtered.length === 0">
|
||||
<EmptyState title="Нет результатов" subtitle="Попробуйте изменить фильтры или сбросить поиск." />
|
||||
</div>
|
||||
|
||||
@@ -212,7 +228,13 @@ function registerLecture(id: string) {
|
||||
</span>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<button class="btn-primary btn-sm" :disabled="row.freeSeats === 0 || row.registrationClosed">Записаться</button>
|
||||
<button
|
||||
class="btn-primary btn-sm"
|
||||
:disabled="row.freeSeats === 0 || row.registrationClosed || lecturesStore.registeredIds.includes(row.id)"
|
||||
@click="registerLecture(row.id)"
|
||||
>
|
||||
{{ lecturesStore.registeredIds.includes(row.id) ? 'Записан' : 'Записаться' }}
|
||||
</button>
|
||||
</template>
|
||||
</DataTable>
|
||||
</GlassCard>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { computed, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useLecturesStore } from '@/stores/lectures'
|
||||
@@ -9,6 +9,7 @@ import StatsWidget from '@/components/ui/StatsWidget.vue'
|
||||
import LectureCard from '@/components/ui/LectureCard.vue'
|
||||
import ProgressBar from '@/components/ui/ProgressBar.vue'
|
||||
import AchievementBadge from '@/components/ui/AchievementBadge.vue'
|
||||
import EmptyState from '@/components/ui/EmptyState.vue'
|
||||
|
||||
const auth = useAuthStore()
|
||||
const lectures = useLecturesStore()
|
||||
@@ -16,7 +17,7 @@ const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
|
||||
const user = computed(() => auth.user!)
|
||||
const nextLecture = computed(() => lectures.registeredLectures[0] ?? lectures.all[0]!)
|
||||
const nextLecture = computed(() => lectures.registeredLectures[0] ?? lectures.all[0])
|
||||
const recommended = computed(() =>
|
||||
lectures.all.filter(l => !lectures.registeredIds.includes(l.id)).slice(0, 3)
|
||||
)
|
||||
@@ -24,6 +25,14 @@ const achievements = computed(() => userStore.achievements.filter(a => a.unlocke
|
||||
const reminders = computed(() => userStore.notifications.slice(0, 3))
|
||||
const xpToNext = 200
|
||||
const xpProgress = computed(() => user.value.xp ?? 120)
|
||||
|
||||
onMounted(async () => {
|
||||
await Promise.all([
|
||||
lectures.all.length ? Promise.resolve() : lectures.fetchLectures(),
|
||||
userStore.fetchStudentData(user.value.id),
|
||||
])
|
||||
await lectures.fetchRegisteredForUser(user.value.id)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -36,11 +45,11 @@ const xpProgress = computed(() => user.value.xp ?? 120)
|
||||
<div class="quick-actions">
|
||||
<button class="btn-primary" @click="router.push('/catalog')">Найти лекцию</button>
|
||||
<button class="btn-secondary" @click="router.push('/my-lectures')">Мои записи</button>
|
||||
<button class="btn-secondary" @click="router.push(`/review/${nextLecture?.id ?? '1'}`)">Оставить отзыв</button>
|
||||
<button class="btn-secondary" :disabled="!nextLecture" @click="nextLecture && router.push(`/review/${nextLecture.id}`)">Оставить отзыв</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<GlassCard>
|
||||
<GlassCard v-if="nextLecture">
|
||||
<div class="next-lecture">
|
||||
<div>
|
||||
<div class="section-title">Ближайшая лекция</div>
|
||||
@@ -57,6 +66,7 @@ const xpProgress = computed(() => user.value.xp ?? 120)
|
||||
</div>
|
||||
</div>
|
||||
</GlassCard>
|
||||
<EmptyState v-else-if="!lectures.loading" title="Пока нет лекций" subtitle="Каталог пуст или данные ещё не синхронизированы." />
|
||||
|
||||
<div class="stats-row">
|
||||
<StatsWidget label="Посещено лекций" :value="user.lecturesAttended ?? 12" icon="📚" color="green" />
|
||||
@@ -80,7 +90,8 @@ const xpProgress = computed(() => user.value.xp ?? 120)
|
||||
<h2 class="section-title">✨ Рекомендуемые лекции</h2>
|
||||
<button class="link-btn" @click="router.push('/catalog')">Все лекции →</button>
|
||||
</div>
|
||||
<div class="cards-grid">
|
||||
<EmptyState v-if="lectures.loading" title="Загружаем рекомендации" subtitle="Получаем данные с backend." />
|
||||
<div v-else class="cards-grid">
|
||||
<LectureCard
|
||||
v-for="l in recommended"
|
||||
:key="l.id"
|
||||
|
||||
@@ -1,25 +1,43 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { computed, onMounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useLecturesStore } from '@/stores/lectures'
|
||||
import GlassCard from '@/components/ui/GlassCard.vue'
|
||||
import LectureCard from '@/components/ui/LectureCard.vue'
|
||||
import StatusBadge from '@/components/ui/StatusBadge.vue'
|
||||
import EmptyState from '@/components/ui/EmptyState.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const lecturesStore = useLecturesStore()
|
||||
|
||||
const lecture = computed(() => lecturesStore.all.find(l => l.id === route.params.id) ?? lecturesStore.all[0]!)
|
||||
const isRegistered = computed(() => lecturesStore.isRegistered(lecture.value.id))
|
||||
const attendedLectures = ['1']
|
||||
const isAttended = computed(() => attendedLectures.includes(lecture.value.id))
|
||||
const lectureId = computed(() => String(route.params.id))
|
||||
const lecture = computed(() => lecturesStore.all.find(l => l.id === lectureId.value))
|
||||
const isRegistered = computed(() => (lecture.value ? lecturesStore.isRegistered(lecture.value.id) : false))
|
||||
const isAttended = computed(() => lecture.value?.status === 'completed')
|
||||
const reviews = computed(() => lecturesStore.reviewsByLecture[lectureId.value] ?? [])
|
||||
|
||||
const similarLectures = computed(() => lecturesStore.all.filter(l => l.id !== lecture.value.id).slice(0, 3))
|
||||
const similarLectures = computed(() => lecturesStore.all.filter(l => l.id !== lectureId.value).slice(0, 3))
|
||||
|
||||
onMounted(async () => {
|
||||
if (!lecturesStore.all.length) await lecturesStore.fetchLectures()
|
||||
await lecturesStore.fetchLecture(lectureId.value)
|
||||
await lecturesStore.fetchReviews(lectureId.value)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="lecture-detail page-content">
|
||||
<div v-if="lecturesStore.loading && !lecture" class="lecture-detail page-content">
|
||||
<GlassCard>
|
||||
<div class="text-secondary">Загружаем лекцию...</div>
|
||||
</GlassCard>
|
||||
</div>
|
||||
|
||||
<div v-else-if="!lecture" class="lecture-detail page-content">
|
||||
<EmptyState title="Лекция не найдена" :subtitle="lecturesStore.error ?? 'Попробуйте открыть каталог и выбрать лекцию заново.'" />
|
||||
</div>
|
||||
|
||||
<div v-else class="lecture-detail page-content">
|
||||
<div class="header">
|
||||
<div>
|
||||
<div class="breadcrumb">Каталог / {{ lecture.title }}</div>
|
||||
@@ -73,16 +91,13 @@ const similarLectures = computed(() => lecturesStore.all.filter(l => l.id !== le
|
||||
Студенты отмечают «понятные примеры» и «много практики». Предлагается добавить больше времени на вопросы и
|
||||
прикладные кейсы. Средняя оценка — 4.8/5.
|
||||
</p>
|
||||
<div class="reviews">
|
||||
<div class="review">
|
||||
<div class="review-head">Анонимный отзыв · 5 ⭐</div>
|
||||
<div class="review-body">Очень структурно, понравились живые примеры и объяснение базовых концепций.</div>
|
||||
</div>
|
||||
<div class="review">
|
||||
<div class="review-head">Анонимный отзыв · 4 ⭐</div>
|
||||
<div class="review-body">Полезно, но хотелось больше времени на практику и разбор домашних заданий.</div>
|
||||
<div class="reviews" v-if="reviews.length">
|
||||
<div v-for="review in reviews" :key="review.id" class="review">
|
||||
<div class="review-head">{{ review.userName }} · {{ review.sentiment }}</div>
|
||||
<div class="review-body">{{ review.text }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<p v-else class="text-secondary text-sm">Отзывов пока нет.</p>
|
||||
</GlassCard>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useLecturesStore } from '@/stores/lectures'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import GlassCard from '@/components/ui/GlassCard.vue'
|
||||
import StatusBadge from '@/components/ui/StatusBadge.vue'
|
||||
import ModalDialog from '@/components/ui/ModalDialog.vue'
|
||||
import EmptyState from '@/components/ui/EmptyState.vue'
|
||||
|
||||
const lecturesStore = useLecturesStore()
|
||||
const auth = useAuthStore()
|
||||
const router = useRouter()
|
||||
const activeTab = ref<'upcoming' | 'history'>('upcoming')
|
||||
const cancelModal = ref(false)
|
||||
@@ -16,19 +19,20 @@ const upcoming = computed(() =>
|
||||
lecturesStore.registeredLectures.map(l => ({ ...l, status: 'registered' }))
|
||||
)
|
||||
|
||||
const history = ref([
|
||||
{ id: '1', title: 'Введение в нейронные сети и глубокое обучение', date: '2025-04-20', time: '14:00', building: 'ИКТИБ', room: '305', status: 'attended' },
|
||||
{ id: '4', title: 'Философия цифровой эпохи', date: '2025-04-12', time: '18:00', building: 'Онлайн', room: '', status: 'needsReview' },
|
||||
{ id: '5', title: 'Право в информационном обществе', date: '2025-04-05', time: '15:30', building: 'ЮФ', room: '412', status: 'cancelled' },
|
||||
])
|
||||
const history = computed(() => lecturesStore.all.filter(l => l.status === 'completed'))
|
||||
|
||||
onMounted(async () => {
|
||||
if (!lecturesStore.all.length) await lecturesStore.fetchLectures()
|
||||
if (auth.user) await lecturesStore.fetchRegisteredForUser(auth.user.id)
|
||||
})
|
||||
|
||||
function openCancel(id: string) {
|
||||
selectedId.value = id
|
||||
cancelModal.value = true
|
||||
}
|
||||
|
||||
function confirmCancel() {
|
||||
if (selectedId.value) lecturesStore.unregister(selectedId.value)
|
||||
async function confirmCancel() {
|
||||
if (selectedId.value) await lecturesStore.unregister(selectedId.value)
|
||||
cancelModal.value = false
|
||||
}
|
||||
</script>
|
||||
@@ -49,6 +53,7 @@ function confirmCancel() {
|
||||
</div>
|
||||
|
||||
<div v-if="activeTab === 'upcoming'" class="list">
|
||||
<EmptyState v-if="!upcoming.length" title="Нет предстоящих записей" subtitle="Выберите лекцию в каталоге и запишитесь на неё." />
|
||||
<GlassCard v-for="item in upcoming" :key="item.id" class="lecture-row">
|
||||
<div>
|
||||
<div class="lecture-title">{{ item.title }}</div>
|
||||
@@ -64,6 +69,7 @@ function confirmCancel() {
|
||||
</div>
|
||||
|
||||
<div v-else class="list">
|
||||
<EmptyState v-if="!history.length" title="История пока пуста" subtitle="Завершённые лекции появятся здесь после посещения." />
|
||||
<GlassCard v-for="item in history" :key="item.id" class="lecture-row">
|
||||
<div>
|
||||
<div class="lecture-title">{{ item.title }}</div>
|
||||
@@ -71,8 +77,8 @@ function confirmCancel() {
|
||||
<div class="lecture-meta">🏛 {{ item.building }} {{ item.room ? `· ауд. ${item.room}` : '' }}</div>
|
||||
</div>
|
||||
<div class="lecture-actions">
|
||||
<StatusBadge :status="item.status" />
|
||||
<button v-if="item.status === 'needsReview'" class="btn-primary btn-sm" @click="router.push(`/review/${item.id}`)">
|
||||
<StatusBadge :status="item.status ?? 'completed'" />
|
||||
<button class="btn-primary btn-sm" @click="router.push(`/review/${item.id}`)">
|
||||
Оставить отзыв
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import GlassCard from '@/components/ui/GlassCard.vue'
|
||||
@@ -7,6 +7,7 @@ import CoinChip from '@/components/ui/CoinChip.vue'
|
||||
import ProgressBar from '@/components/ui/ProgressBar.vue'
|
||||
import AchievementBadge from '@/components/ui/AchievementBadge.vue'
|
||||
import DataTable from '@/components/ui/DataTable.vue'
|
||||
import EmptyState from '@/components/ui/EmptyState.vue'
|
||||
|
||||
const auth = useAuthStore()
|
||||
const userStore = useUserStore()
|
||||
@@ -27,6 +28,10 @@ const historyColumns = [
|
||||
{ key: 'description', label: 'Описание' },
|
||||
{ key: 'amount', label: 'Монеты', align: 'right' },
|
||||
]
|
||||
|
||||
onMounted(() => {
|
||||
void userStore.fetchStudentData(user.value.id)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -87,7 +92,12 @@ const historyColumns = [
|
||||
</label>
|
||||
</div>
|
||||
<div class="section-title">Достижения</div>
|
||||
<div class="achievements">
|
||||
<EmptyState
|
||||
v-if="!userStore.achievements.length"
|
||||
title="Достижений пока нет"
|
||||
subtitle="Они появятся после посещений, отзывов и начислений."
|
||||
/>
|
||||
<div v-else class="achievements">
|
||||
<AchievementBadge
|
||||
v-for="a in userStore.achievements.slice(0, 3)"
|
||||
:key="a.id"
|
||||
@@ -104,6 +114,11 @@ const historyColumns = [
|
||||
|
||||
<GlassCard>
|
||||
<div class="section-title">История начисления монет</div>
|
||||
<EmptyState
|
||||
v-if="!userStore.coinHistory.length"
|
||||
title="История монет пуста"
|
||||
subtitle="Начисления появятся после активностей на платформе."
|
||||
/>
|
||||
<DataTable :columns="historyColumns" :rows="userStore.coinHistory">
|
||||
<template #amount="{ value }">
|
||||
<span :class="value > 0 ? 'positive' : 'negative'">{{ value > 0 ? `+${value}` : value }}</span>
|
||||
|
||||
@@ -2,16 +2,34 @@
|
||||
import { ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import GlassCard from '@/components/ui/GlassCard.vue'
|
||||
import { reviewsApi } from '@/api'
|
||||
|
||||
const route = useRoute()
|
||||
const rating = ref<'positive' | 'neutral' | 'negative'>('positive')
|
||||
const text = ref('Лекция была хорошо структурирована, особенно понравились практические примеры и разбор кейсов.')
|
||||
const submitted = ref(false)
|
||||
const editing = ref(false)
|
||||
const loading = ref(false)
|
||||
const error = ref('')
|
||||
|
||||
function submit() {
|
||||
submitted.value = true
|
||||
editing.value = false
|
||||
const ratingMap = {
|
||||
positive: 'Like',
|
||||
neutral: 'Neutral',
|
||||
negative: 'Dislike',
|
||||
} as const
|
||||
|
||||
async function submit() {
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
try {
|
||||
await reviewsApi.create(String(route.params.id), ratingMap[rating.value], text.value)
|
||||
submitted.value = true
|
||||
editing.value = false
|
||||
} catch (err) {
|
||||
error.value = err instanceof Error ? err.message : 'Не удалось отправить отзыв.'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -48,9 +66,10 @@ function submit() {
|
||||
<div class="hint">
|
||||
💡 Постарайтесь быть конкретными: что понравилось, где было сложно, какие темы хотите раскрыть глубже.
|
||||
</div>
|
||||
<div class="error" v-if="error">{{ error }}</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button class="btn-primary" type="submit">Отправить отзыв</button>
|
||||
<button class="btn-primary" type="submit" :disabled="loading">{{ loading ? 'Отправляем...' : 'Отправить отзыв' }}</button>
|
||||
<button class="btn-secondary" type="button" :disabled="submitted">Сохранить черновик</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -91,4 +110,5 @@ textarea {
|
||||
.success-icon { font-size: 28px; }
|
||||
.success-title { font-size: 16px; font-weight: 700; }
|
||||
.success-sub { font-size: 13px; color: var(--color-text-secondary); }
|
||||
.error { color: var(--color-error); font-size: 13px; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user