Опубликовано через кнопку
This commit is contained in:
parent
2481bd18f8
commit
f81a2d4bdf
45
index.html
45
index.html
@ -30,12 +30,14 @@ input:focus,select:focus,textarea:focus{outline:2px solid var(--cyan);border-col
|
|||||||
.nav-links{display:flex;gap:16px}
|
.nav-links{display:flex;gap:16px}
|
||||||
.nav-links a{color:var(--white);text-decoration:none;font-weight:600;font-size:14px;white-space:nowrap}
|
.nav-links a{color:var(--white);text-decoration:none;font-weight:600;font-size:14px;white-space:nowrap}
|
||||||
.nav-links a:hover{color:var(--cyan)}
|
.nav-links a:hover{color:var(--cyan)}
|
||||||
|
.nav-links a.admin-only{display:none}
|
||||||
.mobile-menu-btn{display:none;background:none;border:none;color:var(--white);font-size:28px;cursor:pointer;padding:4px}
|
.mobile-menu-btn{display:none;background:none;border:none;color:var(--white);font-size:28px;cursor:pointer;padding:4px}
|
||||||
.mobile-menu{display:none;position:fixed;top:52px;left:0;right:0;background:var(--ink);padding:16px;z-index:99;box-shadow:0 4px 12px rgba(0,0,0,0.3);max-height:80vh;overflow-y:auto}
|
.mobile-menu{display:none;position:fixed;top:52px;left:0;right:0;background:var(--ink);padding:16px;z-index:99;box-shadow:0 4px 12px rgba(0,0,0,0.3);max-height:80vh;overflow-y:auto}
|
||||||
.mobile-menu.show{display:block}
|
.mobile-menu.show{display:block}
|
||||||
.mobile-menu a{display:block;color:var(--white);padding:14px 0;text-decoration:none;font-size:17px;border-bottom:1px solid rgba(255,255,255,0.08)}
|
.mobile-menu a{display:block;color:var(--white);padding:14px 0;text-decoration:none;font-size:17px;border-bottom:1px solid rgba(255,255,255,0.08)}
|
||||||
.mobile-menu a:last-child{border-bottom:none}
|
.mobile-menu a:last-child{border-bottom:none}
|
||||||
.mobile-menu a:hover{color:var(--cyan)}
|
.mobile-menu a:hover{color:var(--cyan)}
|
||||||
|
.mobile-menu a.admin-only{display:none}
|
||||||
.mobile-menu-btn{display:none;background:none;border:none;color:var(--white);font-size:24px;cursor:pointer}
|
.mobile-menu-btn{display:none;background:none;border:none;color:var(--white);font-size:24px;cursor:pointer}
|
||||||
.mobile-menu{display:none;position:fixed;top:60px;left:0;right:0;background:var(--ink);padding:20px;z-index:99;box-shadow:0 4px 12px rgba(0,0,0,0.3)}
|
.mobile-menu{display:none;position:fixed;top:60px;left:0;right:0;background:var(--ink);padding:20px;z-index:99;box-shadow:0 4px 12px rgba(0,0,0,0.3)}
|
||||||
.mobile-menu a{display:block;color:var(--white);padding:16px 0;text-decoration:none;font-size:18px;border-bottom:1px solid rgba(255,255,255,0.1)}
|
.mobile-menu a{display:block;color:var(--white);padding:16px 0;text-decoration:none;font-size:18px;border-bottom:1px solid rgba(255,255,255,0.1)}
|
||||||
@ -89,7 +91,7 @@ input,select,textarea{font-size:16px;padding:12px;border-radius:8px;margin-botto
|
|||||||
<a href="#" onclick="showPage('home');return false">Тесттер</a>
|
<a href="#" onclick="showPage('home');return false">Тесттер</a>
|
||||||
<a href="#" onclick="showPage('videos');return false">Видео</a>
|
<a href="#" onclick="showPage('videos');return false">Видео</a>
|
||||||
<a href="#" onclick="showPage('dashboard');return false">Дашборд</a>
|
<a href="#" onclick="showPage('dashboard');return false">Дашборд</a>
|
||||||
<a href="#" onclick="showPage('admin');return false">Админ</a>
|
<a href="#" onclick="showPage('admin');return false" class="admin-only" id="navAdminLink">Админ</a>
|
||||||
<a href="#" onclick="showPage('login');return false" id="loginLink">Кіру</a>
|
<a href="#" onclick="showPage('login');return false" id="loginLink">Кіру</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -97,7 +99,7 @@ input,select,textarea{font-size:16px;padding:12px;border-radius:8px;margin-botto
|
|||||||
<a href="#" onclick="showPage('home');toggleMobileMenu()">Тесттер</a>
|
<a href="#" onclick="showPage('home');toggleMobileMenu()">Тесттер</a>
|
||||||
<a href="#" onclick="showPage('videos');toggleMobileMenu()">Видео</a>
|
<a href="#" onclick="showPage('videos');toggleMobileMenu()">Видео</a>
|
||||||
<a href="#" onclick="showPage('dashboard');toggleMobileMenu()">Дашборд</a>
|
<a href="#" onclick="showPage('dashboard');toggleMobileMenu()">Дашборд</a>
|
||||||
<a href="#" onclick="showPage('admin');toggleMobileMenu()">Админ</a>
|
<a href="#" onclick="showPage('admin');toggleMobileMenu()" class="admin-only" id="mobileNavAdminLink">Админ</a>
|
||||||
<a href="#" onclick="showPage('login');toggleMobileMenu()" id="mobileLoginLink">Кіру</a>
|
<a href="#" onclick="showPage('login');toggleMobileMenu()" id="mobileLoginLink">Кіру</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
@ -292,8 +294,9 @@ let currentTest = null;
|
|||||||
let currentQuestionIndex = 0;
|
let currentQuestionIndex = 0;
|
||||||
let userAnswers = [];
|
let userAnswers = [];
|
||||||
let testStartTime = null;
|
let testStartTime = null;
|
||||||
const ADMIN_PHONE = '77777777777';
|
const ADMIN_PHONE = '77474700532';
|
||||||
const ADMIN_PASS = 'admin123';
|
const ADMIN_PASS = 'Aa123456';
|
||||||
|
const ADMIN_NAME = 'Бижігіт Айбек';
|
||||||
|
|
||||||
// USER DATA - локальды сақтау
|
// USER DATA - локальды сақтау
|
||||||
function getUserData() {
|
function getUserData() {
|
||||||
@ -340,10 +343,25 @@ function unbanStudent(phone) {
|
|||||||
|
|
||||||
// PAGE NAVIGATION
|
// PAGE NAVIGATION
|
||||||
function showPage(pageId) {
|
function showPage(pageId) {
|
||||||
|
// Check admin-only pages
|
||||||
|
if (pageId === 'admin' && currentUser !== 'admin') {
|
||||||
|
alert('⛔ Админ панельге кіру рұқсаты жоқ!');
|
||||||
|
showPage('home');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
document.querySelectorAll('.page').forEach(p => p.classList.remove('active'));
|
document.querySelectorAll('.page').forEach(p => p.classList.remove('active'));
|
||||||
document.getElementById(pageId).classList.add('active');
|
document.getElementById(pageId).classList.add('active');
|
||||||
if (pageId === 'dashboard') updateDashboard();
|
if (pageId === 'dashboard') updateDashboard();
|
||||||
if (pageId === 'admin') updateAdminList();
|
if (pageId === 'admin') {
|
||||||
|
if (currentUser === 'admin') {
|
||||||
|
updateAdminList();
|
||||||
|
renderStudentsList();
|
||||||
|
} else {
|
||||||
|
showPage('home');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (pageId === 'home') { renderTopics(); renderRecentTests(); }
|
if (pageId === 'home') { renderTopics(); renderRecentTests(); }
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
}
|
}
|
||||||
@ -353,6 +371,13 @@ function toggleMobileMenu() {
|
|||||||
menu.classList.toggle('show');
|
menu.classList.toggle('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateAdminLinks() {
|
||||||
|
const isAdmin = currentUser === 'admin';
|
||||||
|
document.querySelectorAll('.admin-only').forEach(el => {
|
||||||
|
el.style.display = isAdmin ? 'block' : 'none';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// RENDER TOPICS
|
// RENDER TOPICS
|
||||||
async function renderTopics() {
|
async function renderTopics() {
|
||||||
const grid = document.getElementById('topicsGrid');
|
const grid = document.getElementById('topicsGrid');
|
||||||
@ -857,11 +882,13 @@ document.getElementById('loginForm').addEventListener('submit', function(e) {
|
|||||||
// Admin check
|
// Admin check
|
||||||
if (phone === ADMIN_PHONE && password === ADMIN_PASS) {
|
if (phone === ADMIN_PHONE && password === ADMIN_PASS) {
|
||||||
currentUser = 'admin';
|
currentUser = 'admin';
|
||||||
document.getElementById('loginLink').textContent = '👑 Админ';
|
const adminName = ADMIN_NAME;
|
||||||
document.getElementById('mobileLoginLink').textContent = '👑 Админ';
|
document.getElementById('loginLink').textContent = '👑 ' + adminName;
|
||||||
|
document.getElementById('mobileLoginLink').textContent = '👑 ' + adminName;
|
||||||
|
updateAdminLinks();
|
||||||
showPage('admin');
|
showPage('admin');
|
||||||
renderStudentsList();
|
renderStudentsList();
|
||||||
alert('Қош келдіңіз, Админ!');
|
alert('Қош келдіңіз, ' + adminName + '!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -878,6 +905,7 @@ document.getElementById('loginForm').addEventListener('submit', function(e) {
|
|||||||
const name = students[phone].name || phone;
|
const name = students[phone].name || phone;
|
||||||
document.getElementById('loginLink').textContent = '👤 ' + name;
|
document.getElementById('loginLink').textContent = '👤 ' + name;
|
||||||
document.getElementById('mobileLoginLink').textContent = '👤 ' + name;
|
document.getElementById('mobileLoginLink').textContent = '👤 ' + name;
|
||||||
|
updateAdminLinks();
|
||||||
showPage('home');
|
showPage('home');
|
||||||
alert('Қош келдіңіз, ' + name + '!');
|
alert('Қош келдіңіз, ' + name + '!');
|
||||||
} else {
|
} else {
|
||||||
@ -918,6 +946,7 @@ document.getElementById('registerForm').addEventListener('submit', function(e) {
|
|||||||
renderTopics();
|
renderTopics();
|
||||||
renderRecentTests();
|
renderRecentTests();
|
||||||
renderVideos();
|
renderVideos();
|
||||||
|
updateAdminLinks();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user