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 38s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 18s
🚀 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 38s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 18s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 6s
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { coursesApi, lecturesApi, locationsApi, tagsApi } from '@/api'
|
||||
import type { CourseDto, LectureDto, LocationDto, TagDto } from '@/api/types'
|
||||
import GlassCard from '@/components/ui/GlassCard.vue'
|
||||
import DataTable from '@/components/ui/DataTable.vue'
|
||||
import EmptyState from '@/components/ui/EmptyState.vue'
|
||||
|
||||
type TabKey = 'lectures' | 'courses' | 'rooms' | 'tags'
|
||||
type TabConfig = {
|
||||
@@ -11,6 +14,11 @@ type TabConfig = {
|
||||
}
|
||||
|
||||
const activeTab = ref<TabKey>('lectures')
|
||||
const lectures = ref<LectureDto[]>([])
|
||||
const courses = ref<CourseDto[]>([])
|
||||
const locations = ref<LocationDto[]>([])
|
||||
const tags = ref<TagDto[]>([])
|
||||
const loading = ref(false)
|
||||
|
||||
const tabConfig: Record<TabKey, TabConfig> = {
|
||||
lectures: {
|
||||
@@ -21,11 +29,7 @@ const tabConfig: Record<TabKey, TabConfig> = {
|
||||
{ key: 'format', label: 'Формат' },
|
||||
{ key: 'status', label: 'Синхронизация', align: 'center' },
|
||||
],
|
||||
rows: [
|
||||
{ id: '1', title: 'Введение в нейронные сети', teacher: 'Волков М.С.', format: 'Офлайн', status: 'Синхронизировано' },
|
||||
{ id: '2', title: 'Квантовые вычисления', teacher: 'Петров А.И.', format: 'Офлайн', status: 'Синхронизировано' },
|
||||
{ id: '3', title: 'Философия цифровой эпохи', teacher: 'Дмитриев К.О.', format: 'Онлайн', status: 'Ошибка' },
|
||||
],
|
||||
rows: [],
|
||||
},
|
||||
courses: {
|
||||
title: 'Курсы',
|
||||
@@ -34,10 +38,7 @@ const tabConfig: Record<TabKey, TabConfig> = {
|
||||
{ key: 'institute', label: 'Институт' },
|
||||
{ key: 'tags', label: 'Теги' },
|
||||
],
|
||||
rows: [
|
||||
{ id: '1', title: 'Машинное обучение', institute: 'ИКТИБ', tags: '#ML #ИИ #Python' },
|
||||
{ id: '2', title: 'Цифровая этика', institute: 'ИФиСН', tags: '#философия #этика' },
|
||||
],
|
||||
rows: [],
|
||||
},
|
||||
rooms: {
|
||||
title: 'Аудитории',
|
||||
@@ -46,10 +47,7 @@ const tabConfig: Record<TabKey, TabConfig> = {
|
||||
{ key: 'room', label: 'Аудитория' },
|
||||
{ key: 'capacity', label: 'Вместимость', align: 'center' },
|
||||
],
|
||||
rows: [
|
||||
{ id: '1', building: 'ИКТИБ', room: '305', capacity: 30 },
|
||||
{ id: '2', building: 'ИФиМКН', room: '201', capacity: 25 },
|
||||
],
|
||||
rows: [],
|
||||
},
|
||||
tags: {
|
||||
title: 'Теги',
|
||||
@@ -58,14 +56,71 @@ const tabConfig: Record<TabKey, TabConfig> = {
|
||||
{ key: 'category', label: 'Категория' },
|
||||
{ key: 'linked', label: 'Привязки', align: 'center' },
|
||||
],
|
||||
rows: [
|
||||
{ id: '1', tag: '#ML', category: 'Data Science', linked: 12 },
|
||||
{ id: '2', tag: '#философия', category: 'Гуманитарные', linked: 6 },
|
||||
],
|
||||
rows: [],
|
||||
},
|
||||
}
|
||||
|
||||
const current = computed(() => tabConfig[activeTab.value])
|
||||
const current = computed(() => {
|
||||
const config = tabConfig[activeTab.value]
|
||||
if (activeTab.value === 'lectures') {
|
||||
return {
|
||||
...config,
|
||||
rows: lectures.value.map(l => ({
|
||||
id: l.id,
|
||||
title: l.title || l.courseName || 'Без названия',
|
||||
teacher: l.teacherName || 'Не назначен',
|
||||
format: l.format === 'Online' ? 'Онлайн' : 'Офлайн',
|
||||
status: l.isOpen ? 'Открыта' : 'Закрыта',
|
||||
})),
|
||||
}
|
||||
}
|
||||
if (activeTab.value === 'courses') {
|
||||
return {
|
||||
...config,
|
||||
rows: courses.value.map(c => ({
|
||||
id: c.id,
|
||||
title: c.name || 'Без названия',
|
||||
institute: c.isSynced ? 'Синхронизирован' : 'Ручной',
|
||||
tags: c.tags?.map(tag => `#${tag.name}`).join(' ') || '—',
|
||||
})),
|
||||
}
|
||||
}
|
||||
if (activeTab.value === 'rooms') {
|
||||
return {
|
||||
...config,
|
||||
rows: locations.value.map(l => ({
|
||||
id: l.id,
|
||||
building: l.building || l.name || '—',
|
||||
room: l.room || '—',
|
||||
capacity: '—',
|
||||
})),
|
||||
}
|
||||
}
|
||||
return {
|
||||
...config,
|
||||
rows: tags.value.map(tag => ({
|
||||
id: tag.id,
|
||||
tag: `#${tag.name}`,
|
||||
category: tag.type,
|
||||
linked: '—',
|
||||
})),
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
loading.value = true
|
||||
const [lecturesResult, coursesResult, locationsResult, tagsResult] = await Promise.allSettled([
|
||||
lecturesApi.list({ PageSize: 100 }),
|
||||
coursesApi.list(),
|
||||
locationsApi.list(),
|
||||
tagsApi.list(),
|
||||
])
|
||||
if (lecturesResult.status === 'fulfilled') lectures.value = lecturesResult.value
|
||||
if (coursesResult.status === 'fulfilled') courses.value = coursesResult.value
|
||||
if (locationsResult.status === 'fulfilled') locations.value = locationsResult.value
|
||||
if (tagsResult.status === 'fulfilled') tags.value = tagsResult.value
|
||||
loading.value = false
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -85,6 +140,7 @@ const current = computed(() => tabConfig[activeTab.value])
|
||||
<div class="grid">
|
||||
<GlassCard>
|
||||
<div class="section-title">{{ current.title }}</div>
|
||||
<EmptyState v-if="!current.rows.length && !loading" title="Данных пока нет" subtitle="Backend не вернул записи для выбранного раздела." />
|
||||
<DataTable :columns="current.columns" :rows="current.rows" />
|
||||
</GlassCard>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user