-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpublish.html
More file actions
1067 lines (938 loc) · 38.7 KB
/
publish.html
File metadata and controls
1067 lines (938 loc) · 38.7 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
<!--
LowCode Dev Template
Copyright (c) 2025 peterfei
Email: peterfeispace@gmail.com
GitHub: https://github.com/peterfei/lowcode-dev-template
-->
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>应用发布 - 快速开发平台</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.main-layout {
display: flex;
min-height: 100vh;
}
.main-content {
flex: 1;
padding: 24px;
background-color: var(--bg-secondary);
}
.page-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 32px;
}
.page-title {
font-size: 28px;
font-weight: 700;
color: var(--gray-900);
}
.page-actions {
display: flex;
gap: 12px;
}
.publish-steps {
background: white;
border-radius: 16px;
padding: 32px;
box-shadow: var(--shadow-sm);
margin-bottom: 32px;
}
.steps-header {
text-align: center;
margin-bottom: 32px;
}
.steps-title {
font-size: 24px;
font-weight: 600;
color: var(--gray-900);
margin-bottom: 8px;
}
.steps-subtitle {
color: var(--gray-600);
font-size: 16px;
}
.steps-indicator {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 40px;
}
.step {
display: flex;
align-items: center;
position: relative;
}
.step:not(:last-child)::after {
content: '';
width: 100px;
height: 2px;
background: var(--border-light);
margin: 0 20px;
}
.step.completed::after {
background: var(--success-500);
}
.step.active::after {
background: linear-gradient(to right, var(--primary-500) 50%, var(--border-light) 50%);
}
.step-circle {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: 14px;
position: relative;
z-index: 1;
}
.step-circle.default {
background: var(--gray-100);
color: var(--gray-500);
border: 2px solid var(--border-light);
}
.step-circle.active {
background: var(--primary-500);
color: white;
border: 2px solid var(--primary-500);
}
.step-circle.completed {
background: var(--success-500);
color: white;
border: 2px solid var(--success-500);
}
.step-label {
position: absolute;
top: 50px;
left: 50%;
transform: translateX(-50%);
font-size: 12px;
color: var(--gray-600);
white-space: nowrap;
}
.step.active .step-label {
color: var(--primary-500);
font-weight: 500;
}
.step.completed .step-label {
color: var(--success-600);
}
.step-content {
display: none;
}
.step-content.active {
display: block;
}
.step-form {
max-width: 600px;
margin: 0 auto;
}
.form-group {
margin-bottom: 24px;
}
.form-label {
display: block;
font-weight: 500;
color: var(--gray-700);
margin-bottom: 8px;
font-size: 14px;
}
.form-label.required::after {
content: ' *';
color: var(--error-500);
}
.form-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
}
.form-help {
font-size: 12px;
color: var(--gray-500);
margin-top: 4px;
}
.environment-cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 16px;
margin-bottom: 24px;
}
.environment-card {
border: 2px solid var(--border-light);
border-radius: 12px;
padding: 20px;
text-align: center;
cursor: pointer;
transition: all 0.2s ease;
}
.environment-card:hover {
border-color: var(--primary-300);
box-shadow: var(--shadow-sm);
}
.environment-card.selected {
border-color: var(--primary-500);
background: var(--primary-50);
}
.environment-icon {
width: 48px;
height: 48px;
background: var(--primary-100);
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 12px;
color: var(--primary-500);
font-size: 20px;
}
.environment-name {
font-weight: 600;
color: var(--gray-900);
margin-bottom: 4px;
}
.environment-desc {
font-size: 12px;
color: var(--gray-500);
}
.build-log {
background: var(--gray-900);
color: var(--gray-100);
border-radius: 8px;
padding: 16px;
font-family: var(--font-family-mono);
font-size: 12px;
line-height: 1.5;
max-height: 300px;
overflow-y: auto;
margin-bottom: 16px;
}
.log-line {
margin-bottom: 4px;
}
.log-line.success {
color: var(--success-400);
}
.log-line.error {
color: var(--error-400);
}
.log-line.warning {
color: var(--warning-400);
}
.log-line.info {
color: var(--info-400);
}
.progress-bar {
width: 100%;
height: 8px;
background: var(--gray-200);
border-radius: 4px;
overflow: hidden;
margin-bottom: 16px;
}
.progress-fill {
height: 100%;
background: var(--primary-500);
border-radius: 4px;
transition: width 0.3s ease;
}
.progress-text {
text-align: center;
font-size: 14px;
color: var(--gray-600);
margin-bottom: 16px;
}
.deployment-status {
display: flex;
align-items: center;
justify-content: center;
gap: 12px;
padding: 20px;
border-radius: 12px;
margin-bottom: 24px;
}
.deployment-status.success {
background: var(--success-50);
color: var(--success-600);
border: 1px solid var(--success-200);
}
.deployment-status.error {
background: var(--error-50);
color: var(--error-600);
border: 1px solid var(--error-200);
}
.deployment-status.processing {
background: var(--info-50);
color: var(--info-600);
border: 1px solid var(--info-200);
}
.deployment-icon {
font-size: 24px;
}
.deployment-message {
font-weight: 500;
}
.deployment-actions {
display: flex;
gap: 12px;
justify-content: center;
}
.deployment-url {
background: white;
border: 1px solid var(--border-light);
border-radius: 8px;
padding: 16px;
margin-bottom: 24px;
}
.url-label {
font-size: 12px;
color: var(--gray-500);
margin-bottom: 8px;
}
.url-value {
font-family: var(--font-family-mono);
font-size: 14px;
color: var(--gray-900);
word-break: break-all;
}
.url-copy {
margin-top: 8px;
}
.publish-history {
background: white;
border-radius: 16px;
padding: 24px;
box-shadow: var(--shadow-sm);
}
.history-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20px;
}
.history-title {
font-size: 18px;
font-weight: 600;
color: var(--gray-900);
}
.history-item {
display: flex;
align-items: center;
padding: 16px 0;
border-bottom: 1px solid var(--border-light);
}
.history-item:last-child {
border-bottom: none;
}
.history-icon {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 16px;
font-size: 16px;
}
.history-icon.success {
background: var(--success-100);
color: var(--success-600);
}
.history-icon.error {
background: var(--error-100);
color: var(--error-600);
}
.history-icon.processing {
background: var(--info-100);
color: var(--info-600);
}
.history-content {
flex: 1;
}
.history-title-text {
font-weight: 500;
color: var(--gray-900);
margin-bottom: 4px;
}
.history-meta {
font-size: 12px;
color: var(--gray-500);
}
.history-actions {
display: flex;
gap: 8px;
}
.history-action {
padding: 6px 12px;
border: 1px solid var(--border-medium);
border-radius: var(--radius-md);
background: white;
color: var(--gray-600);
font-size: 12px;
cursor: pointer;
transition: all 0.2s ease;
}
.history-action:hover {
background: var(--gray-50);
border-color: var(--gray-300);
}
.history-action.primary {
background: var(--primary-500);
color: white;
border-color: var(--primary-500);
}
.history-action.primary:hover {
background: var(--primary-600);
}
@media (max-width: 768px) {
.steps-indicator {
flex-direction: column;
gap: 20px;
}
.step:not(:last-child)::after {
display: none;
}
.form-row {
grid-template-columns: 1fr;
}
.environment-cards {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="main-layout">
<!-- 侧边栏 -->
<aside class="sidebar">
<!-- 品牌标识区域 -->
<div class="sidebar-brand">
<div class="brand-logo">
<i class="fas fa-rocket"></i>
</div>
<div class="brand-title">
快速开发平台
</div>
</div>
<div class="sidebar-nav">
<div class="sidebar-group">
<div class="sidebar-group-title">主要功能</div>
<a href="dashboard.html" class="sidebar-item">
<i class="fas fa-home"></i>
仪表板
</a>
<a href="projects.html" class="sidebar-item">
<i class="fas fa-folder"></i>
我的项目
</a>
<a href="designer.html" class="sidebar-item">
<i class="fas fa-paint-brush"></i>
设计器
</a>
</div>
<div class="sidebar-group">
<div class="sidebar-group-title">数据管理</div>
<a href="data-sources.html" class="sidebar-item">
<i class="fas fa-database"></i>
数据源
</a>
<a href="data-models.html" class="sidebar-item">
<i class="fas fa-sitemap"></i>
数据模型
</a>
<a href="api-management.html" class="sidebar-item">
<i class="fas fa-code"></i>
API管理
</a>
</div>
<div class="sidebar-group">
<div class="sidebar-group-title">发布管理</div>
<a href="publish.html" class="sidebar-item active">
<i class="fas fa-rocket"></i>
应用发布
</a>
<a href="versions.html" class="sidebar-item">
<i class="fas fa-tags"></i>
版本管理
</a>
</div>
<div class="sidebar-group">
<div class="sidebar-group-title">设置</div>
<a href="settings.html" class="sidebar-item">
<i class="fas fa-cog"></i>
系统设置
</a>
</div>
</div>
</aside>
<!-- 主内容区域 -->
<main class="main-content">
<!-- 顶部导航 -->
<nav class="navbar">
<div class="navbar-left">
<!-- 面包屑导航 -->
<nav class="breadcrumb">
<ol class="breadcrumb-list">
<li class="breadcrumb-item">
<a href="dashboard.html" class="breadcrumb-link">
<i class="fas fa-home"></i>
首页
</a>
</li>
<li class="breadcrumb-separator">
<i class="fas fa-chevron-right"></i>
</li>
<li class="breadcrumb-item active">
应用发布
</li>
</ol>
</nav>
</div>
<div class="navbar-right">
<a href="#" class="navbar-item">
<i class="fas fa-bell"></i>
</a>
<a href="#" class="navbar-item">
<i class="fas fa-question-circle"></i>
</a>
<div class="navbar-item">
<img src="./images/username.png" alt="用户头像" style="width: 32px; height: 32px; border-radius: 50%;">
</div>
</div>
</nav>
<!-- 页面头部 -->
<div class="page-header">
<h1 class="page-title">应用发布</h1>
<div class="page-actions">
<button class="btn btn-outline">
<i class="fas fa-history"></i>
发布历史
</button>
<button class="btn btn-primary" onclick="startPublish()">
<i class="fas fa-rocket"></i>
开始发布
</button>
</div>
</div>
<!-- 发布步骤 -->
<div class="publish-steps">
<div class="steps-header">
<h2 class="steps-title">发布向导</h2>
<p class="steps-subtitle">按照以下步骤完成应用发布</p>
</div>
<div class="steps-indicator">
<div class="step completed">
<div class="step-circle completed">
<i class="fas fa-check"></i>
</div>
<div class="step-label">配置</div>
</div>
<div class="step active">
<div class="step-circle active">2</div>
<div class="step-label">构建</div>
</div>
<div class="step">
<div class="step-circle default">3</div>
<div class="step-label">部署</div>
</div>
<div class="step">
<div class="step-circle default">4</div>
<div class="step-label">完成</div>
</div>
</div>
<!-- 步骤1:配置 -->
<div class="step-content" id="step1">
<div class="step-form">
<div class="form-group">
<label class="form-label required" for="appName">应用名称</label>
<input type="text" id="appName" class="input" value="电商管理系统" placeholder="输入应用名称" required>
</div>
<div class="form-group">
<label class="form-label" for="appDescription">应用描述</label>
<textarea id="appDescription" class="input" rows="3" placeholder="输入应用描述">一个完整的电商平台管理系统,包含商品管理、订单处理、用户管理等功能模块。</textarea>
</div>
<div class="form-group">
<label class="form-label required">部署环境</label>
<div class="environment-cards">
<div class="environment-card selected" onclick="selectEnvironment(this, 'development')">
<div class="environment-icon">
<i class="fas fa-code"></i>
</div>
<div class="environment-name">开发环境</div>
<div class="environment-desc">用于开发和测试</div>
</div>
<div class="environment-card" onclick="selectEnvironment(this, 'staging')">
<div class="environment-icon">
<i class="fas fa-flask"></i>
</div>
<div class="environment-name">预发布环境</div>
<div class="environment-desc">用于预发布测试</div>
</div>
<div class="environment-card" onclick="selectEnvironment(this, 'production')">
<div class="environment-icon">
<i class="fas fa-globe"></i>
</div>
<div class="environment-name">生产环境</div>
<div class="environment-desc">正式运行环境</div>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label class="form-label required" for="domain">域名</label>
<input type="text" id="domain" class="input" value="ecommerce.example.com" placeholder="输入域名" required>
<div class="form-help">应用访问的域名地址</div>
</div>
<div class="form-group">
<label class="form-label" for="port">端口</label>
<input type="number" id="port" class="input" value="3000" placeholder="输入端口号">
<div class="form-help">应用运行的端口号</div>
</div>
</div>
<div class="form-group">
<label class="form-label" for="buildCommand">构建命令</label>
<input type="text" id="buildCommand" class="input" value="npm run build" placeholder="输入构建命令">
<div class="form-help">用于构建应用的命令</div>
</div>
</div>
</div>
<!-- 步骤2:构建 -->
<div class="step-content active" id="step2">
<div class="step-form">
<div class="deployment-status processing">
<div class="deployment-icon">
<i class="fas fa-cog fa-spin"></i>
</div>
<div class="deployment-message">正在构建应用...</div>
</div>
<div class="progress-bar">
<div class="progress-fill" id="buildProgress" style="width: 65%"></div>
</div>
<div class="progress-text" id="buildProgressText">构建进度:65%</div>
<div class="build-log" id="buildLog">
<div class="log-line info">[INFO] 开始构建应用...</div>
<div class="log-line info">[INFO] 检查依赖项...</div>
<div class="log-line success">[SUCCESS] 依赖项检查完成</div>
<div class="log-line info">[INFO] 编译源代码...</div>
<div class="log-line success">[SUCCESS] 源代码编译完成</div>
<div class="log-line info">[INFO] 优化资源文件...</div>
<div class="log-line warning">[WARNING] 发现未使用的CSS规则</div>
<div class="log-line info">[INFO] 生成静态资源...</div>
<div class="log-line success">[SUCCESS] 静态资源生成完成</div>
<div class="log-line info">[INFO] 压缩文件...</div>
<div class="log-line success">[SUCCESS] 文件压缩完成</div>
<div class="log-line info">[INFO] 创建部署包...</div>
</div>
</div>
</div>
<!-- 步骤3:部署 -->
<div class="step-content" id="step3">
<div class="step-form">
<div class="deployment-status processing">
<div class="deployment-icon">
<i class="fas fa-upload"></i>
</div>
<div class="deployment-message">正在部署到服务器...</div>
</div>
<div class="progress-bar">
<div class="progress-fill" style="width: 0%"></div>
</div>
<div class="progress-text">部署进度:0%</div>
<div class="build-log">
<div class="log-line info">[INFO] 准备部署包...</div>
<div class="log-line info">[INFO] 连接服务器...</div>
<div class="log-line info">[INFO] 上传文件...</div>
<div class="log-line info">[INFO] 配置服务器...</div>
<div class="log-line info">[INFO] 启动应用...</div>
<div class="log-line info">[INFO] 健康检查...</div>
</div>
</div>
</div>
<!-- 步骤4:完成 -->
<div class="step-content" id="step4">
<div class="step-form">
<div class="deployment-status success">
<div class="deployment-icon">
<i class="fas fa-check-circle"></i>
</div>
<div class="deployment-message">应用发布成功!</div>
</div>
<div class="deployment-url">
<div class="url-label">应用访问地址</div>
<div class="url-value">https://ecommerce.example.com</div>
<div class="url-copy">
<button class="btn btn-outline btn-sm" onclick="copyUrl()">
<i class="fas fa-copy"></i>
复制链接
</button>
</div>
</div>
<div class="deployment-actions">
<button class="btn btn-primary">
<i class="fas fa-external-link-alt"></i>
访问应用
</button>
<button class="btn btn-outline">
<i class="fas fa-chart-line"></i>
查看监控
</button>
<button class="btn btn-outline">
<i class="fas fa-download"></i>
下载日志
</button>
</div>
</div>
</div>
</div>
<!-- 发布历史 -->
<div class="publish-history">
<div class="history-header">
<h3 class="history-title">发布历史</h3>
<button class="btn btn-outline btn-sm">
<i class="fas fa-refresh"></i>
刷新
</button>
</div>
<div class="history-item">
<div class="history-icon success">
<i class="fas fa-check"></i>
</div>
<div class="history-content">
<div class="history-title-text">v1.2.0 发布成功</div>
<div class="history-meta">
2024-10-22 14:30:25 • 生产环境 • 构建时间:2分15秒
</div>
</div>
<div class="history-actions">
<button class="history-action primary">查看</button>
<button class="history-action">回滚</button>
</div>
</div>
<div class="history-item">
<div class="history-icon success">
<i class="fas fa-check"></i>
</div>
<div class="history-content">
<div class="history-title-text">v1.1.9 发布成功</div>
<div class="history-meta">
2024-10-20 09:15:42 • 生产环境 • 构建时间:1分58秒
</div>
</div>
<div class="history-actions">
<button class="history-action primary">查看</button>
<button class="history-action">回滚</button>
</div>
</div>
<div class="history-item">
<div class="history-icon error">
<i class="fas fa-times"></i>
</div>
<div class="history-content">
<div class="history-title-text">v1.1.8 发布失败</div>
<div class="history-meta">
2024-10-18 16:45:12 • 生产环境 • 构建时间:3分22秒
</div>
</div>
<div class="history-actions">
<button class="history-action primary">查看</button>
<button class="history-action">重试</button>
</div>
</div>
<div class="history-item">
<div class="history-icon success">
<i class="fas fa-check"></i>
</div>
<div class="history-content">
<div class="history-title-text">v1.1.7 发布成功</div>
<div class="history-meta">
2024-10-15 11:20:33 • 生产环境 • 构建时间:2分05秒
</div>
</div>
<div class="history-actions">
<button class="history-action primary">查看</button>
<button class="history-action">回滚</button>
</div>
</div>
</div>
</main>
</div>
<script>
let currentStep = 2;
let selectedEnvironment = 'development';
// 选择部署环境
function selectEnvironment(card, environment) {
document.querySelectorAll('.environment-card').forEach(c => {
c.classList.remove('selected');
});
card.classList.add('selected');
selectedEnvironment = environment;
}
// 开始发布
function startPublish() {
currentStep = 1;
updateStepDisplay();
simulatePublishProcess();
}
// 更新步骤显示
function updateStepDisplay() {
// 更新步骤指示器
document.querySelectorAll('.step').forEach((step, index) => {
step.classList.remove('completed', 'active');
if (index < currentStep - 1) {
step.classList.add('completed');
} else if (index === currentStep - 1) {
step.classList.add('active');
}
});
// 更新步骤内容
document.querySelectorAll('.step-content').forEach((content, index) => {
content.classList.remove('active');
if (index === currentStep - 1) {
content.classList.add('active');
}
});
}
// 模拟发布过程
function simulatePublishProcess() {
// 步骤1:配置(已完成)
setTimeout(() => {
currentStep = 2;
updateStepDisplay();
simulateBuildProcess();
}, 1000);
}
// 模拟构建过程
function simulateBuildProcess() {
const buildProgress = document.getElementById('buildProgress');
const buildProgressText = document.getElementById('buildProgressText');
const buildLog = document.getElementById('buildLog');
let progress = 0;
const buildInterval = setInterval(() => {
progress += Math.random() * 10;
if (progress > 100) progress = 100;
buildProgress.style.width = progress + '%';
buildProgressText.textContent = '构建进度:' + Math.round(progress) + '%';
// 添加日志
if (Math.random() > 0.7) {
const logLines = [
'[INFO] 处理资源文件...',
'[SUCCESS] 资源文件处理完成',
'[INFO] 生成映射文件...',
'[WARNING] 发现重复的CSS选择器',
'[INFO] 优化图片资源...',
'[SUCCESS] 图片优化完成',
'[INFO] 生成服务工作者...',
'[SUCCESS] 服务工作者生成完成'
];
const randomLine = logLines[Math.floor(Math.random() * logLines.length)];
const logLine = document.createElement('div');
logLine.className = 'log-line';
if (randomLine.includes('[SUCCESS]')) {
logLine.classList.add('success');
} else if (randomLine.includes('[WARNING]')) {
logLine.classList.add('warning');
} else {
logLine.classList.add('info');
}
logLine.textContent = randomLine;
buildLog.appendChild(logLine);
buildLog.scrollTop = buildLog.scrollHeight;
}
if (progress >= 100) {
clearInterval(buildInterval);
setTimeout(() => {
currentStep = 3;
updateStepDisplay();
simulateDeployProcess();
}, 1000);
}
}, 500);
}
// 模拟部署过程
function simulateDeployProcess() {
const deployProgress = document.querySelector('#step3 .progress-fill');
const deployProgressText = document.querySelector('#step3 .progress-text');
const deployLog = document.querySelector('#step3 .build-log');
let progress = 0;
const deployInterval = setInterval(() => {
progress += Math.random() * 15;
if (progress > 100) progress = 100;
deployProgress.style.width = progress + '%';
deployProgressText.textContent = '部署进度:' + Math.round(progress) + '%';
// 添加日志
if (Math.random() > 0.6) {
const logLines = [
'[INFO] 上传文件到服务器...',
'[SUCCESS] 文件上传完成',
'[INFO] 配置Nginx...',
'[SUCCESS] Nginx配置完成',
'[INFO] 重启服务...',
'[SUCCESS] 服务重启完成',
'[INFO] 运行健康检查...',
'[SUCCESS] 健康检查通过'