Logankunfall commited on
Commit
62e2f5c
·
verified ·
1 Parent(s): 596d793

Upload 22 files

Browse files
frontend/assets/app.js CHANGED
@@ -30,6 +30,15 @@
30
  localStorage.setItem('theme', theme);
31
  const btn = byId('theme-toggle');
32
  if (btn) btn.textContent = '主题:' + (theme === 'dark' ? '深色' : '浅色');
 
 
 
 
 
 
 
 
 
33
  }
34
  const initialTheme = localStorage.getItem('theme') || 'dark';
35
  applyTheme(initialTheme);
@@ -87,7 +96,8 @@
87
  btn.classList.add("active");
88
  const tabId = btn.getAttribute("data-tab");
89
  $$(".tab").forEach((tab) => tab.classList.remove("active"));
90
- byId(tabId).classList.add("active");
 
91
  });
92
  });
93
 
 
30
  localStorage.setItem('theme', theme);
31
  const btn = byId('theme-toggle');
32
  if (btn) btn.textContent = '主题:' + (theme === 'dark' ? '深色' : '浅色');
33
+
34
+ // 主题切换时重新应用背景方案
35
+ const schemeSel = byId('cfg-color-scheme');
36
+ const customColor = byId('cfg-custom-primary');
37
+ if (schemeSel) {
38
+ const scheme = schemeSel.value || 'auto';
39
+ const custom = customColor?.value || '#7ba23f';
40
+ applyBackgroundScheme(scheme, custom);
41
+ }
42
  }
43
  const initialTheme = localStorage.getItem('theme') || 'dark';
44
  applyTheme(initialTheme);
 
96
  btn.classList.add("active");
97
  const tabId = btn.getAttribute("data-tab");
98
  $$(".tab").forEach((tab) => tab.classList.remove("active"));
99
+ const targetTab = byId(tabId);
100
+ if (targetTab) targetTab.classList.add("active");
101
  });
102
  });
103
 
frontend/assets/style.css CHANGED
@@ -1,22 +1,22 @@
1
  :root {
2
- /* 将浅色作为默认,切换立即生效;暗 [data-theme="dark"] 中覆盖 */
3
- --bg: #f5f7fb;
4
- --panel: #ffffff;
5
- --text: #111;
6
- --muted: #5b6470;
7
- /* 浅色用黑色 */
8
- --primary: #000000;
9
- --primary-600: #222222;
10
- --danger: #e95353;
11
- --success: #22b66b;
12
- --border: #e6e8ef;
13
- --card: #ffffff;
14
- --shadow: 0 10px 30px rgba(0,0,0,0.15);
15
  --radius: 12px;
16
- /* 统一焦点环与激活文字颜色 */
17
- --ring: rgba(0,0,0,0.15);
18
- --active-text: #ffffff;
19
  --switch-knob: #ffffff;
 
 
20
  }
21
 
22
  * { box-sizing: border-box; }
@@ -29,12 +29,42 @@ body {
29
  font: 16px/1.7 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
30
  -webkit-font-smoothing: antialiased;
31
  -moz-osx-font-smoothing: grayscale;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  }
33
 
34
  img { max-width: 100%; display: block; }
35
 
36
  .app-header {
37
- position: fixed; /* 彻底固定选项栏(不随滚动、不跳动) */
38
  top: 0;
39
  left: 0;
40
  right: 0;
@@ -45,9 +75,10 @@ img { max-width: 100%; display: block; }
45
  align-items: center;
46
  justify-content: space-between;
47
  padding: 10px 14px;
48
- background: rgba(10,12,18,0.75);
49
  backdrop-filter: blur(8px);
50
  border-bottom: 1px solid var(--border);
 
51
  }
52
 
