| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>展厅控制 - {% block title %}{% endblock %}</title>
- <style>
- :root {
- --primary-color: #4ecdc4;
- --secondary-color: #ff6b6b;
- --accent-color: #feca57;
- --dark-text: #333;
- --light-text: #fff;
- --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
- --card-bg: #ffffff;
- --sidebar-width: 260px;
- }
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- body {
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
- background: #f0f2f5;
- min-height: 100vh;
- color: var(--dark-text);
- display: flex;
- }
- /* 侧边栏样式 */
- .sidebar {
- width: var(--sidebar-width);
- background: #2c3e50;
- color: white;
- height: 100vh;
- position: fixed;
- left: 0;
- top: 0;
- display: flex;
- flex-direction: column;
- box-shadow: 2px 0 10px rgba(0,0,0,0.1);
- z-index: 1000;
- }
- .sidebar-header {
- padding: 30px 20px;
- text-align: center;
- border-bottom: 1px solid rgba(255,255,255,0.1);
- }
- .sidebar-header h1 {
- font-size: 1.5em;
- margin-bottom: 5px;
- color: white;
- }
- .sidebar-header p {
- font-size: 0.8em;
- color: #a0aeb9;
- }
- .nav-menu {
- flex: 1;
- padding: 20px 0;
- overflow-y: auto;
- }
- .nav-item {
- padding: 15px 25px;
- cursor: pointer;
- transition: all 0.3s;
- display: flex;
- align-items: center;
- gap: 12px;
- color: #bdc3c7;
- text-decoration: none;
- border-left: 4px solid transparent;
- }
- .nav-item:hover {
- background: rgba(255,255,255,0.05);
- color: white;
- }
- .nav-item.active {
- background: #34495e;
- color: var(--primary-color);
- border-left-color: var(--primary-color);
- }
- .sidebar-footer {
- padding: 20px;
- border-top: 1px solid rgba(255,255,255,0.1);
- }
- .logout-btn {
- display: block;
- text-align: center;
- padding: 10px;
- color: #ff6b6b;
- border: 1px solid #ff6b6b;
- border-radius: 6px;
- text-decoration: none;
- transition: all 0.3s;
- }
- .logout-btn:hover {
- background: #ff6b6b;
- color: white;
- }
- /* 主内容区样式 */
- .main-content {
- margin-left: var(--sidebar-width);
- flex: 1;
- padding: 30px;
- min-height: 100vh;
- background: var(--bg-gradient);
- }
- .module-header {
- margin-bottom: 25px;
- padding-bottom: 15px;
- border-bottom: 2px solid rgba(0,0,0,0.05);
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .module-header h2 {
- font-size: 1.8em;
- color: #2c3e50;
- }
- .sub-section {
- background: var(--card-bg);
- border-radius: 12px;
- padding: 25px;
- margin-bottom: 25px;
- box-shadow: 0 4px 6px rgba(0,0,0,0.05);
- }
- .sub-section h3, .sub-section h4 {
- margin-bottom: 20px;
- color: #2c3e50;
- }
- .control-row {
- display: flex;
- flex-wrap: wrap;
- gap: 20px;
- align-items: flex-end;
- margin-bottom: 20px;
- }
- .control-group {
- flex: 1;
- min-width: 200px;
- }
- label {
- display: block;
- margin-bottom: 8px;
- font-weight: 600;
- color: #555;
- font-size: 0.9em;
- }
- input[type="text"],
- input[type="number"],
- select {
- width: 100%;
- padding: 12px;
- border: 1px solid #ddd;
- border-radius: 8px;
- font-size: 14px;
- transition: border-color 0.3s;
- }
- input[type="text"]:focus,
- input[type="number"]:focus,
- select:focus {
- border-color: var(--primary-color);
- outline: none;
- }
- input[type="file"] {
- padding: 8px 0;
- }
-
- .btn {
- padding: 12px 25px;
- border: none;
- border-radius: 8px;
- cursor: pointer;
- font-size: 14px;
- font-weight: 600;
- transition: all 0.2s;
- color: white;
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
- text-transform: uppercase;
- letter-spacing: 0.5px;
- }
- .btn:active {
- transform: translateY(1px);
- box-shadow: none;
- }
- .btn-primary { background-color: var(--primary-color); }
- .btn-primary:hover { background-color: #3dbdb4; }
- .btn-secondary { background-color: var(--secondary-color); }
- .btn-secondary:hover { background-color: #ff5252; }
- .btn-warning { background-color: var(--accent-color); color: #333; }
- .btn-warning:hover { background-color: #fdbf38; }
- .btn-info { background-color: #667eea; }
- .btn-info:hover { background-color: #5a6fd6; }
- /* Status & Message */
- .status-display {
- background: #e8f5e8;
- border: 1px solid #c8e6c9;
- color: #2e7d32;
- padding: 15px;
- border-radius: 8px;
- margin-top: 15px;
- font-size: 0.9em;
- }
- .status-display p { margin: 5px 0; }
-
- .message-box {
- position: fixed;
- top: 20px;
- right: 20px;
- padding: 15px 25px;
- border-radius: 8px;
- color: white;
- display: none;
- z-index: 3000;
- box-shadow: 0 4px 12px rgba(0,0,0,0.15);
- animation: slideIn 0.3s ease-out;
- }
- @keyframes slideIn {
- from { transform: translateX(100%); opacity: 0; }
- to { transform: translateX(0); opacity: 1; }
- }
- @keyframes slideInMobile {
- from { transform: translateY(120%); opacity: 0; }
- to { transform: translateY(0); opacity: 1; }
- }
- .msg-success { background-color: #4caf50; }
- .msg-error { background-color: #f44336; }
-
- .loading-overlay {
- position: fixed;
- top: 0; left: 0; right: 0; bottom: 0;
- background: rgba(255,255,255,0.7);
- display: none;
- justify-content: center;
- align-items: center;
- z-index: 4000;
- font-size: 1.2em;
- color: #555;
- flex-direction: column;
- }
- /* —— 移动端顶栏与抽屉导航(默认隐藏,见媒体查询)—— */
- .mobile-topbar {
- display: none;
- align-items: center;
- gap: 12px;
- padding: 10px 14px;
- padding-left: max(14px, env(safe-area-inset-left, 0px));
- padding-right: max(14px, env(safe-area-inset-right, 0px));
- padding-top: max(10px, env(safe-area-inset-top, 0px));
- background: #2c3e50;
- color: #fff;
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- z-index: 998;
- min-height: 48px;
- box-shadow: 0 2px 8px rgba(0,0,0,0.15);
- }
- .mobile-menu-btn {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 44px;
- height: 44px;
- margin: -6px 0 -6px -8px;
- padding: 0;
- border: none;
- border-radius: 8px;
- background: rgba(255,255,255,0.12);
- color: #fff;
- font-size: 1.35rem;
- line-height: 1;
- cursor: pointer;
- -webkit-tap-highlight-color: transparent;
- }
- .mobile-menu-btn:active {
- background: rgba(255,255,255,0.22);
- }
- .mobile-topbar-title {
- font-weight: 600;
- font-size: 1.05rem;
- flex: 1;
- min-width: 0;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .sidebar-backdrop {
- display: none;
- position: fixed;
- inset: 0;
- background: rgba(0,0,0,0.45);
- z-index: 999;
- -webkit-tap-highlight-color: transparent;
- }
- .sidebar-backdrop.is-visible {
- display: block;
- }
- body.nav-open {
- overflow: hidden;
- touch-action: none;
- }
- @media (max-width: 768px) {
- .mobile-topbar {
- display: flex;
- }
- .sidebar {
- transform: translateX(-100%);
- transition: transform 0.25s ease;
- box-shadow: none;
- }
- .sidebar.sidebar-open {
- transform: translateX(0);
- box-shadow: 4px 0 24px rgba(0,0,0,0.25);
- }
- .main-content {
- margin-left: 0;
- width: 100%;
- padding: 16px;
- padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
- padding-top: calc(56px + env(safe-area-inset-top, 0px));
- }
- .module-header {
- flex-wrap: wrap;
- gap: 8px;
- }
- .module-header h2 {
- font-size: 1.35rem;
- }
- .sub-section {
- padding: 16px;
- }
- .control-row {
- flex-direction: column;
- align-items: stretch;
- }
- .control-group {
- min-width: 100%;
- flex: 1 1 auto !important;
- }
- input[type="text"],
- input[type="number"],
- input[type="email"],
- input[type="password"],
- select,
- textarea {
- font-size: 16px;
- }
- .btn {
- min-height: 44px;
- padding: 12px 20px;
- }
- .nav-item {
- min-height: 48px;
- padding: 14px 22px;
- }
- .logout-btn {
- min-height: 44px;
- padding: 12px;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .message-box {
- left: 12px;
- right: 12px;
- top: auto;
- bottom: max(16px, env(safe-area-inset-bottom, 0px));
- max-width: none;
- padding: 14px 18px;
- text-align: center;
- animation-name: slideInMobile;
- }
- }
- /* 模块特定样式 */
- {% block extra_styles %}{% endblock %}
- </style>
- </head>
- <body>
- <header class="mobile-topbar" id="mobileTopbar" aria-hidden="false">
- <button type="button" class="mobile-menu-btn" id="mobileMenuBtn" aria-label="打开导航菜单" aria-expanded="false">☰</button>
- <span class="mobile-topbar-title">展厅控制</span>
- </header>
- <div class="sidebar-backdrop" id="sidebarBackdrop" aria-hidden="true"></div>
- <!-- 侧边栏 -->
- <div class="sidebar" id="sidebar">
- <div class="sidebar-header">
- <h1>展厅控制</h1>
- <p>Admin Dashboard</p>
- </div>
- <nav class="nav-menu">
- <a href="{{ url_for('main.kodi_page') }}" class="nav-item {% if active_page == 'kodi' %}active{% endif %}">
- <span>📺</span> 电视控制 (Kodi)
- </a>
- <a href="{{ url_for('main.door_page') }}" class="nav-item {% if active_page == 'door' %}active{% endif %}">
- <span>🚪</span> 办公楼大门
- </a>
- <a href="{{ url_for('main.led_page') }}" class="nav-item {% if active_page == 'led' %}active{% endif %}">
- <span>💡</span> 展品灯座
- </a>
- <a href="{{ url_for('main.ha_page') }}" class="nav-item {% if active_page == 'ha' %}active{% endif %}">
- <span>💡</span> 展厅灯光
- </a>
- <a href="{{ url_for('main.self_check_page') }}" class="nav-item {% if active_page == 'self_check' %}active{% endif %}">
- <span>🛡️</span> 设备自检
- </a>
- <a href="{{ url_for('main.attachment_test_page') }}" class="nav-item {% if active_page == 'attachment_test' %}active{% endif %}">
- <span>📎</span> 附件上传测试
- </a>
- </nav>
- <div class="sidebar-footer">
- <a href="/logout" class="logout-btn">退出登录</a>
- </div>
- </div>
- <!-- 主内容区 -->
- <div class="main-content">
- {% block content %}
- {% endblock %}
- </div>
- <!-- 消息提示与遮罩 -->
- <div id="messageBox" class="message-box"></div>
- <div id="loadingOverlay" class="loading-overlay">
- <div><span style="font-size: 2em;">⏳</span><br>处理中...</div>
- </div>
- <script>
- // 通用函数
- function showMessage(message, type = 'success') {
- const msgBox = document.getElementById('messageBox');
- msgBox.textContent = message;
- msgBox.className = 'message-box ' + (type === 'success' ? 'msg-success' : 'msg-error');
- msgBox.style.display = 'block';
-
- // 重新触发动画
- msgBox.style.animation = 'none';
- msgBox.offsetHeight; /* trigger reflow */
- msgBox.style.animation = null;
- setTimeout(() => {
- msgBox.style.display = 'none';
- }, 3000);
- }
- function showLoading(show = true) {
- document.getElementById('loadingOverlay').style.display = show ? 'flex' : 'none';
- }
- (function () {
- const mq = window.matchMedia('(max-width: 768px)');
- const sidebar = document.getElementById('sidebar');
- const backdrop = document.getElementById('sidebarBackdrop');
- const menuBtn = document.getElementById('mobileMenuBtn');
- function closeMobileNav() {
- sidebar.classList.remove('sidebar-open');
- backdrop.classList.remove('is-visible');
- document.body.classList.remove('nav-open');
- backdrop.setAttribute('aria-hidden', 'true');
- if (menuBtn) {
- menuBtn.setAttribute('aria-expanded', 'false');
- }
- }
- function openMobileNav() {
- sidebar.classList.add('sidebar-open');
- backdrop.classList.add('is-visible');
- document.body.classList.add('nav-open');
- backdrop.setAttribute('aria-hidden', 'false');
- if (menuBtn) {
- menuBtn.setAttribute('aria-expanded', 'true');
- }
- }
- function toggleMobileNav() {
- if (sidebar.classList.contains('sidebar-open')) {
- closeMobileNav();
- } else {
- openMobileNav();
- }
- }
- if (menuBtn) {
- menuBtn.addEventListener('click', toggleMobileNav);
- }
- if (backdrop) {
- backdrop.addEventListener('click', closeMobileNav);
- }
- document.querySelectorAll('#sidebar .nav-item, #sidebar .logout-btn').forEach(function (el) {
- el.addEventListener('click', function () {
- if (mq.matches) {
- closeMobileNav();
- }
- });
- });
- window.addEventListener('resize', function () {
- if (!mq.matches) {
- closeMobileNav();
- }
- });
- document.addEventListener('keydown', function (e) {
- if (e.key === 'Escape' && mq.matches) {
- closeMobileNav();
- }
- });
- })();
- </script>
- {% block scripts %}
- {% endblock %}
- </body>
- </html>
|