-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
2881 lines (2621 loc) · 233 KB
/
Copy pathindex.html
File metadata and controls
2881 lines (2621 loc) · 233 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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Veape Studio</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap" rel="stylesheet">
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
dark: {
bg: '#0f172a',
card: '#1e293b',
text: '#f8fafc',
muted: '#94a3b8'
}
}
}
}
}
</script>
<!-- 核心库:使用 Cloudflare CDN 确保稳定性 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.2.0/umd/react.production.min.js"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.2.0/umd/react-dom.production.min.js"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/7.23.5/babel.min.js"
crossorigin="anonymous"></script>
<!-- LeanCloud SDK -->
<script src="https://cdn.jsdelivr.net/npm/leancloud-storage@4.15.0/dist/av-min.js"></script>
<script>
// --- [配置区域] ---
// 警告:LeanCloud 密钥和 AppID 已公开。在实际项目中,请勿在客户端代码中硬编码敏感信息。
const LC_CONFIG = {
appId: "yiH4miM1mv1Wd3gR5qknSDLQ-gzGzoHsz",
appKey: "S1hUg6WIYZqWNSf10el4ECzd",
serverURL: "https://yih4mim1.lc-cn-n1-shared.com"
};
// 初始化 LeanCloud
window.initLeanCloud = function() {
if (typeof AV === 'undefined') return false;
// 检查是否使用了默认的占位符配置
if (LC_CONFIG.appId === "请替换为您的AppID") return false;
let safeURL = LC_CONFIG.serverURL.trim();
// 移除协议头,确保使用 HTTPS
safeURL = safeURL.replace(/https?:\/\//g, "").replace(/\/+$/, "");
safeURL = "https://" + safeURL;
try {
// LeanCloud 初始化
AV.init({
appId: LC_CONFIG.appId,
appKey: LC_CONFIG.appKey,
serverURL: safeURL
});
console.log("LeanCloud initialized");
return true;
} catch (e) {
console.error("LeanCloud init error:", e);
return false;
}
};
window.isLCReady = false;
// 页面加载完成后尝试初始化 LeanCloud
window.addEventListener('load', () => {
window.isLCReady = window.initLeanCloud();
});
</script>
<style>
/* 全局样式和背景动画 */
body {
font-family: 'Nunito', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
-webkit-tap-highlight-color: transparent;
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
background-size: 400% 400%;
animation: gradientBG 15s ease infinite;
color: #334155;
overflow: hidden;
}
html.dark body {
background: linear-gradient(-45deg, #020617, #1e1b4b, #312e81, #0f172a);
background-size: 400% 400%;
color: #e2e8f0;
}
@keyframes gradientBG {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
/* 动态流体背景 */
.blob-cont {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
overflow: hidden;
pointer-events: none;
}
.blob {
position: absolute;
border-radius: 50%;
filter: blur(80px);
opacity: 0.4;
animation: floatBlob 20s infinite ease-in-out alternate;
}
html.dark .blob {
opacity: 0.2;
}
.blob-1 {
top: -10%;
left: -10%;
width: 50vw;
height: 50vw;
background: #bfdbfe;
animation-delay: 0s;
}
.blob-2 {
bottom: -10%;
right: -10%;
width: 60vw;
height: 60vw;
background: #e9d5ff;
animation-delay: -5s;
}
html.dark .blob-1 {
background: #1e3a8a;
}
html.dark .blob-2 {
background: #581c87;
}
.blob-3 {
top: 30%;
right: 20%;
width: 30vw;
height: 30vw;
background: #fecaca;
animation-delay: -10s;
}
/* 确保 blob-3 在暗模式下的样式也被定义 */
html.dark .blob-3 {
background: #7c2d12;
}
@keyframes floatBlob {
0% {
transform: translate(0, 0) scale(1);
}
50% {
transform: translate(30px, -50px) scale(0.9);
}
100% {
transform: translate(0, 0) scale(1);
}
}
/* 自定义滚动条 */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: rgba(255, 255, 255, 0.1);
}
::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.3);
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.5);
}
html.dark ::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.2);
}
html.dark ::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.15);
}
.safe-area-pb {
padding-bottom: env(safe-area-inset-bottom);
}
/* 动画 */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes popIn {
0% {
opacity: 0;
transform: scale(0.9);
}
70% {
transform: scale(1.02);
}
100% {
opacity: 1;
transform: scale(1);
}
}
@keyframes shimmer {
0% {
background-position: -200% 0;
}
100% {
background-position: 200% 0;
}
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes breathe-glow {
0%,
100% {
box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}
50% {
box-shadow: 0 0 25px rgba(59, 130, 246, 0.8);
}
}
.animate-enter {
animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.animate-pop {
animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
opacity: 0;
}
.animate-spin-slow {
animation: spin 4s linear infinite;
}
.modal-overlay {
animation: fadeInUp 0.2s ease-out forwards;
backdrop-filter: blur(4px);
background: rgba(0, 0, 0, 0.2);
}
.spinner {
border: 3px solid rgba(59, 130, 246, 0.3);
border-radius: 50%;
border-top: 3px solid #3b82f6;
width: 24px;
height: 24px;
animation: spin 1s linear infinite;
}
.skeleton {
background: linear-gradient(90deg, rgba(255, 255, 255, 0.1) 25%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.1) 75%);
background-size: 200% 100%;
animation: shimmer 1.5s infinite;
border-radius: 0.5rem;
}
html.dark .skeleton {
background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 75%);
}
/* 交互效果 */
.hover-lift {
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.hover-lift:hover {
transform: translateY(-4px);
}
.tilt-card {
transition: transform 0.1s ease-out;
transform-style: preserve-3d;
}
.logo-glow {
animation: breathe-glow 3s infinite ease-in-out;
}
/* 磨砂玻璃效果 */
.glass-panel {
background: rgba(255, 255, 255, 0.65);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(255, 255, 255, 0.5);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}
html.dark .glass-panel {
background: rgba(30, 41, 59, 0.6);
border: 1px solid rgba(255, 255, 255, 0.08);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}
.glass-sidebar {
background: rgba(255, 255, 255, 0.75);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-right: 1px solid rgba(255, 255, 255, 0.6);
}
html.dark .glass-sidebar {
background: rgba(15, 23, 42, 0.8);
border-right: 1px solid rgba(255, 255, 255, 0.05);
}
/* Custom Toggle Switch Style */
.toggle-switch input[type="checkbox"] {
display: none;
}
.toggle-switch label {
display: block;
width: 48px;
height: 24px;
background-color: #cbd5e1;
/* slate-300 */
border-radius: 9999px;
position: relative;
cursor: pointer;
transition: background-color 0.3s;
}
.toggle-switch label::after {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: 20px;
height: 20px;
background-color: white;
border-radius: 50%;
transition: transform 0.3s;
}
.toggle-switch input[type="checkbox"]:checked+label {
background-color: var(--primary-color, #3b82f6);
/* blue-500 default */
}
.toggle-switch input[type="checkbox"]:checked+label::after {
transform: translateX(24px);
}
/* Dark mode compatibility */
html.dark .toggle-switch label {
background-color: #475569;
/* slate-600 */
}
/* --- 主题扩散过渡样式 --- */
.theme-transition-layer {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 1000;
/* 确保在最顶层 */
pointer-events: none;
/* 默认不可交互 */
}
/* 扩散效果的圆形元素 */
.ripple-circle {
position: absolute;
width: 0px;
height: 0px;
border-radius: 50%;
transform: translate(-50%, -50%);
/* 居中于定位点 */
pointer-events: all;
/* 动画时可交互,防止用户快速重复点击 */
opacity: 0;
/* 默认隐藏 */
}
/* 扩散动画 */
@keyframes ripple-expand {
0% {
width: 0px;
height: 0px;
opacity: 1;
/* 动画开始时显示 */
}
100% {
/* 确保圆形足够大以覆盖任何屏幕 (对角线长度的 2-3 倍) */
width: 300vmax;
height: 300vmax;
opacity: 1;
}
}
/* --- 主题扩散过渡样式 (结束) */
</style>
</head>
<body
class="h-screen overflow-hidden selection:bg-indigo-200 selection:text-indigo-900 dark:selection:bg-indigo-500 dark:selection:text-white">
<div class="blob-cont">
<div class="blob blob-1"></div>
<div class="blob blob-2"></div>
<div class="blob blob-3"></div>
</div>
<div id="root" class="h-full relative z-10"></div>
<script type="text/babel">
const { useState, useEffect, useRef, useMemo, useContext, createContext, useCallback } = React;
// --- 全局常量定义 ---
const THEMES = [
{ id: 'blue', name: '极光蓝', primary: 'blue', accent: 'cyan' },
{ id: 'rose', name: '樱花粉', primary: 'rose', accent: 'pink' },
{ id: 'violet', name: '星云紫', primary: 'violet', accent: 'fuchsia' },
{ id: 'emerald', name: '森林绿', primary: 'emerald', accent: 'lime' },
{ id: 'orange', name: '活力橙', primary: 'orange', accent: 'amber' },
{ id: 'teal', name: '海洋青', primary: 'teal', accent: 'cyan' },
{ id: 'indigo', name: '深海蓝', primary: 'indigo', accent: 'violet' },
];
// --- 全局常量定义 ---
// ... (THEMES 保持不变)
const DEFAULT_QUOTES = ["今天也是元气满满的一天!✨", "教育的本质是唤醒。🌱", "种一棵树最好的时间是十年前,其次是现在。🌲", "星光不问赶路人。⭐"];
const LEVEL_SALARY_MAP = {
'初级 3 级':900,
'初级 2 级': 1000,
'初级 1 级': 1100,
'中级 3 级': 1200,
'中级 2 级': 1300,
'中级 1 级': 1400,
'高级 3 级': 1600,
'高级 2 级': 1800,
'高级 1 级': 2000,
'默认': 1000,
};
// 修改:固定的课程任务列表 (5项)
const DEFAULT_TASKS = [
{ id: 'teachingDone', name: '授课完成' },
{ id: 'interpretationSent', name: '解读发送' },
{ id: 'homeworkSent', name: '作业发送' },
{ id: 'reflectionDone', name: '反思完成' },
{ id: 'momentsPosted', name: '朋友圈发送' }, // 新增的任务
];
// --- Context ---
const AppDataContext = createContext(null);
const ToastContext = createContext(null);
// --- 基础设施组件 ---
const ToastProvider = ({ children }) => {
const [toasts, setToasts] = useState([]);
const TOAST_DURATION = 5000;
// 确保使用 useCallback 避免不必要的重渲染
const addToast = useCallback((msg, type = 'info') => {
const id = Date.now();
setToasts(p => [...p, { id, msg, type }]);
setTimeout(() => setToasts(p => p.filter(t => t.id !== id)), TOAST_DURATION);
}, []);
return (
<ToastContext.Provider value={addToast}>
{children}
<div className="fixed top-6 left-1/2 transform -translate-x-1/2 z-[100] flex flex-col gap-2 w-auto min-w-[300px]">
{toasts.map(t => (
<div
key={t.id}
className={`animate-enter px-6 py-3 rounded-2xl shadow-2xl flex items-center justify-between backdrop-blur-xl border border-white/20 dark:border-white/10 text-sm font-bold ${
t.type === 'error' ? 'bg-red-500/80 text-white' :
t.type === 'success' ? 'bg-emerald-500/80 text-white' :
'bg-white/80 dark:bg-slate-800/90 text-slate-800 dark:text-slate-100'
}`}
>
<span>{t.type==='success'?'🎉 ':t.type==='error'?'⚠️ ':'💡 '} {t.msg}</span>
</div>
))}
</div>
</ToastContext.Provider>
);
};
const useToast = () => useContext(ToastContext) || (() => {});
const useAppData = () => useContext(AppDataContext);
// --- 简化版的确认模态框工具函数 (全局) ---
const showConfirmModal = (message, onConfirm) => {
if(window.confirm(message)) {
onConfirm();
}
};
// Icons (Lucide Icons)
const Icon = ({ path, size = 20, className = "" }) => (<svg xmlns="http://www.w3.org/2000/svg" width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>{path}</svg>);
const icons = {
Home: <><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></>,
Users: <><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></>,
Calendar: <><rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></>,
PhoneCall: <><path d="M15.05 5A5 5 0 0 1 19 8.95M15.05 1A9 9 0 0 1 23 8.94m-1 7.98v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/></>,
CheckSquare: <><polyline points="9 11 12 14 22 4"/><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"/></>,
ClipboardList: <><rect x="8" y="2" width="8" height="4" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="M12 11h4"/><path d="M12 16h4"/><path d="M8 11h.01"/><path d="M8 16h.01"/></>,
Plus: <><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></>,
Trash2: <><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/></>,
Edit: <><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></>,
X: <><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></>,
ChevronLeft: <><polyline points="15 18 9 12 15 6"/></>,
ChevronRight: <><polyline points="9 18 15 12 9 6"/></>,
Clock: <><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></>,
UserCheck: <><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="8.5" cy="7" r="4"/><polyline points="17 11 19 13 23 9"/></>,
AlertCircle: <><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></>,
Layers: <><polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 17 12 22 22 17"/><polyline points="2 12 12 17 22 12"/></>,
Palette: <><circle cx="13.5" cy="6.5" r=".5"/><circle cx="17.5" cy="10.5" r=".5"/><circle cx="8.5" cy="7.5" r=".5"/><circle cx="6.5" cy="12.5" r=".5"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.01 17.461 2 12 2z"/></>,
TrendingUp: <><polyline points="23 6 13.5 15.5 8.5 10.5 1 18"/><polyline points="17 6 23 6 23 12"/></>,
Download: <><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></>,
Search: <><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></>,
Cloud: <><path d="M18 10h-1.26A8 8 0 1 0 9 20h9a5 5 0 0 0 0-10z"/></>,
RefreshCw: <><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10"/><path d="M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></>,
Database: <><ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/></>,
UploadCloud: <><polyline points="16 16 12 12 8 16"/><line x1="12" y1="12" x2="12" y2="21"/><path d="M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"/><polyline points="16 16 12 12 8 16"/></>,
UserX: <><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="8.5" cy="7" r="4"/><line x1="18" y1="8" x2="23" y2="13"/><line x1="23" y1="8" x2="18" y2="13"/></>,
PieChart: <><path d="M21.21 15.89A10 10 0 1 1 8 2.83"/><path d="M22 12A10 10 0 0 0 12 2v10z"/></>,
Activity: <><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/></>,
Award: <><circle cx="12" cy="8" r="7"/><polyline points="8.21 13.89 7 23 12 20 17 23 15.79 13.88"/></>,
Coins: <><circle cx="8" cy="8" r="6"/><path d="M18.09 10.37A6 6 0 1 1 10.34 18"/><path d="M7 6h1v4"/><path d="M17 17v.01"/></>,
Wallet: <><path d="M20 12V8H6a2 2 0 0 1-2-2c0-1.1.9-2 2-2h12v4"/><path d="M4 6v12c0 1.1.9 2 2 2h14v-4"/><path d="M18 12a2 2 0 0 0-2 2c0 1.1.9 2 2 2h4v-4h-4z"/></>,
Settings: <><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></>,
Sparkles: <><path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/><path d="M5 3v4"/><path d="M9 3v4"/><path d="M3 5h4"/><path d="M3 9h4"/></>,
Sun: <><circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/></>,
Moon: <><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/></>,
CloudSun: <><path d="M12 2v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="M20 12h2"/><path d="m19.07 4.93-1.41 1.41"/><path d="M15.947 12.65a4 4 0 0 0-5.925-4.128"/><path d="M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z"/></>,
Coffee: <><path d="M17 8h1a4 4 0 1 1 0 8h-1"/><path d="M3 8h14v9a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4Z"/><line x1="6" y1="1" x2="6" y2="4"/><line x1="10" y1="1" x2="10" y2="4"/><line x1="14" y1="1" x2="14" y2="4"/></>,
Quote: <><path d="M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z"/><path d="M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z"/></>,
BookOpen: <><path d="M2 13h6"/><path d="M2 9h6"/><path d="M16 13h6"/><path d="M16 9h6"/><path d="M2 17h10"/><path d="M12 2h8a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-8a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"/></>
};
const LucideIcon = ({ name, size = 20, className = "" }) => <Icon path={icons[name] || icons.Users} size={size} className={className} />;
// Modal Component
const Modal = ({ isOpen, onClose, title, children }) => {
if (!isOpen) return null;
return (
<div className="fixed inset-0 bg-black/40 flex items-center justify-center z-[60] p-4 safe-area-pb modal-overlay" onClick={onClose}>
<div className="bg-white/90 dark:bg-slate-800/95 backdrop-blur-md rounded-3xl shadow-2xl w-full max-w-lg max-h-[85vh] overflow-y-auto modal-content flex flex-col transform transition-all border border-white/50 dark:border-white/10" onClick={(e) => e.stopPropagation()}>
<div className="flex justify-between items-center p-5 border-b border-gray-100/50 dark:border-slate-700 sticky top-0 bg-white/80 dark:bg-slate-800/80 backdrop-blur z-10 shrink-0">
<h3 className="text-xl font-bold text-slate-800 dark:text-white truncate pr-4 tracking-tight flex items-center gap-2">
<span className="w-1 h-6 bg-blue-500 rounded-full"></span>{title}
</h3>
<button onClick={onClose} className="text-slate-400 dark:text-slate-500 hover:text-slate-700 dark:hover:text-white p-2 rounded-full hover:bg-white/50 dark:hover:bg-slate-700 transition-colors"><LucideIcon name="X" size={24} /></button>
</div>
<div className="p-6 dark:text-slate-200">{children}</div>
</div>
</div>
);
};
// 3D Tilt Card Component
const TiltCard = ({ children, className = "" }) => {
const ref = useRef(null);
const [transform, setTransform] = useState("perspective(1000px) rotateX(0deg) rotateY(0deg) scale(1)");
const handleMouseMove = (e) => {
if (!ref.current) return;
const { left, top, width, height } = ref.current.getBoundingClientRect();
const x = (e.clientX - left) / width;
const y = (e.clientY - top) / height;
const tiltX = (0.5 - y) * 5;
const tiltY = (x - 0.5) * 5;
setTransform(`perspective(1000px) rotateX(${tiltX}deg) rotateY(${tiltY}deg) scale(1.01)`);
};
const handleMouseLeave = () => setTransform("perspective(1000px) rotateX(0deg) rotateY(0deg) scale(1)");
return <div ref={ref} className={`tilt-card ${className}`} style={{ transform }} onMouseMove={handleMouseMove} onMouseLeave={handleMouseLeave}>{children}</div>;
};
const Skeleton = ({ className }) => <div className={`skeleton ${className}`}></div>;
// --- 新增:学员详情页子组件 ---
// 历史课程 Tab
const HistoryTab = ({ data, theme }) => (
<div className="space-y-4">
{data.length > 0 ? data.map((c) => (
<div key={c.id} className="p-4 rounded-xl bg-white dark:bg-slate-700 border border-gray-100 dark:border-slate-600 shadow-sm flex items-start gap-4">
<div className={`w-12 h-12 rounded-lg flex flex-col items-center justify-center text-xs font-bold shrink-0 ${c.type === 'demo' ? 'bg-purple-100 text-purple-600' : `bg-${theme.primary}-100 text-${theme.primary}-600`}`}>
{c.dateStr.slice(5)}
</div>
<div className="flex-1">
<div className="font-bold text-slate-800 dark:text-white">{c.className} {c.type === 'demo' && <span className="text-[10px] bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-300 px-2 py-0.5 rounded-full ml-1">DEMO</span>}</div>
<div className="text-xs text-slate-500 dark:text-slate-400 mt-1 flex flex-col gap-0.5">
<span><LucideIcon name="Clock" size={12} className="inline mr-1"/> {c.startTime} - {c.endTime}</span>
<span><LucideIcon name="BookOpen" size={12} className="inline mr-1"/> {c.content || '暂无内容'}</span>
{c.tasks?.teachingDone && <span className="text-emerald-500"><LucideIcon name="CheckSquare" size={12} className="inline mr-1"/>已结课并完成任务</span>}
</div>
</div>
</div>
)) : (
<div className="text-center py-10 text-slate-400 dark:text-slate-500">该学员暂无历史课程记录。</div>
)}
</div>
);
// 考勤记录 Tab
const AttendanceTab = ({ data, studentId, theme }) => {
const attRecords = data.map(c => ({
date: c.dateStr,
cname: c.className,
type: c.type,
att: c.attendance?.[studentId]
})).filter(r => r.att);
const getStatusColor = (status) => {
if (!status) return 'text-slate-500 bg-slate-100 dark:bg-slate-700 dark:text-slate-400';
if (status === 'present') return 'text-emerald-600 bg-emerald-100 dark:bg-emerald-900/50 dark:text-emerald-400';
if (status === 'absent') return 'text-red-600 bg-red-100 dark:bg-red-900/50 dark:text-red-400';
return 'text-slate-500 bg-slate-100 dark:bg-slate-700 dark:text-slate-400';
};
return (
<div className="space-y-4">
{attRecords.length > 0 ? attRecords.map((r) => (
<div key={r.date + r.cname} className="p-4 rounded-xl bg-white dark:bg-slate-700 border border-gray-100 dark:border-slate-600 shadow-sm flex items-center justify-between">
<div className="flex items-center gap-4">
<div className="text-sm font-bold text-slate-800 dark:text-white">{r.date.slice(5)}</div>
<div className="text-sm text-slate-600 dark:text-slate-300">{r.cname}</div>
</div>
<div className={`px-3 py-1 text-xs font-bold rounded-full ${getStatusColor(r.att.status)}`}>
{r.att.status === 'present' ? '到课' : r.att.status === 'absent' ? '缺勤' : '未记'}
{r.att.isMadeUp && <span className="ml-1 text-xs"> (已补)</span>}
</div>
</div>
)) : (
<div className="text-center py-10 text-slate-400 dark:text-slate-500">该学员暂无考勤记录。</div>
)}
</div>
);
};
// 回访历史 Tab
const FollowUpTab = ({ data, theme }) => {
// 聚合处理:将同一个月的多次记录合并显示
const processedData = React.useMemo(() => {
const groups = data.reduce((acc, curr) => {
const m = curr.monthStr;
if (!acc[m]) acc[m] = { ...curr, count: 0 };
acc[m].count += (Number(curr.count) || 0);
return acc;
}, {});
return Object.values(groups).sort((a, b) => b.monthStr.localeCompare(a.monthStr));
}, [data]);
return (
<div className="space-y-4">
{processedData.length > 0 ? processedData.map((f) => (
<div key={f.monthStr} className="p-4 rounded-xl bg-white dark:bg-slate-700 border border-gray-100 dark:border-slate-600 shadow-sm flex items-center justify-between">
<div className="text-sm font-bold text-slate-800 dark:text-white">
{f.monthStr.slice(0, 4)}年 {f.monthStr.slice(5)}月
</div>
<div className={`px-3 py-1 text-xs font-bold rounded-full ${
f.count >= 2 ? 'bg-emerald-100 text-emerald-600' : 'bg-yellow-100 text-yellow-600'
}`}>
完成次数: {f.count} / 2
</div>
</div>
)) : (
<div className="text-center py-10 text-slate-400">暂无有效记录</div>
)}
</div>
);
};
// 课时交易记录 Tab
const FinanceTab = ({ data, theme, remainingHours }) => (
<div className="space-y-4">
<div className={`p-4 rounded-xl shadow-lg border-l-4 border-${theme.primary}-500 bg-${theme.primary}-50/50 dark:bg-${theme.primary}-900/20 flex justify-between items-center`}>
<div className="font-bold text-slate-700 dark:text-slate-200">当前剩余课时</div>
<div className={`text-2xl font-extrabold text-${remainingHours > 8 ? 'emerald' : remainingHours > 4 ? 'orange' : 'red'}-600 dark:text-white`}>
{remainingHours} <span className="text-sm font-normal">课时</span>
</div>
</div>
<div className="text-xs text-slate-500 dark:text-slate-400 pt-2 pb-1 border-b border-gray-100 dark:border-slate-700">课时变动历史 (模拟记录)</div>
{data.length > 0 ? data.map((t, index) => (
<div key={t.date + index} className="p-3 rounded-xl bg-white dark:bg-slate-700 border border-gray-100 dark:border-slate-600 shadow-sm flex items-center justify-between">
<div>
<div className="text-sm font-bold text-slate-800 dark:text-white">{t.description}</div>
<div className="text-xs text-slate-400 mt-1">{t.date}</div>
</div>
<div className={`text-lg font-extrabold ${t.hours < 0 ? 'text-red-500' : 'text-emerald-500'}`}>
{t.hours > 0 && '+'} {t.hours} h
</div>
</div>
)) : (
<div className="text-center py-10 text-slate-400 dark:text-slate-500">暂无交易记录。</div>
)}
<div className="text-xs text-slate-400 pt-4 border-t border-gray-100 dark:border-slate-700">
* 备注:交易记录是根据扣课时操作模拟生成,实际购课记录需系统进一步扩展。
</div>
</div>
);
// 学员详情主组件
const StudentDetailPage = ({ studentId, onBack }) => {
const {
students, courses, followUps, formatDate, theme,
lcUpdate, fetchAll, getPredictionText // <--- 加入这个
} = useAppData();
const addToast = useToast();
const student = useMemo(() => students.find(s => s.id === studentId), [students, studentId]);
const [activeTab, setActiveTab] = useState('history');
const [isEditOpen, setIsEditOpen] = useState(false);
const [editStudent, setEditStudent] = useState({});
const handleFollowUp = async (studentId) => {
try {
setLoading(true);
const currentMonth = new Date().toISOString().slice(0, 7); // 格式 YYYY-MM
// 1. 先检查本地数据中是否已存在该学员当月的记录
const existing = followUps.find(f => f.studentId === studentId && f.monthStr === currentMonth);
if (existing) {
// 如果已存在,在原有 count 上加 1
const todo = AV.Object.createWithoutData('FollowUp', existing.id);
todo.set('count', (parseInt(existing.count, 10) || 0) + 1);
await todo.save();
} else {
// 如果不存在,新建记录
const FollowUp = AV.Object.extend('FollowUp');
const fu = new FollowUp();
fu.set('studentId', studentId);
fu.set('monthStr', currentMonth);
fu.set('count', 1);
await fu.save();
}
// 2. 强制全量刷新,确保状态同步
await fetchAll();
showToast('回访记录更新成功', 'success');
} catch (error) {
console.error('FollowUp Error:', error);
showToast('记录失败,请检查网络', 'error');
} finally {
setLoading(false);
}
};
useEffect(() => {
if(student) {
setEditStudent(student);
}
}, [student]);
if (!student) {
return (
<div className="p-8 text-center text-red-500 animate-enter pt-20 md:pt-10">
学员信息未找到,<button onClick={onBack} className="text-blue-500 underline">返回列表</button>
</div>
);
}
// --- 数据处理 ---
const studentData = useMemo(() => {
// 1. 历史课程 & 考勤
const history = courses
.filter(c => c.studentIds && c.studentIds.includes(studentId) && c.type !== 'demo')
.sort((a, b) => b.dateStr.localeCompare(a.dateStr)); // 最近的在前
// 2. 回访历史
// --- 修改开始 ---
const fuHistory = useMemo(() => {
// 过滤出该学员的记录
const raw = followUps.filter(f => f.studentId === studentId);
// 按月合并(防止数据库有重复行导致次数虚高)
const grouped = raw.reduce((acc, curr) => {
const m = curr.monthStr;
if(!acc[m]) acc[m] = { ...curr, count: 0 };
acc[m].count += (Number(curr.count) || 0);
return acc;
}, {});
return Object.values(grouped).sort((a, b) => b.monthStr.localeCompare(a.monthStr));
}, [followUps, studentId]);
// --- 修改结束 ---
// 3. 课时变动记录 (Transaction/Finance Log) - Placeholder/Simulation
const hoursLog = [];
let currentBalance = student.remainingHours;
// Process all courses where attendance was marked 'present' or 'isMadeUp'
// Process all courses where attendance was marked 'present' or 'isMadeUp'
history.forEach(c => {
const att = c.attendance?.[studentId];
const hours = c.hoursDeducted || 2; // 获取扣除课时数
// IMPORTANT: Only process if attendance status is present or absent and not marked as 'isMadeUp'
// For the log, we track events that changed the balance. We assume -2h was deducted on attendance.
if (att && att.status === 'present' && !att.isMadeUp) {
hoursLog.push({
date: c.dateStr,
type: 'Attendance',
description: `上课扣除 (课程: ${c.className})`,
hours: -hours, // 使用 hours
courseId: c.id
});
}
// ... (其他部分不变)
});
// Add a dummy initial purchase/remaining hours (we don't have this data)
if (student.createdAt || student.remainingHours > 0) {
hoursLog.push({
date: student.createdAt ? formatDate(new Date(student.createdAt)).slice(0,10) : '未知',
type: 'Initial',
description: `期初或购课记录`,
hours: student.remainingHours, // Just show the final current balance here.
isInitial: true
});
}
// Sorting by date (newest first)
hoursLog.sort((a, b) => b.date.localeCompare(a.date));
return { history, fuHistory, hoursLog };
}, [student, courses, followUps, studentId, formatDate]);
const handleSave = async () => {
if (!editStudent.name) return addToast("请填写姓名", "error");
const { id, ...data } = editStudent;
data.remainingHours = Number(data.remainingHours || 0);
// StudentDetailPage的更新需要刷新,这里不跳过 fetchAll
let success = await lcUpdate('Student', id, data);
if(success) {
setIsEditOpen(false);
// lcUpdate现在会自动fetchAll
addToast("学员信息已更新", "success");
}
};
const Tabs = {
history: { name: '历史课程', icon: 'Calendar', component: <HistoryTab data={studentData.history} theme={theme} /> },
attendance: { name: '考勤记录', icon: 'UserCheck', component: <AttendanceTab data={studentData.history} studentId={studentId} theme={theme} /> },
followup: { name: '回访历史', icon: 'PhoneCall', component: <FollowUpTab data={studentData.fuHistory} theme={theme} /> },
finance: { name: '课时交易记录', icon: 'Wallet', component: <FinanceTab data={studentData.hoursLog} theme={theme} remainingHours={student.remainingHours} /> },
};
const getWarningColor = (remaining) => {
if (remaining <= 0) return "text-slate-900 bg-slate-100 border-slate-300 dark:text-slate-100 dark:bg-slate-700 dark:border-slate-600";
if (remaining <= 4) return "text-red-600 bg-red-50 border-red-200 dark:bg-red-900/30 dark:border-red-800 dark:text-red-300";
if (remaining <= 8) return "text-yellow-600 bg-yellow-50 border-yellow-200 dark:bg-yellow-900/30 dark:border-yellow-800 dark:text-yellow-300";
return "text-emerald-600 bg-emerald-50 border-emerald-200 dark:bg-emerald-900/30 dark:border-emerald-800 dark:text-emerald-400";
};
return (
<div className="p-4 md:p-8 space-y-6 pb-24 md:pb-8 pt-16 md:pt-8 animate-enter max-w-7xl mx-auto">
{/* Header */}
<div className="flex flex-col md:flex-row justify-between items-start md:items-end gap-4 border-b border-gray-200 dark:border-slate-700 pb-4">
<div className="flex items-center gap-3">
<button onClick={onBack} className={`text-slate-500 hover:text-${theme.primary}-600 dark:text-slate-400 dark:hover:text-white transition-colors p-2 rounded-full hover:bg-gray-100 dark:hover:bg-slate-700`}>
<LucideIcon name="ChevronLeft" size={24}/>
</button>
<div>
<h1 className="text-3xl font-extrabold text-slate-800 dark:text-white tracking-tight flex items-center gap-3">
{student.name} 的详情页
</h1>
<p className="text-slate-500 dark:text-slate-400 mt-1 font-medium text-sm">信息集中化,全面了解学员情况</p>
</div>
</div>
<button
onClick={() => setIsEditOpen(true)}
className={`bg-${theme.primary}-600 text-white px-4 py-2 rounded-xl flex items-center gap-2 text-sm shadow-md hover:bg-${theme.primary}-700 transition-colors`}
>
<LucideIcon name="Edit" size={16} /> 编辑基本信息
</button>
</div>
{/* Basic Info & Stats */}
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
<TiltCard className="glass-panel p-6 rounded-3xl flex flex-col hover-lift">
<div className="flex justify-between items-center mb-4">
<div className="text-xs font-bold text-slate-500 dark:text-slate-400 uppercase">基本信息</div>
<div className={`w-10 h-10 rounded-full bg-${theme.accent}-100 text-${theme.accent}-600 flex items-center justify-center`}><LucideIcon name="Users" size={20}/></div>
</div>
<div className="space-y-2 text-sm dark:text-slate-200">
<p><span className="font-bold">性别:</span> {student.gender}</p>
<p><span className="font-bold">年龄:</span> {student.age || 'N/A'}</p>
<p className="truncate"><span className="font-bold">入册:</span> {student.createdAt ? formatDate(new Date(student.createdAt)).slice(0,10) : '未知'}</p>
</div>
</TiltCard>
<TiltCard className="glass-panel p-6 rounded-3xl flex flex-col justify-center hover-lift">
<div className="text-xs font-bold text-slate-500 dark:text-slate-400 uppercase mb-2">剩余课时</div>
<div className={`text-4xl font-extrabold ${getWarningColor(student.remainingHours || 0)}`}>
{student.remainingHours || 0} <span className="text-lg font-normal">课时</span>
</div>
<div className="text-xs text-slate-400 mt-2">{getPredictionText(student.remainingHours || 0)}</div>
</TiltCard>
<TiltCard className="glass-panel p-6 rounded-3xl flex flex-col justify-center hover-lift">
<div className="text-xs font-bold text-slate-500 dark:text-slate-400 uppercase mb-2">学员备注</div>
<div className="text-sm dark:text-slate-200 flex-1 overflow-hidden">
{student.notes || <span className="text-slate-400 italic">暂无特别备注</span>}
</div>
</TiltCard>
</div>
{/* Tabs Navigation */}
<div className="glass-panel p-1 rounded-2xl flex shadow-inner overflow-x-auto">
{Object.entries(Tabs).map(([key, tab]) => (
<button
key={key}
onClick={() => setActiveTab(key)}
className={`flex items-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all duration-300 shrink-0 ${activeTab === key ? `bg-white dark:bg-slate-700 text-${theme.primary}-600 dark:text-white shadow-md` : 'text-slate-500 dark:text-slate-400 hover:bg-gray-100 dark:hover:bg-slate-800'}`}
>
<LucideIcon name={tab.icon} size={18} /> {tab.name}
</button>
))}
</div>
{/* Tabs Content */}
<div className="glass-panel p-6 rounded-2xl min-h-[400px]">
{Tabs[activeTab].component}
</div>
{/* 学员编辑 Modal (复用 StudentManager 的 Modal 逻辑) */}
<Modal isOpen={isEditOpen} onClose={() => setIsEditOpen(false)} title="编辑学员信息">
<div className="space-y-5">
<div className="grid grid-cols-2 gap-4">
<div>
<label className="block text-xs font-bold text-gray-500 dark:text-slate-400 uppercase mb-1">姓名</label>
<input className="w-full border border-gray-200 dark:border-slate-600 p-3 rounded-xl focus:ring-2 focus:ring-blue-500/20 outline-none transition-all dark:bg-slate-700 dark:text-white" placeholder="输入姓名" value={editStudent.name||''} onChange={e=>setEditStudent({...editStudent, name:e.target.value})} />
</div>
<div>
<label className="block text-xs font-bold text-gray-500 dark:text-slate-400 uppercase mb-1">剩余课时</label>
<input type="number" className="w-full border border-gray-200 dark:border-slate-600 p-3 rounded-xl focus:ring-2 focus:ring-blue-500/20 outline-none transition-all font-mono font-bold dark:bg-slate-700 dark:text-white" value={editStudent.remainingHours||0} onChange={e=>setEditStudent({...editStudent, remainingHours:e.target.value})} />
</div>
</div>
<div className="flex gap-4">
<div className="flex-1">
<label className="block text-xs font-bold text-gray-500 dark:text-slate-400 uppercase mb-1">性别</label>
<select className="w-full border border-gray-200 dark:border-slate-600 p-3 rounded-xl bg-white dark:bg-slate-700 dark:text-white focus:ring-2 focus:ring-blue-500/20 outline-none transition-all" value={editStudent.gender||'男'} onChange={e=>setEditStudent({...editStudent, gender:e.target.value})}>
<option>男</option><option>女</option>
</select>
</div>
<div className="flex-1">
<label className="block text-xs font-bold text-gray-500 dark:text-slate-400 uppercase mb-1">年龄</label>
<input className="w-full border border-gray-200 dark:border-slate-600 p-3 rounded-xl focus:ring-2 focus:ring-blue-500/20 outline-none transition-all dark:bg-slate-700 dark:text-white" type="number" placeholder="0" value={editStudent.age||''} onChange={e=>setEditStudent({...editStudent, age:e.target.value})} />
</div>
</div>
<div>
<label className="block text-xs font-bold text-gray-500 dark:text-slate-400 uppercase mb-1">备注信息</label>
<textarea className="w-full border border-gray-200 dark:border-slate-600 p-3 rounded-xl h-24 text-sm focus:ring-2 focus:ring-blue-500/20 outline-none transition-all resize-none dark:bg-slate-700 dark:text-white" placeholder="输入学员情况..." value={editStudent.notes||''} onChange={e=>setEditStudent({...editStudent, notes:e.target.value})}></textarea>
</div>