53
  .brand {
@@ -451,58 +482,230 @@ select {
451
 
452
  /* ===== 移动端优化(参考 NAI 生成页交互) ===== */
453
  @media (max-width: 640px) {
454
- /* 底部固定操作栏:当前 Tab 的 actions 固定在底部,仅当前 Tab 可见 */
455
- .actions {
456
- position: fixed;
457
- left: 0;
458
- right: 0;
459
- bottom: 0;
460
- padding: 10px 16px;
461
- background: var(--panel);
462
- border-top: 1px solid var(--border);
463
- z-index: 80;
464
  }
465
- .actions .primary { width: 100%; }
466
-
467
- /* 预留底部空间,避免内容被按钮遮挡;并为顶部两行导航预留高度 */
468
- main {
469
- padding-bottom: 120px;
470
- padding-top: 112px; /* 顶部两行(品牌/按钮 + 可横向滚动的 tabs) */
471
- }
472
-
473
- /* 顶部改为两行,选项(文生图/图生图/局部重绘)单独一行并可横向滚动,避免“找不到” */
474
  .app-header {
475
- padding: 8px 10px;
476
  flex-direction: column;
477
  align-items: stretch;
478
- gap: 6px;
 
 
 
 
 
479
  }
 
480
  .header-actions {
481
- order: 2;
482
- align-self: flex-end;
 
483
  }
 
484
  .tabs {
485
- order: 3;
486
  display: flex;
487
  width: 100%;
488
  overflow-x: auto;
489
  -webkit-overflow-scrolling: touch;
490
- gap: 8px;
491
- padding-bottom: 2px;
 
 
 
 
492
  }
493
  .tabs .tab-btn {
494
  flex: 0 0 auto;
495
- padding: 8px 10px;
496
  font-size: 14px;
 
 
 
 
 
 
 
497
  }
498
 
499
- /* 触控表单更易点按 */
 
 
 
 
 
 
 
 
 
 
 
 
500
  input[type="text"],
501
  input[type="password"],
502
  input[type="number"],
 
503
  textarea,
504
  select {
505
  padding: 14px 16px;
506
  font-size: 16px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
507
  }
508
  }
 
1
  :root {
2
+ /* 默认主题,避免闪烁 */
3
+ --bg: #121315;
4
+ --panel: #1a1a1a;
5
+ --text: #e6e6e6;
6
+ --muted: #9a9a9a;
7
+ --primary: #ffffff;
8
+ --primary-600: #e6e6e6;
9
+ --danger: #ff5d5d;
10
+ --success: #28c76f;
11
+ --border: #2a2a2a;
12
+ --card: #121212;
13
+ --shadow: 0 10px 30px rgba(0,0,0,0.3);
 
14
  --radius: 12px;
15
+ --ring: rgba(255,255,255,0.12);
16
+ --active-text: #111111;
 
17
  --switch-knob: #ffffff;
18
+ --switch-knob-checked: #1a1a1a;
19
+ --placeholder: #b8c1d1;
20
  }
21
 
22
  * { box-sizing: border-box; }
 
29
  font: 16px/1.7 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
30
  -webkit-font-smoothing: antialiased;
31
  -moz-osx-font-smoothing: grayscale;
32
+ /* 背景图片设置 - 电脑端 */
33
+ background-image: url('/image/windows7.jpg');
34
+ background-size: cover;
35
+ background-position: center;
36
+ background-repeat: no-repeat;
37
+ background-attachment: fixed;
38
+ position: relative;
39
+ }
40
+
41
+ /* 背景遮罩层,提升可读性 */
42
+ body::before {
43
+ content: '';
44
+ position: fixed;
45
+ top: 0;
46
+ left: 0;
47
+ right: 0;
48
+ bottom: 0;
49
+ background: rgba(0, 0, 0, 0.4);
50
+ z-index: -1;
51
+ pointer-events: none;
52
+ }
53
+
54
+ /* 深色主题遮罩更深 */
55
+ [data-theme="dark"] body::before {
56
+ background: rgba(0, 0, 0, 0.5);
57
+ }
58
+
59
+ /* 浅色主题遮罩更浅 */
60
+ [data-theme="light"] body::before {
61
+ background: rgba(255, 255, 255, 0.6);
62
  }
63
 
64
  img { max-width: 100%; display: block; }
65
 
66
  .app-header {
67
+ position: fixed;
68
  top: 0;
69
  left: 0;
70
  right: 0;
 
75
  align-items: center;
76
  justify-content: space-between;
77
  padding: 10px 14px;
78
+ background: var(--panel);
79
  backdrop-filter: blur(8px);
80
  border-bottom: 1px solid var(--border);
81
+ transition: background-color 0.2s ease, border-color 0.2s ease;
82
  }
83
 
84
  .brand {
 
482
 
483
  /* ===== 移动端优化(参考 NAI 生成页交互) ===== */
484
  @media (max-width: 640px) {
485
+ /* 手机端背景图片 */
486
+ body {
487
+ background-image: url('/image2/punk.png');
488
+ background-size: cover;
489
+ background-position: center;
 
 
 
 
 
490
  }
491
+
492
+ /* 顶部导航栏优化 */
 
 
 
 
 
 
 
493
  .app-header {
494
+ padding: 8px 12px;
495
  flex-direction: column;
496
  align-items: stretch;
497
+ gap: 8px;
498
+ }
499
+
500
+ .brand {
501
+ font-size: 18px;
502
+ text-align: center;
503
  }
504
+
505
  .header-actions {
506
+ display: flex;
507
+ justify-content: center;
508
+ gap: 8px;
509
  }
510
+
511
  .tabs {
 
512
  display: flex;
513
  width: 100%;
514
  overflow-x: auto;
515
  -webkit-overflow-scrolling: touch;
516
+ gap: 6px;
517
+ padding-bottom: 4px;
518
+ scrollbar-width: none;
519
+ }
520
+ .tabs::-webkit-scrollbar {
521
+ display: none;
522
  }
523
  .tabs .tab-btn {
524
  flex: 0 0 auto;
525
+ padding: 10px 16px;
526
  font-size: 14px;
527
+ min-width: fit-content;
528
+ }
529
+
530
+ /* 主容器调整 */
531
+ main {
532
+ padding: 130px 12px 20px;
533
+ max-width: 100%;
534
  }
535
 
536
+ /* 卡片优化 */
537
+ .card {
538
+ padding: 16px 12px;
539
+ border-radius: 16px;
540
+ }
541
+
542
+ /* 表单网格优化 - 移动端单列 */
543
+ .form-grid {
544
+ grid-template-columns: 1fr !important;
545
+ gap: 16px;
546
+ }
547
+
548
+ /* 触控友好的输入框 */
549
  input[type="text"],
550
  input[type="password"],
551
  input[type="number"],
552
+ input[type="color"],
553
  textarea,
554
  select {
555
  padding: 14px 16px;
556
  font-size: 16px;
557
+ border-radius: 12px;
558
+ min-height: 48px;
559
+ }
560
+
561
+ textarea {
562
+ min-height: 100px;
563
+ }
564
+
565
+ /* 按钮优化 */
566
+ button {
567
+ padding: 14px 20px;
568
+ font-size: 16px;
569
+ min-height: 48px;
570
+ border-radius: 12px;
571
+ }
572
+
573
+ /* 开关优化 */
574
+ .switch {
575
+ padding: 8px 0;
576
+ }
577
+ .switch input[type="checkbox"] {
578
+ width: 50px;
579
+ height: 30px;
580
+ }
581
+ .switch input[type="checkbox"]::after {
582
+ width: 24px;
583
+ height: 24px;
584
+ top: 2px;
585
+ left: 2px;
586
+ }
587
+ .switch input[type="checkbox"]:checked::after {
588
+ transform: translateX(20px);
589
+ }
590
+
591
+ /* 底部固定操作栏:仅对生成页面固定 */
592
+ #tab-t2i .actions,
593
+ #tab-i2i .actions,
594
+ #tab-inpaint .actions {
595
+ position: fixed;
596
+ left: 0;
597
+ right: 0;
598
+ bottom: 0;
599
+ padding: 12px 16px;
600
+ background: var(--panel);
601
+ border-top: 1px solid var(--border);
602
+ z-index: 80;
603
+ box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
604
+ display: flex;
605
+ justify-content: center;
606
+ }
607
+
608
+ #tab-t2i .actions .primary,
609
+ #tab-i2i .actions .primary,
610
+ #tab-inpaint .actions .primary {
611
+ width: 100%;
612
+ max-width: 400px;
613
+ font-size: 17px;
614
+ font-weight: 700;
615
+ padding: 16px 24px;
616
+ }
617
+
618
+ /* 配置页面的 actions 保持正常流式布局 */
619
+ #tab-config .actions {
620
+ position: relative;
621
+ padding: 16px 0;
622
+ flex-direction: column;
623
+ }
624
+
625
+ #tab-config .actions button {
626
+ width: 100%;
627
+ }
628
+
629
+ /* 为生成页面预留底部空间 */
630
+ #tab-t2i .card,
631
+ #tab-i2i .card,
632
+ #tab-inpaint .card {
633
+ padding-bottom: 90px;
634
+ }
635
+
636
+ /* 结果展示优化 */
637
+ .result {
638
+ margin-top: 16px;
639
+ gap: 16px;
640
+ }
641
+
642
+ .result img {
643
+ border-radius: 16px;
644
+ box-shadow: 0 4px 12px rgba(0,0,0,0.1);
645
+ }
646
+
647
+ /* 保存路径显示优化 */
648
+ .saved-path {
649
+ grid-template-columns: 1fr;
650
+ gap: 8px;
651
+ }
652
+
653
+ .saved-path label {
654
+ font-size: 13px;
655
+ }
656
+
657
+ .saved-path input {
658
+ font-size: 13px;
659
+ padding: 10px 12px;
660
+ }
661
+
662
+ /* Toast 优化 */
663
+ .toast {
664
+ bottom: 90px;
665
+ max-width: calc(100% - 32px);
666
+ padding: 12px 16px;
667
+ font-size: 15px;
668
+ }
669
+
670
+ /* 标题优化 */
671
+ h2 {
672
+ font-size: 20px;
673
+ margin: 0 0 16px;
674
+ }
675
+
676
+ /* 标签字体优化 */
677
+ label {
678
+ font-size: 15px;
679
+ }
680
+
681
+ label > span {
682
+ font-weight: 600;
683
+ margin-bottom: 4px;
684
+ }
685
+
686
+ /* 信息提示优化 */
687
+ .message {
688
+ font-size: 14px;
689
+ margin-top: 12px;
690
+ }
691
+
692
+ /* 滚动条隐藏(更流畅的移动体验) */
693
+ * {
694
+ scrollbar-width: thin;
695
+ scrollbar-color: var(--border) transparent;
696
+ }
697
+
698
+ *::-webkit-scrollbar {
699
+ width: 2px;
700
+ height: 2px;
701
+ }
702
+
703
+ *::-webkit-scrollbar-track {
704
+ background: transparent;
705
+ }
706
+
707
+ *::-webkit-scrollbar-thumb {
708
+ background: var(--border);
709
+ border-radius: 2px;
710
  }
