sider-redesign.html
62.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>侧栏重设计 · 优加门店上架</title>
<style>
/* ============================================================
原型作用域。产品真实令牌见 packages/design-tokens/src/tokens.css
本文件自包含,不加载任何外部字体 / 图标 / 脚本。
============================================================ */
:root {
--nav-ink: #0b1437;
--nav-ink-2: #0d1739;
--nav-rail: #2b5ce6;
--nav-rail-lit: #5b8def;
--nav-label: #e8edf8;
--nav-label-dim: rgba(255, 255, 255, 0.42);
/* 域计数退到背景层:位置与等宽仍是锚点,但不再用亮色抢标题。
0.12 / 0.08 为超人在实现里继续调暗后的定稿,本稿回灌同步。 */
--nav-count: rgba(198, 220, 255, 0.12);
--nav-line: rgba(198, 220, 255, 0.09);
/* 12 条短横连成一排时 0.16 会形成发亮的虚线带,压到 0.09 只留层级 */
--nav-line-strong: rgba(198, 220, 255, 0.09);
--nav-rail-soft: rgba(91, 141, 239, 0.08);
--brand: #2b5ce6;
--brand-hover: #4b75ea;
--page: #f4f6fa;
--surface: #ffffff;
--surface-2: #f8fafc;
--border: #e6ebf2;
--divider: #eef1f6;
--text-1: #1d2533;
--text-2: #4a5568;
--text-3: #8a94a6;
--shadow-card: 0 1px 2px rgba(16, 24, 40, 0.05), 0 2px 6px -2px rgba(16, 24, 40, 0.08);
--ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}
* {
box-sizing: border-box;
}
html,
body {
height: 100%;
margin: 0;
}
body {
font-family:
'PingFang',
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
'PingFang SC',
'Microsoft YaHei',
sans-serif;
font-size: 14px;
color: var(--text-1);
background: var(--page);
-webkit-font-smoothing: antialiased;
}
button {
font: inherit;
color: inherit;
cursor: pointer;
}
button:focus-visible,
[tabindex]:focus-visible {
outline: 2px solid var(--nav-rail-lit);
outline-offset: 2px;
border-radius: 4px;
}
/* ============ 骨架 ============ */
.app {
display: flex;
height: 100vh;
overflow: hidden;
}
/* ============ 侧栏 ============ */
.sider {
position: relative;
flex: none;
width: 216px;
height: 100%;
display: flex;
flex-direction: column;
/* 三层背景:品牌区一道极淡的径向光弧(不是横贯整条的亮带)+ 自上而下收敛的近实色。
菜单区保持近实色保证可读性,层次交给光弧、左缘标尺与激活域淡染。 */
background:
radial-gradient(132% 46% at -10% -6%, rgba(43, 92, 230, 0.28), rgba(43, 92, 230, 0) 66%),
linear-gradient(180deg, var(--nav-ink) 0%, var(--nav-ink-2) 52%, #09112e 100%);
box-shadow: 4px 0 20px -14px rgba(6, 12, 38, 0.5);
transition: width 0.24s var(--ease);
overflow: hidden;
}
/* 左缘 1px 索引标尺:与激活域刻度同一套语言,给纯色长条一个可读的纵向基准。
z-index:0 保证它压在背景上、但不会盖住任何刻度与文字。 */
.sider::before {
content: '';
position: absolute;
left: 0;
top: 56px;
bottom: 46px;
width: 1px;
z-index: 0;
pointer-events: none;
background: linear-gradient(
180deg,
rgba(91, 141, 239, 0.3),
rgba(198, 220, 255, 0.07) 26%,
rgba(198, 220, 255, 0.07) 74%,
rgba(91, 141, 239, 0.12)
);
}
.is-collapsed .sider {
width: 68px;
}
/* 品牌区 */
.brand {
height: 56px;
flex: none;
display: flex;
align-items: center;
gap: 10px;
padding: 0 14px;
border-bottom: 1px solid var(--nav-line);
}
.is-collapsed .brand {
justify-content: center;
padding: 0;
}
.brand-mark {
width: 34px;
height: 34px;
flex: none;
border-radius: 9.5px;
background: linear-gradient(135deg, #2b5ce6 0%, #5b8def 100%);
display: grid;
place-items: center;
color: #fff;
font-weight: 800;
font-size: 13.6px;
letter-spacing: 1px;
box-shadow: 0 6px 16px -6px rgba(43, 92, 230, 0.6);
user-select: none;
}
.brand-text {
display: flex;
flex-direction: column;
line-height: 1.25;
white-space: nowrap;
overflow: hidden;
}
.brand-text .t {
color: #fff;
font-size: 15px;
font-weight: 700;
letter-spacing: 0.5px;
}
.brand-text .s {
color: rgba(255, 255, 255, 0.38);
font-size: 9.5px;
letter-spacing: 0.7px;
text-transform: uppercase;
margin-top: 2px;
}
.is-collapsed .brand-text {
display: none;
}
/* 菜单滚动区 */
.nav {
flex: 1;
min-height: 0;
overflow-y: auto;
overflow-x: hidden;
padding: 10px 0 18px;
scrollbar-width: none;
}
.nav::-webkit-scrollbar {
width: 0;
height: 0;
}
/* 长菜单的滚动边界提示:只在真的还有内容时出现,静默地告诉用户上下都能走 */
.nav-fade {
position: absolute;
left: 0;
right: 0;
height: 26px;
pointer-events: none;
z-index: 2;
opacity: 0;
transition: opacity 0.18s var(--ease);
}
.nav-fade.top {
top: 56px;
background: linear-gradient(180deg, rgba(11, 20, 55, 0.96), rgba(11, 20, 55, 0));
}
.nav-fade.bottom {
bottom: 46px;
background: linear-gradient(0deg, rgba(10, 18, 48, 0.96), rgba(10, 18, 48, 0));
}
.nav-fade.is-on {
opacity: 1;
}
.is-collapsed .nav-fade {
display: none;
}
/* 区段标:不是编号,只是分区名 */
.zone-label {
height: 28px;
display: flex;
align-items: center;
padding: 0 14px;
font-size: 11px;
font-weight: 500;
letter-spacing: 0.5px;
color: var(--nav-label-dim);
white-space: nowrap;
}
/* 折叠态:两个区段标退化成一条线就够,两条短线反而把图标栏切碎 */
.is-collapsed .zone-label {
display: none;
}
.zone-sep {
height: 1px;
margin: 10px 14px 12px;
background: var(--nav-line);
}
.is-collapsed .zone-sep {
margin: 10px 18px 12px;
}
/* 工作台:单入口,独立段 */
.solo {
position: relative;
height: 38px;
margin: 0 8px 4px;
padding: 0 10px;
display: grid;
grid-template-columns: 20px 1fr;
align-items: center;
gap: 10px;
border-radius: 6px;
color: rgba(255, 255, 255, 0.66);
cursor: pointer;
border: 0;
background: transparent;
width: calc(100% - 16px);
text-align: left;
}
/* hover = 选中态的低强度预览:同一条品牌蓝光楔、同样的四个停靠点,每档约 4 成强度。
不加短刻度与亮环 —— 那两个只属于「当前页」,hover 只预告可点,不伪造位置。 */
.solo:not(.is-active):hover {
background: linear-gradient(
90deg,
rgba(43, 92, 230, 0.12) 0%,
rgba(43, 92, 230, 0.04) 30%,
rgba(43, 92, 230, 0.01) 62%,
rgba(43, 92, 230, 0) 82%
);
color: #fff;
}
.solo .ico {
width: 20px;
height: 20px;
display: grid;
place-items: center;
color: inherit;
}
.solo .txt {
font-size: 13px;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
}
.solo.is-active {
color: #fff;
background: linear-gradient(
90deg,
rgba(43, 92, 230, 0.28) 0%,
rgba(43, 92, 230, 0.1) 30%,
rgba(43, 92, 230, 0.02) 62%,
rgba(43, 92, 230, 0) 82%
);
}
.solo.is-active::after {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 3px;
height: 16px;
border-radius: 0 2px 2px 0;
background: var(--nav-rail-lit);
box-shadow: 0 0 10px -2px rgba(91, 141, 239, 0.7);
}
.solo.is-active .ico {
color: var(--nav-rail-lit);
}
.is-collapsed .solo {
grid-template-columns: 20px;
justify-content: center;
padding: 0;
margin: 0 8px 4px;
gap: 0;
}
.is-collapsed .solo .txt {
display: none;
}
/* ============ 章节(一级菜单) ============ */
/* 组内紧密、组间分明:间距预算主要花在章节之间,
而不是给 12 个二级项逐个加 gap(那样长菜单会失控)。 */
.chapter {
position: relative;
margin-bottom: 10px;
}
.chapter + .chapter {
margin-top: 6px;
}
/* 章节头:固定四列网格 —— 字数协调的结构基础
[20px 图标][1fr 标题槽][auto 域计数][12px 展开指示]
标题槽宽度在所有一级行中完全相同,右端也对齐到同一条线。 */
.chap-head {
position: relative;
height: 36px;
width: calc(100% - 16px);
margin: 0 8px;
padding: 0 10px 0 6px;
border: 0;
background: transparent;
display: grid;
grid-template-columns: 20px 1fr auto 12px;
align-items: center;
gap: 8px;
color: rgba(255, 255, 255, 0.72);
text-align: left;
border-radius: 6px;
}
.chap-head:hover {
background: linear-gradient(
90deg,
rgba(43, 92, 230, 0.12) 0%,
rgba(43, 92, 230, 0.04) 30%,
rgba(43, 92, 230, 0.01) 62%,
rgba(43, 92, 230, 0) 82%
);
color: #fff;
}
.chap-head .ico {
width: 20px;
height: 20px;
display: grid;
place-items: center;
color: rgba(255, 255, 255, 0.5);
}
.chap-head:hover .ico {
color: rgba(255, 255, 255, 0.82);
}
.chap-head .label {
min-width: 0;
font-size: 13px;
font-weight: 600;
letter-spacing: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.chap-head .count {
font-size: 11px;
font-weight: 400;
font-variant-numeric: tabular-nums;
color: var(--nav-count);
min-width: 16px;
text-align: right;
transition: color 0.16s ease;
}
/* 只在交互时短暂提亮,静态视图里计数始终退在标题之后 */
.chap-head:hover .count {
color: rgba(198, 220, 255, 0.58);
}
.chap-head .chev {
width: 12px;
height: 12px;
display: grid;
place-items: center;
transition: transform 0.2s var(--ease);
color: rgba(255, 255, 255, 0.34);
}
.chapter.is-open .chap-head .chev {
transform: rotate(90deg);
}
.chapter.is-current .chap-head {
color: #fff;
}
.chapter.is-current .chap-head .ico {
color: var(--nav-rail-lit);
}
.chapter.is-current .chap-head .count {
color: rgba(198, 220, 255, 0.62);
}
/* 左缘章节刻度:把纯色侧栏读成一册带书脊刻度的目录。
未激活章只留 2×10px 极淡刻痕,激活章才拉长成整段蓝刻度。 */
.chap-head::before {
content: '';
position: absolute;
left: -8px;
top: 50%;
transform: translateY(-50%);
width: 2px;
height: 10px;
border-radius: 0 2px 2px 0;
background: rgba(198, 220, 255, 0.1);
transition: background 0.18s ease;
}
/* hover 的刻痕转品牌蓝但仍是 10px 短刻:与激活章的拉长蓝刻度同族、不同长度 */
.chap-head:hover::before {
background: rgba(91, 141, 239, 0.5);
}
/* 激活域的 2px 长刻度:全侧栏唯一的重音 */
.chapter.is-current .chap-head::before {
top: 6px;
bottom: 6px;
height: auto;
transform: none;
background: var(--nav-rail-lit);
}
/* 对齐轴可视化(评审辅助,非产品界面) */
.show-axis .chap-head .label {
box-shadow: inset -1px 0 0 0 rgba(91, 141, 239, 0.55);
}
.show-axis .chap-head .count {
box-shadow: inset 1px 0 0 0 rgba(91, 141, 239, 0.55);
}
.show-axis .chap-head {
background: rgba(91, 141, 239, 0.055);
}
/* 旧版字距复现:用于对比 */
.legacy .chap-head .label {
letter-spacing: 2px;
text-transform: uppercase;
}
/* 折叠态:只留图标,文字/计数/箭头退场 */
.is-collapsed .chap-head {
grid-template-columns: 20px;
justify-content: center;
padding: 0;
gap: 0;
margin: 0 8px;
}
.is-collapsed .chap-head .label,
.is-collapsed .chap-head .count,
.is-collapsed .chap-head .chev {
display: none;
}
/* 折叠态唯一的位置信号,加粗一档才看得见 */
.is-collapsed .chapter.is-current .chap-head::before {
left: -8px;
width: 3px;
}
/* ============ 章节体 + 导轨 ============ */
.chap-body {
position: relative;
display: none;
padding: 6px 0 8px;
}
.chapter.is-open .chap-body {
display: block;
}
/* 激活域一层极淡的染色:域 > 页 两级光,不再靠整行实底铺满 */
.chapter.is-current .chap-body {
background: linear-gradient(90deg, rgba(43, 92, 230, 0.06), rgba(43, 92, 230, 0) 64%);
}
.is-collapsed .chap-body {
display: none !important;
}
/* 竖向导轨:把「这一章里的这些页」串成一组 */
.chap-body::before {
content: '';
position: absolute;
left: 23px;
top: -4px;
bottom: 16px;
width: 1px;
background: var(--nav-line-strong);
}
.chapter.is-current .chap-body::before {
background: var(--nav-rail-soft);
}
/* 二级项:统一导轨节点,不渲染语义图标(与落地 SideNav 一致) */
.leaf {
position: relative;
height: 36px;
width: calc(100% - 16px);
margin: 0 8px;
padding: 0 10px 0 26px;
border: 0;
background: transparent;
display: grid;
grid-template-columns: 12px minmax(0, 1fr);
align-items: center;
gap: 8px;
color: rgba(255, 255, 255, 0.58);
text-align: left;
border-radius: 6px;
}
/* 从导轨接到节点的短横,让层级是真连起来的 */
.leaf::before {
content: '';
position: absolute;
left: 15px;
top: 50%;
width: 12px;
height: 1px;
background: var(--nav-line-strong);
}
.chapter.is-current .leaf::before {
background: var(--nav-rail-soft);
}
/* hover 与选中共用一条光楔,只是强度约 4 成;当前项不参与 hover 反馈 */
.leaf:not(.is-active):hover {
background: linear-gradient(
90deg,
rgba(43, 92, 230, 0.12) 0%,
rgba(43, 92, 230, 0.04) 30%,
rgba(43, 92, 230, 0.01) 62%,
rgba(43, 92, 230, 0) 82%
);
color: rgba(255, 255, 255, 0.92);
}
/* 只点亮 hover 这一根的短横,不会让 12 根连成亮带 */
.leaf:not(.is-active):hover::before {
background: rgba(91, 141, 239, 0.24);
}
.node {
width: 12px;
height: 12px;
display: grid;
place-items: center;
}
.node::after {
content: '';
width: 5px;
height: 5px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.28);
transition:
background 0.16s ease,
box-shadow 0.16s ease;
}
/* 节点圆点也走品牌蓝递进:hover 淡蓝 → 选中亮蓝 + 亮环 */
.leaf:not(.is-active):hover .node::after {
background: rgba(91, 141, 239, 0.62);
}
.leaf .txt {
font-size: 13px;
font-weight: 400;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* 选中页:从左端短刻度向外淡出的「光楔」,取代贯穿整行的蓝色长条。
左端 3px×16px 短刻度 + 导轨节点亮环 + 文字提亮,三重信号都不占满整行。 */
.leaf.is-active {
color: #fff;
background: linear-gradient(
90deg,
rgba(43, 92, 230, 0.28) 0%,
rgba(43, 92, 230, 0.1) 30%,
rgba(43, 92, 230, 0.02) 62%,
rgba(43, 92, 230, 0) 82%
);
}
.leaf.is-active::after {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 3px;
height: 16px;
border-radius: 0 2px 2px 0;
background: var(--nav-rail-lit);
box-shadow: 0 0 10px -2px rgba(91, 141, 239, 0.7);
}
/* 选中项那根短横仍是章内最亮的,但压一档避免刺眼 */
.leaf.is-active::before {
background: rgba(91, 141, 239, 0.78);
}
.leaf.is-active .node::after {
background: var(--nav-rail-lit);
box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.22);
}
.leaf.is-active .txt {
font-weight: 500;
}
/* 底部:从 Header 收回侧栏的折叠控制 + 一行真实角色信息 */
.sider-foot {
flex: none;
height: 46px;
border-top: 1px solid var(--nav-line);
display: flex;
align-items: center;
gap: 8px;
padding: 0 12px;
}
.fold-btn {
height: 28px;
flex: none;
width: 28px;
border: 0;
border-radius: 5px;
background: transparent;
color: rgba(255, 255, 255, 0.5);
display: grid;
place-items: center;
}
.fold-btn:hover {
background: rgba(255, 255, 255, 0.07);
color: #fff;
}
.foot-meta {
display: flex;
flex-direction: column;
line-height: 1.3;
min-width: 0;
overflow: hidden;
}
.foot-meta .n {
font-size: 11px;
color: rgba(255, 255, 255, 0.5);
white-space: nowrap;
}
.foot-meta .e {
font-size: 10px;
color: rgba(255, 255, 255, 0.28);
white-space: nowrap;
letter-spacing: 0.3px;
}
.is-collapsed .foot-meta {
display: none;
}
.is-collapsed .sider-foot {
justify-content: center;
padding: 0;
}
/* 折叠态浮层 */
.popover {
position: fixed;
z-index: 40;
min-width: 184px;
padding: 6px;
background: #101b42;
border: 1px solid rgba(198, 220, 255, 0.14);
border-radius: 8px;
box-shadow: 0 12px 32px -10px rgba(2, 6, 20, 0.7);
display: none;
}
.popover.is-visible {
display: block;
}
.popover .p-title {
font-size: 11px;
color: var(--nav-label-dim);
padding: 6px 10px 8px;
letter-spacing: 0.5px;
}
.popover .p-item {
position: relative;
display: block;
width: 100%;
height: 32px;
padding: 0 10px;
border: 0;
border-radius: 5px;
background: transparent;
color: rgba(255, 255, 255, 0.66);
font-size: 13px;
text-align: left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* 折叠态浮层与展开态共用同一套 hover / 选中语言,不能留一版旧的整行实底 */
.popover .p-item:not(.is-active):hover {
background: linear-gradient(
90deg,
rgba(43, 92, 230, 0.12) 0%,
rgba(43, 92, 230, 0.04) 30%,
rgba(43, 92, 230, 0.01) 62%,
rgba(43, 92, 230, 0) 82%
);
color: #fff;
}
.popover .p-item.is-active {
background: linear-gradient(
90deg,
rgba(43, 92, 230, 0.28) 0%,
rgba(43, 92, 230, 0.1) 30%,
rgba(43, 92, 230, 0.02) 62%,
rgba(43, 92, 230, 0) 82%
);
color: #fff;
}
.popover .p-item.is-active::after {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 3px;
height: 14px;
border-radius: 0 2px 2px 0;
background: var(--nav-rail-lit);
box-shadow: 0 0 8px -2px rgba(91, 141, 239, 0.6);
}
/* ============ 右侧内容区 ============ */
.main {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
background: var(--page);
}
.topbar {
height: 56px;
flex: none;
background: var(--surface);
border-bottom: 1px solid var(--border);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
gap: 12px;
}
.crumb {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
color: var(--text-3);
min-width: 0;
}
.crumb .sep {
color: var(--text-3);
opacity: 0.5;
}
.crumb .now {
color: var(--text-1);
font-weight: 500;
}
.who {
display: flex;
align-items: center;
gap: 9px;
flex: none;
}
.avatar {
width: 32px;
height: 32px;
border-radius: 50%;
background: linear-gradient(135deg, #2b5ce6, #5b8def);
display: grid;
place-items: center;
color: #fff;
font-size: 12px;
font-weight: 600;
}
.who-txt {
display: flex;
flex-direction: column;
line-height: 1.3;
}
.who-txt .n {
font-size: 13px;
color: var(--text-1);
}
.who-txt .r {
font-size: 11px;
color: var(--text-3);
}
.content {
flex: 1;
min-height: 0;
overflow: auto;
padding: 16px 20px 32px;
}
/* 原型工具条:明确与产品界面分开 */
.toolbar {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 8px;
box-shadow: var(--shadow-card);
padding: 12px 14px;
margin-bottom: 14px;
}
.toolbar-hd {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 10px;
}
.toolbar-hd .tag {
font-size: 10px;
letter-spacing: 0.4px;
color: var(--brand);
background: #eef3ff;
border: 1px solid #d6e2fb;
border-radius: 4px;
padding: 2px 6px;
font-weight: 600;
}
.toolbar-hd .desc {
font-size: 12px;
color: var(--text-3);
}
.tools {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.tool {
height: 30px;
padding: 0 11px;
border: 1px solid var(--border);
border-radius: 6px;
background: var(--surface);
font-size: 12px;
color: var(--text-2);
display: inline-flex;
align-items: center;
gap: 6px;
}
.tool:hover {
border-color: #c3d2f5;
color: var(--brand);
}
.tool[aria-pressed='true'] {
background: #eef3ff;
border-color: #c3d2f5;
color: var(--brand);
font-weight: 600;
}
.tool .dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: currentColor;
opacity: 0.55;
}
/* 仿真业务页:给侧栏一个真实的上下文 */
.page-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 10px;
box-shadow: var(--shadow-card);
overflow: hidden;
}
.page-hd {
padding: 16px 18px;
border-bottom: 1px solid var(--divider);
display: flex;
align-items: baseline;
gap: 10px;
}
.page-hd h1 {
margin: 0;
font-size: 16px;
font-weight: 600;
letter-spacing: 0.2px;
}
.page-hd .sub {
font-size: 12px;
color: var(--text-3);
}
.stats {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 1px;
background: var(--divider);
}
.stat {
background: var(--surface);
padding: 16px 18px;
}
.stat .k {
font-size: 12px;
color: var(--text-3);
}
.stat .v {
font-size: 22px;
font-weight: 600;
margin-top: 6px;
font-variant-numeric: tabular-nums;
letter-spacing: -0.3px;
}
.stat .v small {
font-size: 12px;
font-weight: 400;
color: var(--text-3);
margin-left: 4px;
}
.table {
margin-top: 1px;
background: var(--divider);
}
.row {
display: grid;
grid-template-columns: 1.4fr 1fr 0.8fr 0.8fr;
gap: 12px;
padding: 11px 18px;
background: var(--surface);
font-size: 13px;
color: var(--text-2);
border-bottom: 1px solid var(--divider);
}
.row:last-child {
border-bottom: 0;
}
.row.th {
background: var(--surface-2);
color: var(--text-header, #5a6779);
font-size: 12px;
font-weight: 500;
}
.row .num {
font-variant-numeric: tabular-nums;
}
.pill {
display: inline-block;
font-size: 11px;
padding: 2px 8px;
border-radius: 4px;
border: 1px solid;
}
.pill.ok {
color: #16a34a;
background: #e9f7ef;
border-color: #c6ebd6;
}
.pill.wait {
color: #d97706;
background: #fdf3e5;
border-color: #f6dfba;
}
/* 设计说明 */
.notes {
margin-top: 14px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 10px;
box-shadow: var(--shadow-card);
overflow: hidden;
}
.notes summary {
padding: 14px 18px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
list-style: none;
display: flex;
align-items: center;
justify-content: space-between;
}
.notes summary::-webkit-details-marker {
display: none;
}
.notes summary::after {
content: '展开';
font-size: 12px;
font-weight: 400;
color: var(--text-3);
}
.notes[open] summary::after {
content: '收起';
}
.notes summary:hover {
background: var(--surface-2);
}
.notes-body {
padding: 0 18px 18px;
border-top: 1px solid var(--divider);
}
.notes-body h3 {
font-size: 13px;
margin: 16px 0 8px;
color: var(--text-1);
}
.notes-body p,
.notes-body li {
font-size: 12.5px;
line-height: 1.75;
color: var(--text-2);
margin: 0 0 6px;
}
.notes-body ul {
padding-left: 18px;
margin: 0 0 8px;
}
.notes-body code {
font-family: 'SFMono-Regular', Consolas, monospace;
font-size: 11.5px;
background: #f2f4f8;
border: 1px solid #e6ebf2;
border-radius: 3px;
padding: 1px 5px;
color: #334;
}
.tokens {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 8px;
margin-top: 8px;
}
.tok {
display: flex;
align-items: center;
gap: 8px;
font-size: 11.5px;
color: var(--text-2);
border: 1px solid var(--border);
border-radius: 6px;
padding: 7px 9px;
}
.sw {
width: 16px;
height: 16px;
border-radius: 4px;
flex: none;
border: 1px solid rgba(0, 0, 0, 0.07);
}
.tok b {
font-weight: 600;
color: var(--text-1);
}
.legend {
font-size: 11.5px;
color: var(--text-3);
margin-top: 12px;
padding-top: 10px;
border-top: 1px dashed var(--border);
}
@media (max-width: 900px) {
.stats {
grid-template-columns: repeat(2, 1fr);
}
.who-txt {
display: none;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
transition: none !important;
animation: none !important;
}
}
</style>
</head>
<body>
<div class="app" id="app">
<!-- ================= 侧栏 ================= -->
<aside class="sider" id="sider" aria-label="主导航">
<div class="brand">
<div class="brand-mark">UJ</div>
<div class="brand-text">
<span class="t">优加门店上架</span>
<span class="s">Store Launch Platform</span>
</div>
</div>
<nav class="nav" id="nav">
<div class="zone-label">工作区</div>
<button type="button" class="solo" id="solo" data-name="工作台">
<span class="ico" data-icon="dashboard"></span>
<span class="txt">工作台</span>
</button>
<div class="zone-sep"></div>
<div class="zone-label">业务域</div>
<div id="chapters"></div>
</nav>
<div class="nav-fade top" id="fadeTop" aria-hidden="true"></div>
<div class="nav-fade bottom" id="fadeBottom" aria-hidden="true"></div>
<div class="sider-foot">
<button
type="button"
class="fold-btn"
id="foldBtn"
aria-label="收起导航"
title="收起导航"
>
<span data-icon="fold"></span>
</button>
<div class="foot-meta">
<span class="n">运营管理员</span>
<span class="e">当前登录角色</span>
</div>
</div>
</aside>
<!-- 折叠态浮层 -->
<div class="popover" id="popover" role="menu"></div>
<!-- ================= 内容区 ================= -->
<div class="main">
<header class="topbar">
<div class="crumb">
<span id="crumbGroup">门店上架</span>
<span class="sep">/</span>
<span class="now" id="crumbNow">门店审批</span>
</div>
<div class="who">
<div class="avatar">李</div>
<div class="who-txt"><span class="n">李明</span><span class="r">运营管理员</span></div>
</div>
</header>
<div class="content">
<!-- 原型演示控制:标注为非产品界面 -->
<section class="toolbar" aria-label="原型演示控制">
<div class="toolbar-hd">
<span class="tag">原型工具</span>
<span class="desc">以下控件仅用于评审演示,不属于产品界面</span>
</div>
<div class="tools">
<button type="button" class="tool" id="tFold" aria-pressed="false">
<span class="dot"></span>折叠侧栏
</button>
<button type="button" class="tool" id="tAxis" aria-pressed="false">
<span class="dot"></span>显示对齐轴
</button>
<button type="button" class="tool" id="tLegacy" aria-pressed="false">
<span class="dot"></span>对比旧版字距
</button>
<button type="button" class="tool" id="tStress" aria-pressed="false">
<span class="dot"></span>字数压力测试
</button>
<button type="button" class="tool" id="tAll">展开全部</button>
<button type="button" class="tool" id="tReset">恢复默认</button>
</div>
</section>
<!-- 仿真业务页 -->
<section class="page-card" aria-label="页面内容示意">
<div class="page-hd">
<h1 id="pageTitle">门店审批</h1>
<span class="sub">示意内容 · 非真实业务数据</span>
</div>
<div class="stats">
<div class="stat">
<div class="k">待审批门店</div>
<div class="v">24<small>家</small></div>
</div>
<div class="stat">
<div class="k">本周通过</div>
<div class="v">86<small>家</small></div>
</div>
<div class="stat">
<div class="k">平均时效</div>
<div class="v">1.8<small>天</small></div>
</div>
<div class="stat">
<div class="k">驳回待补</div>
<div class="v">7<small>家</small></div>
</div>
</div>
<div class="table">
<div class="row th">
<span>门店名称</span><span>所属区域</span><span>提交时间</span><span>状态</span>
</div>
<div class="row">
<span>优加 · 城西银泰店</span><span>华东 / 杭州</span
><span class="num">11-11 09:42</span
><span><span class="pill wait">待审批</span></span>
</div>
<div class="row">
<span>优加 · 滨江星光店</span><span>华东 / 杭州</span
><span class="num">11-11 09:18</span
><span><span class="pill wait">待审批</span></span>
</div>
<div class="row">
<span>优加 · 未来科技城店</span><span>华东 / 杭州</span
><span class="num">11-10 17:03</span
><span><span class="pill ok">已通过</span></span>
</div>
<div class="row">
<span>优加 · 钱江新城店</span><span>华东 / 杭州</span
><span class="num">11-10 15:26</span
><span><span class="pill ok">已通过</span></span>
</div>
</div>
</section>
<!-- 设计说明 -->
<details class="notes">
<summary>设计计划与落地映射</summary>
<div class="notes-body">
<h3>一、字数不齐的根因(代码证据)</h3>
<ul>
<li>
<code>apps/web/shell/src/theme/design.css:515-519</code> 一级
<code>.ant-menu-submenu-title</code> 的
<code>letter-spacing: 2px</code> 让中文每字多 2px,5 字标题比 3 字多 4px,字数差被
CSS 放大;<code>text-transform: uppercase</code> 对中文无效。
</li>
<li>
<code>packages/design-tokens/src/themeConfig.ts:109-111</code> 的
<code>itemHeight: 40</code> 让一级标题与二级项等高同边界,菜单变多后没有章节节奏。
</li>
<li>
真实一级名:工作台 3(平铺单入口)、门店上架 / 积分管理 / 系统设置 4、二手车管理
5;二手车管理下 12
个二级项(<code>scripts/usedcar-menu-complete.sql:46-127</code>)。
</li>
</ul>
<h3>二、字数协调:固定标题槽 + 双端对齐轴</h3>
<p>
章节头是四列网格
<code>20px 图标 / 1fr 标题槽 / auto 域计数 / 12px 展开指示</code
>。所有一级行的标题槽起点相同、宽度相同,右端的计数与箭头也对齐到同一条线 ——
字数差被槽内留白吸收,不表现为右边缘参差。右侧计数取自后端菜单树的真实子项数(3 / 4
/ 12 / 2),等宽数字,同时预告该域展开后的长度。
</p>
<p>
明确不做:不改业务文案凑字数(后端下发、破坏语义);不用
<code>text-align-last: justify</code> 撑满(3 字会被拉成散字);不加 01/02
编号(业务域不是序列)。
</p>
<p>
点「显示对齐轴」可看到标题槽右边界与计数左边界;点「对比旧版字距」会复现 2px
字距,直观看差异;点「字数压力测试」把章节名临时替换为 3–7
字演示串验证容纳能力。状态也可用 URL hash 直达:<code>#all</code> /
<code>#collapsed</code> / <code>#axis</code> / <code>#legacy</code> /
<code>#stress</code> / <code>#bottom</code>(可逗号组合)。
</p>
<h3>三、企业级内涵:章节制 + 导轨</h3>
<ul>
<li>
侧栏分品牌区 / 工作区 / 业务域 / 底部系统区四段,用 1px
极低对比线切开;深蓝渐变压到近实色,去掉原 55% 处发亮的 <code>#14204E</code>。
</li>
<li>
章节头与二级项同为 36px(原
40px),靠字重、导轨与组间留白区分层级;<b>组内紧密、组间分明</b>——12 项组不逐项加
gap,把间距预算留给章节之间(10–16px),长菜单才不失控。 展开章内一根 1px
竖向导轨串起所有子项,激活域导轨转品牌蓝。
</li>
<li>
<b>二级菜单不渲染语义图标</b>:改成导轨上的统一圆点 +
从导轨接过来的短横,选中时圆点转品牌蓝实心带亮环。理由:12 个不同线性形状在 36px
行里形成锯齿边;图标在一级负责识别业务域,二级靠缩进与文字定位;<code
>iconMap</code
>
白名单的配错半径从「所有页面」缩到「4 个一级域」。<b
>后端 <code>sys_menu.icon</code> 字段不动</b
>,只是前端不读二级的。
</li>
<li>
激活信号三级递进:左缘章节刻度(未激活 2×10px 极淡刻痕 / 激活拉长成 2px 品牌蓝)→
激活域一层 6% 淡染 → 选中页向右淡出的光楔 + 节点亮环。
不铺满整行的等宽底色,其余全暗。
</li>
<li>
折叠态 68px 图标栏,hover 弹出该域子项;折叠按钮从 Header
收回侧栏底部,激活域刻度加粗到 3px(68px 栏里唯一的位置信号)。
</li>
<li>
长菜单上下各 26px
渐隐遮罩,只在真的还有内容时出现,静默提示可滚动;折叠态两条区段标收成一条线,不把图标栏切碎。
</li>
</ul>
<h3>四、Token(沿用品牌资产,不另起色系)</h3>
<div class="tokens">
<div class="tok">
<span class="sw" style="background: #0b1437"></span><b>nav-ink</b> #0B1437
</div>
<div class="tok">
<span class="sw" style="background: #0d1739"></span><b>nav-ink-2</b> #0D1739
</div>
<div class="tok">
<span class="sw" style="background: #2b5ce6"></span><b>nav-rail</b> #2B5CE6
</div>
<div class="tok">
<span class="sw" style="background: #5b8def"></span><b>nav-rail-lit</b> #5B8DEF
</div>
<div class="tok">
<span class="sw" style="background: #e8edf8"></span><b>nav-label</b> #E8EDF8
</div>
<div class="tok">
<span class="sw" style="background: #303b50"></span><b>nav-count</b>
rgba(198,220,255,.12)
</div>
</div>
<p style="margin-top: 10px">
字阶:品牌名 15/700 · 章节头 13/600 · 二级项 13/400 · 域计数 11 等宽数字 · 品牌副标
10/0.7px(唯一保留 uppercase 处,因为它是英文)。中文标题一律
<code>letter-spacing: 0</code>。
</p>
<h3>五、已落地实现(本稿与代码一致)</h3>
<p>
落地路径定为<b>自绘 SideNav</b>:<code>type:'group'</code>
会回退「一级可折叠」(group 标题在 inline 模式下点不动);继续用 antd SubMenu +
自定义 label 则要覆盖
<code>.ant-menu-title-content</code> 盒模型才能撑开四列网格,且章节头 32 / 子项 34
的高度差 token 表达不了,等于给组件打一串 CSS 补丁。自绘只换渲染层。
</p>
<ul>
<li>
<b>新增</b>
<code>apps/web/shell/src/layouts/SideNav.tsx</code>:四列网格章节头、真实子项计数
<code>g.children.length</code>、导轨 + 短横 +
统一节点、激活刻度、滚动渐隐、折叠态浮层(portal 到 body,点外部 / Esc
关闭)、<code>aria-expanded / aria-current / focus-visible / reduced-motion</code
>。图标白名单只服务一级域与工作台单入口。
</li>
<li>
<code>BasicLayout.tsx</code>:删掉 antd <code><Menu></code> 与
<code>items</code> 构造,改为传 <code>visibleGroups</code>(权限过滤后剔空组)与
<code>isGroupOpen / onToggleGroup</code>;<code>selectedKey</code> 最长前缀、<code
>openKeys</code
>
受控校准、<code>onNavigate</code> 里的
<code>PAGE_LEAVE_EVENT / cancelRequests / navigate</code> 三段原样保留;折叠按钮从
Header 收回侧栏底部。
</li>
<li>
<code>theme/design.css</code>:替换 Sider / Menu 段,删渐变中段亮色、<code
>::after</code
>
地面带、<code>letter-spacing: 2px</code> 与 <code>uppercase</code>;新增全部
<code>.uj-*</code> 自绘样式,不覆盖任何 <code>.ant-*</code> 内部盒模型。
</li>
<li>
<code>packages/design-tokens/src/themeConfig.ts</code>:移除 9 个无消费的
<code>dark*</code> token 与 <code>collapsedWidth</code>(旧注释「必须与 Sider
保持一致」已失效);保留 light Menu 几何 token,唯一的消费者是 Header 头像下拉。
</li>
</ul>
<h3>六、本轮反馈调整(本稿与代码同步)</h3>
<ul>
<li>
<b>折叠按钮对齐</b>:落地代码原用 antd
<code>MenuFoldOutlined / MenuUnfoldOutlined</code
>(带方框与三条横线),与稿子里的极简线稿不一致;改成与原型逐路径相同的自绘
SVG(chevron + 竖线,15px / stroke 1.7)。
</li>
<li>
<b>间距</b>:区段标 26→28、章节头 32→36、二级项 34→36、章节间距
4/2→10/6、章节体内边距 2/6→6/8;组内仍紧密,预算留给组间。
</li>
<li>
<b>背景创新</b>:选中项整行等宽蓝底 → 从左端 3×16px 短刻度向右淡出的光楔(82%
处归零);侧栏加品牌区径向光弧、左缘 1px 索引标尺、每章一枚 2×10px
刻痕(激活章拉长成蓝刻度),激活域再加一层 6% 淡染。
</li>
<li>
<b>域计数降对比</b>:<code>#7E8DB0</code> →
<code>rgba(198,220,255,.12)</code>(超人在实现里继续压暗后的最终值),字重
500→400,只在 hover / 激活时短暂提亮;激活态 <code>#A9BBE8</code> →
<code>rgba(198,220,255,.62)</code>。
</li>
<li>
<b>连接线调暗</b>:导轨与短横 <code>.16</code> → <code>.09</code>,激活章
<code>.42</code> → <code>.08</code>(同上,继续压暗后的定稿),选中项那根短横
<code>.78</code>;12 条短横不再连成发亮的虚线带。
</li>
<li>
<b>hover 与选中统一</b>:hover 原是整行白灰底
<code>rgba(255,255,255,.05~.055)</code
>,与选中光楔两套语言。改成<b>选中态的低强度预览</b>——同一条品牌蓝光楔、同样四个停靠点,每档约
4 成强度(<code>.12/.04/.01/0</code> vs
<code>.28/.10/.02/0</code>);短刻度与亮环仍只属于「当前页」,hover 用
<code>:not(.is-active)</code> 显式排除。刻痕 hover 转品牌蓝
<code>.5</code>、节点圆点 <code>.62</code>、单根短横
<code>.24</code>,都是同族递进。折叠态浮层也一并换掉旧的整行实底(选中项补 3×14px
短刻度)。
</li>
</ul>
<div class="legend">
菜单文案取自 <code>packages/biz/src/config/menu.json</code> 与
<code>scripts/*-menu-complete.sql</code>
的真实后端配置;页面指标卡、门店列表、角色名是演示数据,不代表真实业务。后端
<code>sys_menu.icon</code> 字段未改动,只是前端不再渲染二级图标。
</div>
</div>
</details>
</div>
</div>
</div>
<script>
/* ---------------- 图标:内联 stroke SVG,无外部依赖 ---------------- */
const P = {
dashboard:
'<rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/>',
store:
'<path d="M3 9l1.6-5h14.8L21 9"/><path d="M4 9v11h16V9"/><path d="M3 9a3 3 0 0 0 6 0 3 3 0 0 0 6 0 3 3 0 0 0 6 0"/><path d="M10 20v-6h4v6"/>',
gift: '<rect x="3" y="9" width="18" height="12" rx="1.5"/><path d="M3 13h18M12 9v12"/><path d="M12 9C9 9 7 8 7 6a2.5 2.5 0 0 1 5 0c0 2 2 3 0 3zM12 9c3 0 5-1 5-3a2.5 2.5 0 0 0-5 0c0 2-2 3 0 3z"/>',
car: '<path d="M4 16v2.5M20 16v2.5"/><path d="M3 16l1.5-6A2 2 0 0 1 6.4 8.5h11.2A2 2 0 0 1 19.5 10L21 16v1H3v-1z"/><circle cx="7" cy="16" r="1.4"/><circle cx="17" cy="16" r="1.4"/><path d="M5 13h14"/>',
settings:
'<circle cx="12" cy="12" r="3"/><path d="M12 2.5v2.2M12 19.3v2.2M21.5 12h-2.2M4.7 12H2.5M18.7 5.3l-1.6 1.6M6.9 17.1l-1.6 1.6M18.7 18.7l-1.6-1.6M6.9 6.9L5.3 5.3"/>',
upload:
'<path d="M12 16V4m0 0L8 8m4-4l4 4"/><path d="M4 15v4a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-4"/>',
audit:
'<rect x="4" y="3" width="16" height="18" rx="2"/><path d="M8 9h8M8 13h5M8 17l2 2 4-4"/>',
list: '<path d="M8 6h12M8 12h12M8 18h12"/><path d="M4 6h.01M4 12h.01M4 18h.01"/>',
chart: '<path d="M4 20V10M10 20V4M16 20v-7M22 20H2"/>',
target:
'<circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="5"/><circle cx="12" cy="12" r="1.2"/>',
flask:
'<path d="M9 3h6M10 3v6L4.5 18a1.5 1.5 0 0 0 1.3 2.2h12.4A1.5 1.5 0 0 0 19.5 18L14 9V3"/><path d="M7 15h10"/>',
sliders:
'<path d="M4 7h10M18 7h2M4 17h2M10 17h10"/><circle cx="16" cy="7" r="2"/><circle cx="8" cy="17" r="2"/>',
tool: '<path d="M14.5 6.5a4.5 4.5 0 0 0-5.9 5.9L3 18l3 3 5.6-5.6a4.5 4.5 0 0 0 5.9-5.9l-2.6 2.6-2.4-2.4 2.6-2.6z"/>',
send: '<path d="M21 3L10 14M21 3l-7 18-4-7-7-4 18-7z"/>',
ledger: '<rect x="4" y="3" width="16" height="18" rx="2"/><path d="M8 8h8M8 12h8M8 16h5"/>',
swap: '<path d="M16 3h5v5"/><path d="M21 3l-6 6a6 6 0 0 0-8 8L3 21"/><path d="M8 21H3v-5"/><path d="M3 21l6-6"/>',
file: '<path d="M6 3h8l5 5v13H6z"/><path d="M14 3v5h5M9 13h7M9 17h7"/>',
shield: '<path d="M12 2l8 3v6c0 5-3.5 9-8 11-4.5-2-8-6-8-11V5z"/><path d="M9 12l2 2 4-4"/>',
wechat:
'<path d="M9 4C5 4 2 6.7 2 10c0 1.9 1 3.6 2.7 4.7L4 17l2.6-1.3c.8.2 1.6.3 2.4.3"/><path d="M22 15c0-2.8-2.7-5-6-5s-6 2.2-6 5 2.7 5 6 5c.7 0 1.4-.1 2-.3L20 21l-.6-2c1.6-.9 2.6-2.3 2.6-4z"/>',
pay: '<circle cx="12" cy="12" r="9"/><path d="M12 6v12M9 9.5h4a1.8 1.8 0 0 1 0 3.6h-2a1.8 1.8 0 0 0 0 3.6h4"/>',
chev: '<path d="M9 5l7 7-7 7"/>',
fold: '<path d="M14 5l-7 7 7 7"/><path d="M20 5v14"/>',
unfold: '<path d="M10 5l7 7-7 7"/><path d="M4 5v14"/>',
dot: '<circle cx="12" cy="12" r="3"/>',
};
function svg(name, size) {
return (
'<svg width="' +
(size || 16) +
'" height="' +
(size || 16) +
'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' +
(P[name] || P.dot) +
'</svg>'
);
}
function paintIcons(root) {
root.querySelectorAll('[data-icon]').forEach(function (el) {
var n = el.getAttribute('data-icon');
var s = 15;
if (el.closest('.chev')) s = 11;
else if (el.closest('.chap-head') || el.closest('.solo')) s = 17;
el.innerHTML = svg(n, s);
});
}
/* ---------------- 菜单数据:全部取自真实后端配置 ---------------- */
const DOMAINS = [
{
id: 'store',
name: '门店上架',
icon: 'store',
children: [
{ name: '导入门店信息', icon: 'upload' },
{ name: '门店审批', icon: 'audit' },
{ name: '门店列表', icon: 'list' },
],
},
{
id: 'points',
name: '积分管理',
icon: 'gift',
children: [
{ name: '积分核销订单', icon: 'file' },
{ name: '用户积分明细', icon: 'chart' },
{ name: '积分提现管理', icon: 'pay' },
{ name: '积分提现审批', icon: 'audit' },
],
},
{
id: 'usedcar',
name: '二手车管理',
icon: 'car',
children: [
{ name: '数据看板', icon: 'chart' },
{ name: '线索管理', icon: 'target' },
{ name: '评估管理', icon: 'flask' },
{ name: '运营管理', icon: 'sliders' },
{ name: '车辆管理', icon: 'tool' },
{ name: '交付单管理', icon: 'send' },
{ name: '车辆台账', icon: 'ledger' },
{ name: '离职继承', icon: 'swap' },
{ name: '报告管理', icon: 'file' },
{ name: '车况信息', icon: 'shield' },
{ name: '一客一群(预生成)', icon: 'wechat' },
{ name: '付款管理', icon: 'pay' },
],
},
{
id: 'system',
name: '系统设置',
icon: 'settings',
children: [
{ name: '角色管理', icon: 'dot' },
{ name: '账号管理', icon: 'dot' },
],
},
];
/* 字数压力测试用的演示串(3/4/5/7 字),非业务文案;只替换业务域章节,工作台保持真实文案 */
const STRESS = ['运营域', '门店上架', '二手车管理', '一客一群预生成'];
let state = {
collapsed: false,
axis: false,
legacy: false,
stress: false,
open: { store: true, points: false, usedcar: false, system: false },
active: 'store:门店审批',
popover: null,
};
/* ---------------- 渲染 ---------------- */
const chaptersEl = document.getElementById('chapters');
const popover = document.getElementById('popover');
function domainName(d, i) {
return state.stress ? STRESS[i] : d.name;
}
function isCurrentDomain(d) {
return state.active !== '工作台' && state.active.split(':')[0] === d.id;
}
function render() {
chaptersEl.innerHTML = DOMAINS.map(function (d, i) {
var current = isCurrentDomain(d);
var open = !!state.open[d.id];
var leaves = d.children
.map(function (c) {
var key = d.id + ':' + c.name;
// 二级不渲染 m.icon:后端 sys_menu.icon 字段保留(一级还要用),只是前端不读它。
return (
'<button type="button" class="leaf' +
(state.active === key ? ' is-active' : '') +
'" data-key="' +
key +
'" title="' +
c.name +
'">' +
'<span class="node" aria-hidden="true"></span>' +
'<span class="txt">' +
c.name +
'</span>' +
'</button>'
);
})
.join('');
return (
'<div class="chapter' +
(open ? ' is-open' : '') +
(current ? ' is-current' : '') +
'" data-id="' +
d.id +
'">' +
'<button type="button" class="chap-head" data-toggle="' +
d.id +
'" aria-expanded="' +
open +
'" title="' +
domainName(d, i) +
'">' +
'<span class="ico" data-icon="' +
d.icon +
'"></span>' +
'<span class="label">' +
domainName(d, i) +
'</span>' +
'<span class="count">' +
d.children.length +
'</span>' +
'<span class="chev" data-icon="chev"></span>' +
'</button>' +
'<div class="chap-body">' +
leaves +
'</div>' +
'</div>'
);
}).join('');
paintIcons(chaptersEl);
renderSolo();
syncActiveCopy();
updateFade();
}
function renderSolo() {
var el = document.getElementById('solo');
el.classList.toggle('is-active', state.active === '工作台');
el.querySelector('.txt').textContent = '工作台';
paintIcons(el);
}
function syncActiveCopy() {
var label, group;
if (state.active === '工作台') {
label = '工作台';
group = '工作区';
} else {
var parts = state.active.split(':');
var d = DOMAINS.find(function (x) {
return x.id === parts[0];
});
label = parts[1];
group = d ? d.name : '业务域';
}
document.getElementById('crumbNow').textContent = label;
document.getElementById('crumbGroup').textContent = group;
document.getElementById('pageTitle').textContent = label;
}
function applyFlags() {
var app = document.getElementById('app');
app.classList.toggle('is-collapsed', state.collapsed);
app.classList.toggle('show-axis', state.axis);
app.classList.toggle('legacy', state.legacy);
document.getElementById('tFold').setAttribute('aria-pressed', String(state.collapsed));
document.getElementById('tAxis').setAttribute('aria-pressed', String(state.axis));
document.getElementById('tLegacy').setAttribute('aria-pressed', String(state.legacy));
document.getElementById('tStress').setAttribute('aria-pressed', String(state.stress));
var fb = document.getElementById('foldBtn');
fb.setAttribute('aria-label', state.collapsed ? '展开导航' : '收起导航');
fb.title = state.collapsed ? '展开导航' : '收起导航';
fb.querySelector('span').setAttribute('data-icon', state.collapsed ? 'unfold' : 'fold');
paintIcons(fb);
if (!state.collapsed) hidePopover();
updateFade();
}
function updateFade() {
var n = document.getElementById('nav');
var more = n.scrollHeight - n.clientHeight;
document.getElementById('fadeTop').classList.toggle('is-on', n.scrollTop > 4);
document
.getElementById('fadeBottom')
.classList.toggle('is-on', more > 4 && n.scrollTop < more - 4);
}
document.getElementById('nav').addEventListener('scroll', updateFade);
function showPopover(d, anchor) {
var rect = anchor.getBoundingClientRect();
popover.innerHTML =
'<div class="p-title">' +
domainName(d, DOMAINS.indexOf(d)) +
'</div>' +
d.children
.map(function (c) {
var key = d.id + ':' + c.name;
return (
'<button type="button" class="p-item' +
(state.active === key ? ' is-active' : '') +
'" data-key="' +
key +
'">' +
c.name +
'</button>'
);
})
.join('');
popover.classList.add('is-visible');
popover.style.left = rect.right + 8 + 'px';
var h = Math.min(popover.offsetHeight || 300, window.innerHeight - 24);
popover.style.top = Math.max(12, Math.min(rect.top, window.innerHeight - h - 12)) + 'px';
state.popover = d.id;
}
function hidePopover() {
popover.classList.remove('is-visible');
state.popover = null;
}
/* ---------------- 交互 ---------------- */
chaptersEl.addEventListener('click', function (e) {
var head = e.target.closest('[data-toggle]');
if (head) {
var id = head.getAttribute('data-toggle');
var d = DOMAINS.find(function (x) {
return x.id === id;
});
if (state.collapsed) {
if (state.popover === id) {
hidePopover();
return;
}
showPopover(d, head);
} else {
state.open[id] = !state.open[id];
render();
}
return;
}
var leaf = e.target.closest('.leaf');
if (leaf) {
select(leaf.getAttribute('data-key'));
}
});
document.getElementById('solo').addEventListener('click', function () {
select('工作台');
});
popover.addEventListener('click', function (e) {
var item = e.target.closest('.p-item');
if (item) {
select(item.getAttribute('data-key'));
hidePopover();
}
});
document.addEventListener('click', function (e) {
if (state.popover && !e.target.closest('.popover') && !e.target.closest('[data-toggle]'))
hidePopover();
});
function select(key) {
state.active = key;
var id = key.split(':')[0];
if (id !== '工作台') state.open[id] = true;
render();
document.getElementById('nav').scrollTop = document.getElementById('nav').scrollTop;
}
/* 工具条 */
function toggleFold() {
state.collapsed = !state.collapsed;
applyFlags();
}
document.getElementById('foldBtn').addEventListener('click', toggleFold);
document.getElementById('tFold').addEventListener('click', toggleFold);
document.getElementById('tAxis').addEventListener('click', function () {
state.axis = !state.axis;
applyFlags();
});
document.getElementById('tLegacy').addEventListener('click', function () {
state.legacy = !state.legacy;
applyFlags();
});
document.getElementById('tStress').addEventListener('click', function () {
state.stress = !state.stress;
render();
});
document.getElementById('tAll').addEventListener('click', function () {
DOMAINS.forEach(function (d) {
state.open[d.id] = true;
});
state.collapsed = false;
applyFlags();
render();
});
document.getElementById('tReset').addEventListener('click', function () {
state = {
collapsed: false,
axis: false,
legacy: false,
stress: false,
open: { store: true, points: false, usedcar: false, system: false },
active: 'store:门店审批',
popover: null,
};
hidePopover();
applyFlags();
render();
});
window.addEventListener('resize', function () {
if (window.innerWidth < 720 && !state.collapsed) {
state.collapsed = true;
}
applyFlags();
});
/* URL hash 直达状态,方便评审截图 / 分享具体状态:
#all 展开全部 · #collapsed 折叠栏 · #axis 对齐轴 · #legacy 旧版字距 · #stress 字数压力 */
(function initFromHash() {
var h = location.hash.replace(/^#/, '').split(',');
if (h.indexOf('all') >= 0)
DOMAINS.forEach(function (d) {
state.open[d.id] = true;
});
if (h.indexOf('collapsed') >= 0) state.collapsed = true;
if (h.indexOf('axis') >= 0) state.axis = true;
if (h.indexOf('legacy') >= 0) state.legacy = true;
if (h.indexOf('stress') >= 0) state.stress = true;
})();
/* 首帧 */
paintIcons(document.getElementById('sider'));
render();
applyFlags();
if (window.innerWidth < 720) {
state.collapsed = true;
applyFlags();
}
if (location.hash.indexOf('bottom') >= 0) {
var navEl = document.getElementById('nav');
navEl.scrollTop = navEl.scrollHeight;
updateFade();
}
</script>
</body>
</html>