61 lines
2.7 KiB
PHP
Executable File
61 lines
2.7 KiB
PHP
Executable File
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title><?= h($pageTitle ?? '兑换码管理系统') ?></title>
|
|
<link rel="stylesheet" href="assets/css/style.css">
|
|
</head>
|
|
<body>
|
|
<?php $enabledProducts = getEnabledProducts(); ?>
|
|
<nav class="navbar">
|
|
<div class="nav-container">
|
|
<a href="index.php" class="nav-brand">兑换码管理系统</a>
|
|
<?php if (count($enabledProducts) > 0): $pid = getCurrentProductId(); ?>
|
|
<div class="product-switcher">
|
|
<select onchange="switchProduct(this)" style="padding:4px 8px;border:1px solid rgba(255,255,255,0.2);border-radius:4px;background:rgba(255,255,255,0.1);color:#fff;font-size:13px;cursor:pointer;">
|
|
<?php foreach ($enabledProducts as $p): ?>
|
|
<option value="<?= $p['id'] ?>" <?= $pid == $p['id'] ? 'selected' : '' ?>><?= h($p['name']) ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<?php endif; ?>
|
|
<button class="nav-toggle" id="navToggle">☰</button>
|
|
<div class="nav-menu" id="navMenu">
|
|
<a href="query_code.php" class="nav-link">查询兑换码</a>
|
|
<a href="claim_records.php" class="nav-link">领取记录</a>
|
|
<a href="work_order_records.php" class="nav-link">工单记录</a>
|
|
<a href="bill_records.php" class="nav-link">账单管理</a>
|
|
<?php if (isset($_SESSION['role']) && $_SESSION['role'] === 'admin'): ?>
|
|
<a href="work_order_manage.php" class="nav-link">工单管理</a>
|
|
<a href="code_manage.php" class="nav-link">库存管理</a>
|
|
<a href="product_manage.php" class="nav-link">产品管理</a>
|
|
<a href="admin_settings.php" class="nav-link">后台设置</a>
|
|
<?php endif; ?>
|
|
<span class="nav-user"><?= h($_SESSION['username'] ?? '') ?></span>
|
|
<a href="logout.php" class="nav-link nav-logout">退出</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
<main class="container">
|
|
<script>
|
|
document.getElementById('navToggle')?.addEventListener('click', function() {
|
|
document.getElementById('navMenu').classList.toggle('active');
|
|
});
|
|
(function() {
|
|
var current = window.location.pathname.split('/').pop();
|
|
var links = document.querySelectorAll('.nav-menu .nav-link');
|
|
for (var i = 0; i < links.length; i++) {
|
|
var href = links[i].getAttribute('href');
|
|
if (href === current) {
|
|
links[i].classList.add('nav-active');
|
|
}
|
|
}
|
|
})();
|
|
function switchProduct(el) {
|
|
var url = new URL(window.location.href);
|
|
url.searchParams.set('set_product', el.value);
|
|
window.location.href = url.toString();
|
|
}
|
|
</script>
|