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

This commit is contained in:
2026-05-11 01:33:38 +03:00
parent 71e7d84e0f
commit 779b6aba77
21 changed files with 942 additions and 365 deletions
+5 -68
View File
@@ -1,34 +1,21 @@
<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { useRoute } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
import type { UserRole } from '@/types'
const auth = useAuthStore()
const router = useRouter()
const route = useRoute()
const error = ref('')
const loading = ref(false)
const selectedRole = ref<UserRole>('student')
const simulateError = ref(false)
const roleOptions: Array<{ label: string; role: UserRole }> = [
{ label: '🎓 Студент', role: 'student' },
{ label: '👩‍🏫 Преподаватель', role: 'teacher' },
{ label: '🛡️ Администратор', role: 'admin' },
]
if (typeof route.query.error === 'string') error.value = route.query.error
async function login() {
loading.value = true
error.value = ''
const ok = await auth.login(selectedRole.value, simulateError.value)
const ok = auth.startMicrosoftLogin()
loading.value = false
if (ok) {
if (selectedRole.value === 'teacher') router.push('/teacher')
else if (selectedRole.value === 'admin') router.push('/admin')
else router.push('/')
} else {
error.value = auth.error ?? 'Ошибка авторизации. Проверьте доступ и попробуйте снова.'
}
if (!ok) error.value = auth.error ?? 'Не удалось начать вход через Microsoft.'
}
</script>
@@ -46,21 +33,6 @@ async function login() {
Получайте рекомендации, оставляйте отзывы и зарабатывайте монеты за полезную обратную связь.
</div>
<div class="role-select">
<p class="demo-label">Роль для демонстрации:</p>
<div class="role-options">
<button
v-for="opt in roleOptions"
:key="opt.role"
class="role-option"
:class="{ active: selectedRole === opt.role }"
@click="selectedRole = opt.role"
>
{{ opt.label }}
</button>
</div>
</div>
<div class="login-actions">
<button class="btn-primary btn-full" type="button" :disabled="loading" @click="login">
<span v-if="loading" class="spinner-inline">
@@ -68,10 +40,6 @@ async function login() {
</span>
{{ loading ? 'Вход...' : 'Войти через ЮФУ (Microsoft Entra ID)' }}
</button>
<label class="toggle">
<input type="checkbox" v-model="simulateError" />
Показать ошибку авторизации
</label>
<div class="error" v-if="error"> {{ error }}</div>
</div>
@@ -125,39 +93,8 @@ async function login() {
padding: 14px 16px;
border: 1px solid var(--color-border-glass);
}
.demo-label {
font-size: 12px;
color: var(--color-text-secondary);
font-weight: 600;
text-transform: uppercase;
margin-bottom: 8px;
}
.role-options { display: flex; flex-wrap: wrap; gap: 8px; }
.role-option {
background: rgba(255,255,255,0.6);
border: 1px solid var(--color-border-glass);
border-radius: var(--radius-sm);
padding: 8px 12px;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
color: var(--color-text);
}
.role-option.active {
border-color: var(--color-primary);
background: rgba(34,197,94,0.12);
color: var(--color-primary-dark);
}
.login-actions { display: flex; flex-direction: column; gap: 10px; }
.btn-full { width: 100%; justify-content: center; }
.toggle {
font-size: 12px;
color: var(--color-text-secondary);
display: flex;
align-items: center;
gap: 8px;
}
.error {
font-size: 13px;
color: var(--color-error);