multy-stub/server/routers/questioneer/public/index.html

79 lines
2.7 KiB
HTML
Raw Normal View History

2025-03-11 23:50:50 +03:00
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Анонимные опросы</title>
2025-03-12 00:09:36 +03:00
<!-- Добавляем проверку на различные пути -->
<script>
// Определяем путь к статическим файлам с учетом prod и dev окружений
function getStaticPath() {
const pathname = window.location.pathname;
if (pathname.includes('/ms/questioneer')) {
// Для продакшна
return '/ms/questioneer/static';
} else {
// Для локальной разработки
// Если путь заканчивается на слеш или на /questioneer, добавляем /static
if (pathname.endsWith('/') || pathname.endsWith('/questioneer')) {
return pathname + '/static';
2025-03-12 00:09:36 +03:00
} else {
return pathname + '/static';
}
}
}
// Динамически добавляем CSS
const cssLink = document.createElement('link');
cssLink.rel = 'stylesheet';
cssLink.href = getStaticPath() + '/css/style.css';
document.head.appendChild(cssLink);
</script>
<!-- Добавляем jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Динамически добавляем скрипты
const scriptPaths = [
'/js/common.js',
'/js/index.js'
];
const staticPath = getStaticPath();
scriptPaths.forEach(path => {
const script = document.createElement('script');
script.src = staticPath + path;
document.body.appendChild(script);
});
});
</script>
2025-03-11 23:50:50 +03:00
</head>
<body>
<!-- Навигационная шапка -->
<header class="nav-header">
<div class="nav-container">
<a href="/questioneer" class="nav-logo">Анонимные опросы</a>
<nav class="nav-menu">
<a href="/questioneer" class="nav-link active">Главная</a>
<a href="/questioneer/create" class="nav-link">Создать опрос</a>
</nav>
</div>
</header>
<div class="container">
<h1>Сервис анонимных опросов</h1>
<div class="main-buttons">
<a href="/questioneer/create" class="btn">Создать новый опрос</a>
</div>
<div class="questionnaires-list">
<h2>Ваши опросы</h2>
<div id="questionnaires-container">
<p>Загрузка опросов...</p>
</div>
</div>
</div>
</body>
</html>