base.html 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>展厅控制 - {% block title %}{% endblock %}</title>
  7. <style>
  8. :root {
  9. --primary-color: #4ecdc4;
  10. --secondary-color: #ff6b6b;
  11. --accent-color: #feca57;
  12. --dark-text: #333;
  13. --light-text: #fff;
  14. --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  15. --card-bg: #ffffff;
  16. --sidebar-width: 260px;
  17. }
  18. * {
  19. margin: 0;
  20. padding: 0;
  21. box-sizing: border-box;
  22. }
  23. body {
  24. font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  25. background: #f0f2f5;
  26. min-height: 100vh;
  27. color: var(--dark-text);
  28. display: flex;
  29. }
  30. /* 侧边栏样式 */
  31. .sidebar {
  32. width: var(--sidebar-width);
  33. background: #2c3e50;
  34. color: white;
  35. height: 100vh;
  36. position: fixed;
  37. left: 0;
  38. top: 0;
  39. display: flex;
  40. flex-direction: column;
  41. box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  42. z-index: 1000;
  43. }
  44. .sidebar-header {
  45. padding: 30px 20px;
  46. text-align: center;
  47. border-bottom: 1px solid rgba(255,255,255,0.1);
  48. }
  49. .sidebar-header h1 {
  50. font-size: 1.5em;
  51. margin-bottom: 5px;
  52. color: white;
  53. }
  54. .sidebar-header p {
  55. font-size: 0.8em;
  56. color: #a0aeb9;
  57. }
  58. .nav-menu {
  59. flex: 1;
  60. padding: 20px 0;
  61. overflow-y: auto;
  62. }
  63. .nav-item {
  64. padding: 15px 25px;
  65. cursor: pointer;
  66. transition: all 0.3s;
  67. display: flex;
  68. align-items: center;
  69. gap: 12px;
  70. color: #bdc3c7;
  71. text-decoration: none;
  72. border-left: 4px solid transparent;
  73. }
  74. .nav-item:hover {
  75. background: rgba(255,255,255,0.05);
  76. color: white;
  77. }
  78. .nav-item.active {
  79. background: #34495e;
  80. color: var(--primary-color);
  81. border-left-color: var(--primary-color);
  82. }
  83. .sidebar-footer {
  84. padding: 20px;
  85. border-top: 1px solid rgba(255,255,255,0.1);
  86. }
  87. .logout-btn {
  88. display: block;
  89. text-align: center;
  90. padding: 10px;
  91. color: #ff6b6b;
  92. border: 1px solid #ff6b6b;
  93. border-radius: 6px;
  94. text-decoration: none;
  95. transition: all 0.3s;
  96. }
  97. .logout-btn:hover {
  98. background: #ff6b6b;
  99. color: white;
  100. }
  101. /* 主内容区样式 */
  102. .main-content {
  103. margin-left: var(--sidebar-width);
  104. flex: 1;
  105. padding: 30px;
  106. min-height: 100vh;
  107. background: var(--bg-gradient);
  108. }
  109. .module-header {
  110. margin-bottom: 25px;
  111. padding-bottom: 15px;
  112. border-bottom: 2px solid rgba(0,0,0,0.05);
  113. display: flex;
  114. justify-content: space-between;
  115. align-items: center;
  116. }
  117. .module-header h2 {
  118. font-size: 1.8em;
  119. color: #2c3e50;
  120. }
  121. .sub-section {
  122. background: var(--card-bg);
  123. border-radius: 12px;
  124. padding: 25px;
  125. margin-bottom: 25px;
  126. box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  127. }
  128. .sub-section h3, .sub-section h4 {
  129. margin-bottom: 20px;
  130. color: #2c3e50;
  131. }
  132. .control-row {
  133. display: flex;
  134. flex-wrap: wrap;
  135. gap: 20px;
  136. align-items: flex-end;
  137. margin-bottom: 20px;
  138. }
  139. .control-group {
  140. flex: 1;
  141. min-width: 200px;
  142. }
  143. label {
  144. display: block;
  145. margin-bottom: 8px;
  146. font-weight: 600;
  147. color: #555;
  148. font-size: 0.9em;
  149. }
  150. input[type="text"],
  151. input[type="number"],
  152. select {
  153. width: 100%;
  154. padding: 12px;
  155. border: 1px solid #ddd;
  156. border-radius: 8px;
  157. font-size: 14px;
  158. transition: border-color 0.3s;
  159. }
  160. input[type="text"]:focus,
  161. input[type="number"]:focus,
  162. select:focus {
  163. border-color: var(--primary-color);
  164. outline: none;
  165. }
  166. input[type="file"] {
  167. padding: 8px 0;
  168. }
  169. .btn {
  170. padding: 12px 25px;
  171. border: none;
  172. border-radius: 8px;
  173. cursor: pointer;
  174. font-size: 14px;
  175. font-weight: 600;
  176. transition: all 0.2s;
  177. color: white;
  178. box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  179. text-transform: uppercase;
  180. letter-spacing: 0.5px;
  181. }
  182. .btn:active {
  183. transform: translateY(1px);
  184. box-shadow: none;
  185. }
  186. .btn-primary { background-color: var(--primary-color); }
  187. .btn-primary:hover { background-color: #3dbdb4; }
  188. .btn-secondary { background-color: var(--secondary-color); }
  189. .btn-secondary:hover { background-color: #ff5252; }
  190. .btn-warning { background-color: var(--accent-color); color: #333; }
  191. .btn-warning:hover { background-color: #fdbf38; }
  192. .btn-info { background-color: #667eea; }
  193. .btn-info:hover { background-color: #5a6fd6; }
  194. /* Status & Message */
  195. .status-display {
  196. background: #e8f5e8;
  197. border: 1px solid #c8e6c9;
  198. color: #2e7d32;
  199. padding: 15px;
  200. border-radius: 8px;
  201. margin-top: 15px;
  202. font-size: 0.9em;
  203. }
  204. .status-display p { margin: 5px 0; }
  205. .message-box {
  206. position: fixed;
  207. top: 20px;
  208. right: 20px;
  209. padding: 15px 25px;
  210. border-radius: 8px;
  211. color: white;
  212. display: none;
  213. z-index: 3000;
  214. box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  215. animation: slideIn 0.3s ease-out;
  216. }
  217. @keyframes slideIn {
  218. from { transform: translateX(100%); opacity: 0; }
  219. to { transform: translateX(0); opacity: 1; }
  220. }
  221. .msg-success { background-color: #4caf50; }
  222. .msg-error { background-color: #f44336; }
  223. .loading-overlay {
  224. position: fixed;
  225. top: 0; left: 0; right: 0; bottom: 0;
  226. background: rgba(255,255,255,0.7);
  227. display: none;
  228. justify-content: center;
  229. align-items: center;
  230. z-index: 4000;
  231. font-size: 1.2em;
  232. color: #555;
  233. flex-direction: column;
  234. }
  235. /* 模块特定样式 */
  236. {% block extra_styles %}{% endblock %}
  237. </style>
  238. </head>
  239. <body>
  240. <!-- 侧边栏 -->
  241. <div class="sidebar">
  242. <div class="sidebar-header">
  243. <h1>展厅控制</h1>
  244. <p>Admin Dashboard</p>
  245. </div>
  246. <nav class="nav-menu">
  247. <a href="{{ url_for('main.kodi_page') }}" class="nav-item {% if active_page == 'kodi' %}active{% endif %}">
  248. <span>📺</span> 电视控制 (Kodi)
  249. </a>
  250. <a href="{{ url_for('main.door_page') }}" class="nav-item {% if active_page == 'door' %}active{% endif %}">
  251. <span>🚪</span> 办公楼大门
  252. </a>
  253. <a href="{{ url_for('main.led_page') }}" class="nav-item {% if active_page == 'led' %}active{% endif %}">
  254. <span>💡</span> 展品灯座
  255. </a>
  256. <a href="{{ url_for('main.ha_page') }}" class="nav-item {% if active_page == 'ha' %}active{% endif %}">
  257. <span>💡</span> 展厅灯光
  258. </a>
  259. </nav>
  260. <div class="sidebar-footer">
  261. <a href="/logout" class="logout-btn">退出登录</a>
  262. </div>
  263. </div>
  264. <!-- 主内容区 -->
  265. <div class="main-content">
  266. {% block content %}
  267. {% endblock %}
  268. </div>
  269. <!-- 消息提示与遮罩 -->
  270. <div id="messageBox" class="message-box"></div>
  271. <div id="loadingOverlay" class="loading-overlay">
  272. <div><span style="font-size: 2em;">⏳</span><br>处理中...</div>
  273. </div>
  274. <script>
  275. // 通用函数
  276. function showMessage(message, type = 'success') {
  277. const msgBox = document.getElementById('messageBox');
  278. msgBox.textContent = message;
  279. msgBox.className = 'message-box ' + (type === 'success' ? 'msg-success' : 'msg-error');
  280. msgBox.style.display = 'block';
  281. // 重新触发动画
  282. msgBox.style.animation = 'none';
  283. msgBox.offsetHeight; /* trigger reflow */
  284. msgBox.style.animation = null;
  285. setTimeout(() => {
  286. msgBox.style.display = 'none';
  287. }, 3000);
  288. }
  289. function showLoading(show = true) {
  290. document.getElementById('loadingOverlay').style.display = show ? 'flex' : 'none';
  291. }
  292. </script>
  293. {% block scripts %}
  294. {% endblock %}
  295. </body>
  296. </html>