nacho commited on
Commit
901c28a
·
1 Parent(s): 72b39bd

feat: 新增控制台日间模式及一键切换

Browse files
Files changed (1) hide show
  1. static/index.html +34 -0
static/index.html CHANGED
@@ -16,6 +16,23 @@
16
  --radius:16px;--radius-sm:10px;--radius-xs:8px;
17
  --font-ui:'Inter',system-ui,sans-serif;--font-mono:'JetBrains Mono',monospace;
18
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  *{box-sizing:border-box;margin:0;padding:0}
20
  body{font-family:var(--font-ui);background:var(--bg);color:var(--text);font-size:14px;line-height:1.6;min-height:100vh;overflow-x:hidden}
21
  body::before{content:'';position:fixed;inset:0;background:radial-gradient(ellipse 80% 50% at 50% -20%,hsla(217,92%,60%,.06),transparent 70%);pointer-events:none;z-index:0}
@@ -174,6 +191,7 @@ select{cursor:pointer;appearance:none;background-image:url("data:image/svg+xml,%
174
  <span class="si"><span class="dot" style="background:var(--amber)"></span> 使用中 <b>—</b></span>
175
  <span class="si"><span class="dot" style="background:var(--text-dim)"></span> 排队 <b>—</b></span>
176
  </div>
 
177
  <div class="poll-indicator" id="pollDot"></div>
178
  </div>
179
 
@@ -323,6 +341,22 @@ const LS={
323
  set(k,v){try{localStorage.setItem('ds2_'+k,v)}catch(e){}}
324
  };
325
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  let _adminKey='';
327
 
328
  // ── Auth Gate ──
 
16
  --radius:16px;--radius-sm:10px;--radius-xs:8px;
17
  --font-ui:'Inter',system-ui,sans-serif;--font-mono:'JetBrains Mono',monospace;
18
  }
19
+ html.light-mode{
20
+ --bg:#f8fafc;--surface:rgba(255,255,255,.85);--surface-solid:#ffffff;
21
+ --border:rgba(0,0,0,.08);--border-focus:rgba(59,130,246,.5);
22
+ --text:#0f172a;--text-dim:#475569;--text-muted:#64748b;
23
+ --accent:hsl(217,92%,55%);--accent-glow:hsla(217,92%,55%,.15);
24
+ }
25
+ html.light-mode body::before{background:radial-gradient(ellipse 80% 50% at 50% -20%,hsla(217,92%,55%,.08),transparent 70%)}
26
+ html.light-mode .topbar{background:rgba(255,255,255,.75)}
27
+ html.light-mode .log-viewer{background:rgba(0,0,0,.03);color:#334155}
28
+ html.light-mode .btn{background:#ffffff;border-color:var(--border)}
29
+ html.light-mode .btn:hover{background:#f1f5f9}
30
+ html.light-mode .btn-primary, html.light-mode .btn.active{background:var(--accent);color:#fff;border-color:var(--accent)}
31
+ html.light-mode input, html.light-mode textarea, html.light-mode select{background:#ffffff;box-shadow:inset 0 1px 2px rgba(0,0,0,.02)}
32
+ html.light-mode input:focus, html.light-mode textarea:focus, html.light-mode select:focus{background:#ffffff}
33
+ html.light-mode th{background:rgba(0,0,0,.04);color:var(--text-dim)}
34
+ html.light-mode .toast{background:var(--surface-solid);color:var(--text);border:1px solid var(--border);box-shadow:0 10px 25px rgba(0,0,0,.1)}
35
+ html.light-mode .login-box{background:rgba(255,255,255,.9)}
36
  *{box-sizing:border-box;margin:0;padding:0}
37
  body{font-family:var(--font-ui);background:var(--bg);color:var(--text);font-size:14px;line-height:1.6;min-height:100vh;overflow-x:hidden}
38
  body::before{content:'';position:fixed;inset:0;background:radial-gradient(ellipse 80% 50% at 50% -20%,hsla(217,92%,60%,.06),transparent 70%);pointer-events:none;z-index:0}
 
191
  <span class="si"><span class="dot" style="background:var(--amber)"></span> 使用中 <b>—</b></span>
192
  <span class="si"><span class="dot" style="background:var(--text-dim)"></span> 排队 <b>—</b></span>
193
  </div>
194
+ <button class="btn btn-sm" style="padding:4px 8px;border-radius:6px;font-size:12px;margin-left:auto" onclick="toggleTheme()" id="themeBtn">☀️ 日间</button>
195
  <div class="poll-indicator" id="pollDot"></div>
196
  </div>
197
 
 
341
  set(k,v){try{localStorage.setItem('ds2_'+k,v)}catch(e){}}
342
  };
343
 
344
+ // ── Theme ──
345
+ function initTheme(){
346
+ if(LS.get('theme','dark')==='light') document.documentElement.classList.add('light-mode');
347
+ updateThemeBtn();
348
+ }
349
+ function toggleTheme(){
350
+ const isLight = document.documentElement.classList.toggle('light-mode');
351
+ LS.set('theme', isLight ? 'light' : 'dark');
352
+ updateThemeBtn();
353
+ }
354
+ function updateThemeBtn(){
355
+ const btn = document.getElementById('themeBtn');
356
+ if(btn) btn.textContent = document.documentElement.classList.contains('light-mode') ? '🌙 夜间' : '☀️ 日间';
357
+ }
358
+ initTheme();
359
+
360
  let _adminKey='';
361
 
362
  // ── Auth Gate ──