скрипты в скриптах
This commit is contained in:
134
public/auth.js
134
public/auth.js
@@ -83,11 +83,84 @@ function showMainInterface() {
|
|||||||
|
|
||||||
document.getElementById('current-user').textContent = userInfo;
|
document.getElementById('current-user').textContent = userInfo;
|
||||||
|
|
||||||
// 👇 СОЗДАЕМ НАВИГАЦИЮ ПОСЛЕ УСТАНОВКИ ПОЛЬЗОВАТЕЛЯ 👇
|
// 👇 ПЕРЕЗАГРУЗКА ВСЕХ СКРИПТОВ ПОСЛЕ АВТОРИЗАЦИИ 👇
|
||||||
createUserNavigation();
|
reloadAllScripts();
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById('tasks-controls').style.display = 'block';
|
// Функция для перезагрузки всех скриптов
|
||||||
|
function reloadAllScripts() {
|
||||||
|
console.log('🔄 Перезагрузка всех скриптов после авторизации...');
|
||||||
|
|
||||||
|
// Список скриптов для перезагрузки (в правильном порядке)
|
||||||
|
const scriptsToReload = [
|
||||||
|
'users.js',
|
||||||
|
'ui.js',
|
||||||
|
'signature.js',
|
||||||
|
'tasks.js',
|
||||||
|
'kanban.js',
|
||||||
|
'files.js',
|
||||||
|
'profile.js',
|
||||||
|
'time-selector.js',
|
||||||
|
'openTaskChat.js',
|
||||||
|
'tasks_files.js',
|
||||||
|
'navbar.js',
|
||||||
|
'chat-ui.js',
|
||||||
|
'document-fields.js',
|
||||||
|
'main.js'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Удаляем существующие скрипты
|
||||||
|
scriptsToReload.forEach(src => {
|
||||||
|
const existingScripts = document.querySelectorAll(`script[src="${src}"]`);
|
||||||
|
existingScripts.forEach(script => script.remove());
|
||||||
|
});
|
||||||
|
|
||||||
|
// Загружаем скрипты последовательно
|
||||||
|
loadScriptsSequentially(scriptsToReload, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadScriptsSequentially(scripts, index) {
|
||||||
|
if (index >= scripts.length) {
|
||||||
|
console.log('✅ Все скрипты успешно перезагружены');
|
||||||
|
|
||||||
|
// Инициализация после загрузки всех скриптов
|
||||||
|
setTimeout(() => {
|
||||||
|
initializeAfterReload();
|
||||||
|
}, 100);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.src = scripts[index];
|
||||||
|
script.onload = () => {
|
||||||
|
console.log(`✅ Загружен: ${scripts[index]}`);
|
||||||
|
loadScriptsSequentially(scripts, index + 1);
|
||||||
|
};
|
||||||
|
script.onerror = (error) => {
|
||||||
|
console.error(`❌ Ошибка загрузки ${scripts[index]}:`, error);
|
||||||
|
loadScriptsSequentially(scripts, index + 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
document.head.appendChild(script);
|
||||||
|
}
|
||||||
|
|
||||||
|
function initializeAfterReload() {
|
||||||
|
console.log('🚀 Инициализация интерфейса после перезагрузки...');
|
||||||
|
|
||||||
|
// Создаем навигацию
|
||||||
|
if (typeof createNavigation === 'function') {
|
||||||
|
createNavigation();
|
||||||
|
} else {
|
||||||
|
console.warn('⚠️ createNavigation не найдена, пробуем позже...');
|
||||||
|
setTimeout(() => {
|
||||||
|
if (typeof createNavigation === 'function') {
|
||||||
|
createNavigation();
|
||||||
|
}
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Настраиваем отображение чекбокса удаленных задач
|
||||||
const showDeletedLabel = document.querySelector('.show-deleted-label');
|
const showDeletedLabel = document.querySelector('.show-deleted-label');
|
||||||
if (showDeletedLabel) {
|
if (showDeletedLabel) {
|
||||||
if (currentUser.role === 'admin') {
|
if (currentUser.role === 'admin') {
|
||||||
@@ -97,30 +170,36 @@ function showMainInterface() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadUsers();
|
// Загружаем данные
|
||||||
loadTasks();
|
if (typeof loadUsers === 'function') {
|
||||||
loadActivityLogs();
|
loadUsers();
|
||||||
showSection('tasks');
|
}
|
||||||
loadKanbanTasks();
|
|
||||||
|
|
||||||
showingTasksWithoutDate = false;
|
if (typeof loadTasks === 'function') {
|
||||||
|
loadTasks();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof loadActivityLogs === 'function') {
|
||||||
|
loadActivityLogs();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof loadKanbanTasks === 'function') {
|
||||||
|
loadKanbanTasks();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Показываем секцию задач
|
||||||
|
if (typeof showSection === 'function') {
|
||||||
|
showSection('tasks');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Сбрасываем состояние кнопки задач без даты
|
||||||
|
window.showingTasksWithoutDate = false;
|
||||||
const btn = document.getElementById('tasks-no-date-btn');
|
const btn = document.getElementById('tasks-no-date-btn');
|
||||||
if (btn) btn.classList.remove('active');
|
if (btn) btn.classList.remove('active');
|
||||||
}
|
|
||||||
// Новая функция для создания навигации
|
// Переустанавливаем обработчики событий
|
||||||
function createUserNavigation() {
|
if (typeof setupEventListeners === 'function') {
|
||||||
if (typeof createNavigation === 'function') {
|
setupEventListeners();
|
||||||
console.log('🔄 Создание навигации для пользователя:', currentUser.role);
|
|
||||||
createNavigation();
|
|
||||||
} else {
|
|
||||||
console.warn('⚠️ Функция createNavigation не найдена');
|
|
||||||
// Если функция не загружена, пробуем еще раз через небольшую задержку
|
|
||||||
setTimeout(() => {
|
|
||||||
if (typeof createNavigation === 'function') {
|
|
||||||
console.log('🔄 Повторная попытка создания навигации');
|
|
||||||
createNavigation();
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,6 +251,13 @@ async function logout() {
|
|||||||
await fetch('/api/logout', { method: 'POST' });
|
await fetch('/api/logout', { method: 'POST' });
|
||||||
currentUser = null;
|
currentUser = null;
|
||||||
showLoginInterface();
|
showLoginInterface();
|
||||||
|
|
||||||
|
// Очищаем интерфейс
|
||||||
|
document.querySelector('.container').style.display = 'none';
|
||||||
|
document.querySelectorAll('.section').forEach(section => {
|
||||||
|
section.classList.remove('active');
|
||||||
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Ошибка выхода:', error);
|
console.error('Ошибка выхода:', error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,24 +6,29 @@
|
|||||||
<title>School CRM - Управление задачами</title>
|
<title>School CRM - Управление задачами</title>
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||||
|
<!--
|
||||||
<script src="loading-start.js"></script>
|
<script src="loading-start.js"></script>
|
||||||
|
-->
|
||||||
<script src="auth.js"></script>
|
<script src="auth.js"></script>
|
||||||
|
<!--
|
||||||
<script src="users.js"></script>
|
<script src="users.js"></script>
|
||||||
<script src="ui.js"></script>
|
<script src="ui.js"></script>
|
||||||
<script src="signature.js"></script>
|
|
||||||
<script src="tasks.js"></script>
|
<script src="tasks.js"></script>
|
||||||
<script src="kanban.js"></script>
|
<script src="kanban.js"></script>
|
||||||
<script src="files.js"></script>
|
<script src="files.js"></script>
|
||||||
<script src="profile.js"></script>
|
<script src="profile.js"></script>
|
||||||
<!-- <script src="tasks-type.js"></script> tasks-type.js -->
|
|
||||||
<script src="time-selector.js"></script>
|
<script src="time-selector.js"></script>
|
||||||
<script src="openTaskChat.js"></script>
|
<script src="openTaskChat.js"></script>
|
||||||
<script src="main.js"></script>
|
|
||||||
<script src="tasks_files.js"></script>
|
<script src="tasks_files.js"></script>
|
||||||
<script src="navbar.js"></script>
|
<script src="navbar.js"></script>
|
||||||
<script src="chat-ui.js"></script>
|
<script src="signature.js"></script>
|
||||||
<script src="document-fields.js"></script>
|
<script src="document-fields.js"></script>
|
||||||
|
<script src="chat-ui.js"></script>
|
||||||
|
-->
|
||||||
|
<script src="main.js"></script>
|
||||||
|
<!--
|
||||||
|
<script src="tasks-type.js"></script>
|
||||||
|
-->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="login-modal" class="modal">
|
<div id="login-modal" class="modal">
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
// Конфигурация
|
// Конфигурация
|
||||||
const CONFIG = {
|
const CONFIG = {
|
||||||
maxRetries: 3,
|
maxRetries: 3,
|
||||||
retryDelay: 2000,
|
retryDelay: 5000,
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
showWarnings: true,
|
showWarnings: true,
|
||||||
maxLoadingTime: 15000, // Максимум 15 секунд
|
maxLoadingTime: 15000, // Максимум 15 секунд
|
||||||
minLoadingTime: 5000 // Минимум 5 секунд
|
minLoadingTime: 1000 // Минимум 5 секунд
|
||||||
};
|
};
|
||||||
|
|
||||||
// Генерация случайных цветов для градиента
|
// Генерация случайных цветов для градиента
|
||||||
@@ -124,8 +124,8 @@
|
|||||||
{ emoji: '🔔', text: 'Настройка уведомлений...', weight: 80 },
|
{ emoji: '🔔', text: 'Настройка уведомлений...', weight: 80 },
|
||||||
{ emoji: '💾', text: 'Сохранение кэша...', weight: 85 },
|
{ emoji: '💾', text: 'Сохранение кэша...', weight: 85 },
|
||||||
{ emoji: '✨', text: 'Финальная обработка...', weight: 90 },
|
{ emoji: '✨', text: 'Финальная обработка...', weight: 90 },
|
||||||
{ emoji: '🚀', text: 'Запуск приложения...', weight: 95 },
|
{ emoji: '✅', text: 'Наливаем кофе...', weight: 98 },
|
||||||
{ emoji: '✅', text: 'Почти готово...', weight: 98 }
|
{ emoji: '✅', text: 'Завершено!', weight: 100 }
|
||||||
];
|
];
|
||||||
|
|
||||||
// Дополнительные случайные статусы
|
// Дополнительные случайные статусы
|
||||||
@@ -544,7 +544,7 @@
|
|||||||
const loadedScripts = this.loaded;
|
const loadedScripts = this.loaded;
|
||||||
const totalScripts = this.total;
|
const totalScripts = this.total;
|
||||||
const errors = this.errors.length;
|
const errors = this.errors.length;
|
||||||
const timeElapsed = ((Date.now() - this.startTime) / 1000).toFixed(1);
|
const timeElapsed = ((Date.now() - this.startTime) / 3000).toFixed(1);
|
||||||
|
|
||||||
let detailsHtml = `📊 ${loadedScripts}/${totalScripts} модулей • ⏱️ ${timeElapsed}с`;
|
let detailsHtml = `📊 ${loadedScripts}/${totalScripts} модулей • ⏱️ ${timeElapsed}с`;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user