78 lines
2.6 KiB
HTML
78 lines
2.6 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="ru">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Участие в опросе</title>
|
||
<!-- Добавляем проверку на различные пути -->
|
||
<script>
|
||
// Определяем путь к статическим файлам с учетом prod и dev окружений
|
||
function getStaticPath() {
|
||
if (window.location.pathname.includes('/ms/questioneer')) {
|
||
// Для продакшна
|
||
return '/ms/questioneer/static';
|
||
} else {
|
||
// Для локальной разработки
|
||
const basePath = window.location.pathname.split('/poll')[0];
|
||
// Проверяем, заканчивается ли путь на слеш
|
||
return basePath + (basePath.endsWith('/') ? 'static' : '/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/poll.js'
|
||
];
|
||
|
||
const staticPath = getStaticPath();
|
||
scriptPaths.forEach(path => {
|
||
const script = document.createElement('script');
|
||
script.src = staticPath + path;
|
||
document.body.appendChild(script);
|
||
});
|
||
});
|
||
</script>
|
||
</head>
|
||
<body>
|
||
<div class="container">
|
||
<div id="loading">Загрузка опроса...</div>
|
||
|
||
<div id="questionnaire-container" style="display: none;">
|
||
<div class="questionnaire-header">
|
||
<h1 id="questionnaire-title"></h1>
|
||
<p id="questionnaire-description"></p>
|
||
</div>
|
||
|
||
<form id="poll-form">
|
||
<div id="questions-container"></div>
|
||
|
||
<div class="form-actions">
|
||
<button type="submit" class="btn btn-primary">Отправить ответы</button>
|
||
</div>
|
||
</form>
|
||
|
||
<div id="results-container" style="display: none;">
|
||
<h2>Спасибо за участие!</h2>
|
||
<p>Ваши ответы были успешно отправлены.</p>
|
||
|
||
<div class="poll-results">
|
||
<h3>Текущие результаты:</h3>
|
||
<div id="poll-results-container"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
</html> |