711
  }
image/windows7.jpg ADDED
image2/punk.png ADDED
server.js CHANGED
@@ -36,6 +36,8 @@ const app = express();
36
  const ROOT = __dirname;
37
  const FRONTEND_DIR = path.join(ROOT, 'frontend');
38
  const RING_DIR = path.join(ROOT, 'ring');
 
 
39
  const CONFIG_PATH = path.join(ROOT, 'backend', 'config.json');
40
 
41
  // ---------- 中间件 ----------
@@ -356,6 +358,12 @@ app.get('/favicon.ico', (req, res) => res.status(204).end());
356
 
357
  // ---------- 静态资源 ----------
358
 
 
 
 
 
 
 
359
  // 铃声目录
360
  app.use('/ring', express.static(RING_DIR, { fallthrough: true }));
361
 
 
36
  const ROOT = __dirname;
37
  const FRONTEND_DIR = path.join(ROOT, 'frontend');
38
  const RING_DIR = path.join(ROOT, 'ring');
39
+ const IMAGE_DIR = path.join(ROOT, 'image');
40
+ const IMAGE2_DIR = path.join(ROOT, 'image2');
41
  const CONFIG_PATH = path.join(ROOT, 'backend', 'config.json');
42
 
43
  // ---------- 中间件 ----------
 
358
 
359
  // ---------- 静态资源 ----------
360
 
361
+ // 背景图片目录(电脑端)
362
+ app.use('/image', express.static(IMAGE_DIR, { fallthrough: true }));
363
+
364
+ // 背景图片目录(手机端)
365
+ app.use('/image2', express.static(IMAGE2_DIR, { fallthrough: true }));
366
+
367
  // 铃声目录
368
  app.use('/ring', express.static(RING_DIR, { fallthrough: true }));
369
 
背景图片说明.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 背景图片使用说明
2
+
3
+ ## 目录结构
4
+
5
+ - `image/` - 电脑端(桌面端)背景图片目录
6
+ - `image2/` - 手机端背景图片目录
7
+
8
+ ## 如何更换背景图片
9
+
10
+ ### 电脑端背景
11
+
12
+ 1. 将您的背景图片重命名为 `windows7.jpg`
13
+ 2. 替换到 `image/` 目录下
14
+ 3. 支持的格式:`.jpg`, `.jpeg`, `.png`, `.webp`, `.gif`
15
+ 4. 建议尺寸:1920x1080 或更高分辨率
16
+
17
+ ### 手机端背景
18
+
19
+ 1. 将您的背景图片重命名为 `punk.png`
20
+ 2. 替换到 `image2/` 目录下
21
+ 3. 支持的格式:`.jpg`, `.jpeg`, `.png`, `.webp`, `.gif`
22
+ 4. 建议尺寸:1080x1920 或适合竖屏的分辨率
23
+
24
+ ## 自定义文件名
25
+
26
+ 如果您想使用不同的文件名,请按以下步骤修改:
27
+
28
+ ### 修改电脑端背景文件名
29
+
30
+ 1. 打开 `frontend/assets/style.css`
31
+ 2. 找到第 33 行:
32
+ ```css
33
+ background-image: url('/image/windows7.jpg');
34
+ ```
35
+ 3. 将 `windows7.jpg` 改为您的文件名
36
+ 4. 保存文件并重启服务器
37
+
38
+ ### 修改手机端背景文件名
39
+
40
+ 1. 打开 `frontend/assets/style.css`
41
+ 2. 找到约 462 行(在 `@media (max-width: 640px)` 内):
42
+ ```css
43
+ background-image: url('/image2/punk.png');
44
+ ```
45
+ 3. 将 `punk.png` 改为您的文件名
46
+ 4. 保存文件并重启服务器
47
+
48
+ ## 背景效果说明
49
+
50
+ - **遮罩层**:为了提升界面可读性,背景图片上会有一层半透明遮罩
51
+ - **深色模式**:遮罩透明度为 50%(更暗)
52
+ - **浅色模式**:遮罩透明度为 60%(更亮)
53
+ - **固定背景**:桌面端背景图片固定不随滚动移动
54
+
55
+ ## 提示
56
+
57
+ - 图片文件不宜过大,建议不超过 5MB,以免影响加载速度
58
+ - 可以使用在线图片压缩工具优化图片大小
59
+ - 建议选择对比度适中的图片,避免影响文字阅读
60
+ - 更换图片后需要刷新浏览器(Ctrl+F5 强制刷新)才能看到效果
61
+
62
+ ## 注意事项
63
+
64
+ ⚠️ 请确保图片文件具有适当的权限,服务器需要能够读取这些文件。
65
+
66
+ ✅ 支持的图片格式:JPG, JPEG, PNG, WebP, GIF
67
+
68
+ ❌ 不支持的格式:BMP, TIFF, SVG(需要特殊处理)