Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
3201 lines (2960 loc) · 142 KB
/
Copy pathindex.html
File metadata and controls
3201 lines (2960 loc) · 142 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">
<title>通用接口调试工具V3.2</title>
<link rel="stylesheet" href="src/css/bootstrap.min.css">
<style>
/* 全局样式 */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
body {
display: flex;
flex-direction: column;
}
/* 导航栏样式 */
.navbar {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1000;
margin-bottom: 0;
}
/* 容器样式 */
.container {
flex: 1;
overflow-y: auto;
padding-top: 80px; /* 为固定的导航栏留出空间 */
padding-bottom: 40px; /* 为固定的页脚留出空间 */
}
/* 页签高亮 */
.nav-item .nav-link.active {
font-weight: bold;
color: #fff !important;
background-color: rgba(255, 255, 255, 0.1);
border-radius: 4px;
}
/* 页脚样式 */
footer {
background-color: #343a40;
color: #fff;
padding: 0.35rem 0;
text-align: center;
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 999;
font-size: 0.75rem;
}
/* 页脚容器样式 */
footer .container {
padding: 0;
margin: 0 auto;
}
/* 页脚文本样式 */
footer p {
margin: 0;
line-height: 1.3;
}
/* 容器样式 */
.container {
flex: 1;
overflow-y: auto;
padding-top: 80px; /* 为固定的导航栏留出空间 */
padding-bottom: 40px; /* 为固定的页脚留出空间 */
margin-top: 0;
}
.section {
display: none;
margin-bottom: 20px;
}
.section.active {
display: block;
}
.parameter-form {
margin: 5px 0;
padding: 5px;
border: 1px solid #dee2e6;
border-radius: 5px;
background-color: #f8f9fa;
}
.parameter-form .form-row {
margin-bottom: 0;
align-items: center;
}
.parameter-form .form-control {
height: 32px;
font-size: 0.85rem;
padding: 4px 8px;
}
.parameter-form select.form-control {
height: 32px;
}
.parameter-form .btn-danger {
height: 32px;
padding: 0 6px;
font-size: 0.7rem;
min-width: 36px;
}
.response-area {
background-color: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 5px;
padding: 10px;
min-height: 200px;
font-family: 'Courier New', monospace;
}
#request-body {
min-height: 200px;
font-size: 0.85rem;
line-height: 1.2;
}
#add-request-body-parameter {
margin-top: 8px;
font-size: 0.85rem;
padding: 4px 12px;
}
.history-item {
padding: 10px;
border: 1px solid #dee2e6;
border-radius: 5px;
margin-bottom: 10px;
background-color: #f8f9fa;
}
.history-item .time {
font-size: 0.8rem;
color: #6c757d;
}
.history-item .interface-name {
margin: 5px 0;
font-size: 0.9rem;
}
.history-item .url {
font-weight: bold;
margin: 5px 0;
}
.history-item .headers,
.history-item .request-body {
margin: 5px 0;
font-size: 0.85rem;
white-space: pre-wrap;
font-family: 'Courier New', monospace;
background-color: #f1f3f4;
padding: 5px;
border-radius: 3px;
}
.history-item .response {
font-size: 0.9rem;
margin-top: 5px;
white-space: pre-wrap;
font-family: 'Courier New', monospace;
}
/* 请求体textarea自动调整高度 */
#request-body, #interface-request-body {
min-height: 54px;
height: auto;
overflow: hidden;
}
/* 接口卡片样式 */
.interface-card {
border: 1px solid #dee2e6;
border-radius: 0.25rem;
transition: all 0.2s ease;
}
.interface-card:hover {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
border-color: #007bff;
}
.interface-card .card-body {
padding: 1rem;
}
.interface-card .form-check-label {
font-weight: 500;
}
/* 响应式调整 */
@media (max-width: 768px) {
#interface-list .col-md-4 {
flex: 0 0 100%;
max-width: 100%;
}
}
</style>
</head>
<body>
<div class="container">
<!-- 导航栏 -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark mb-4">
<a class="navbar-brand" href="#">通用接口调试工具V3.2</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#interface-test">接口测试</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#interface-management">接口管理</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#history">历史记录</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#settings">设置</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#readme">README</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#manual">操作手册</a>
</li>
</ul>
</div>
</nav>
<!-- 接口测试 -->
<section id="interface-test" class="section">
<div class="card">
<div class="card-header">
接口测试
</div>
<div class="card-body">
<div class="form-row mb-3">
<div class="col-md-5">
<label for="interface-select">选择接口</label>
<select class="form-control" id="interface-select">
<option value="">选择接口</option>
</select>
</div>
<div class="col-md-2">
<label for="request-method">请求方法</label>
<select class="form-control" id="request-method">
<option value="GET">GET</option>
<option value="POST">POST</option>
<option value="PUT">PUT</option>
<option value="DELETE">DELETE</option>
</select>
</div>
<div class="col-md-5">
<label for="request-url">请求 URL</label>
<input type="text" class="form-control" id="request-url" placeholder="输入请求 URL">
</div>
</div>
<div class="form-group">
<label>请求参数</label>
<div id="parameter-container">
<!-- 参数表单将动态生成 -->
</div>
</div>
<div class="row">
<div class="col-md-7">
<div class="form-group">
<label>请求体参数列表</label>
<div id="request-body-parameters">
<!-- 请求体参数列表将动态生成 -->
</div>
<button class="btn btn-sm btn-secondary mt-2" id="add-request-body-parameter">添加参数</button>
</div>
</div>
<div class="col-md-5">
<div class="form-group">
<label for="request-body">请求体 (JSON)</label>
<textarea class="form-control" id="request-body" rows="2" placeholder="输入请求体 JSON"></textarea>
</div>
</div>
</div>
<div class="form-group">
<label>请求头</label>
<div id="header-container">
<!-- 请求头表单将动态生成 -->
</div>
<button class="btn btn-sm btn-secondary mt-2" id="add-header">添加请求头</button>
</div>
<button class="btn btn-primary" id="send-request">发送请求</button>
<div class="mt-4">
<label for="response-status">响应状态</label>
<input type="text" class="form-control" id="response-status" placeholder="响应状态将显示在这里" readonly>
</div>
<div class="mt-3">
<label for="response-time">响应时间</label>
<input type="text" class="form-control" id="response-time" placeholder="响应时间将显示在这里" readonly>
</div>
<div class="mt-3">
<label>响应结果</label>
<div id="response-body" class="response-area"></div>
</div>
</div>
</div>
</section>
<!-- 接口管理 -->
<section id="interface-management" class="section">
<div class="card">
<div class="card-header">
接口管理
</div>
<div class="card-body">
<div class="form-row mb-3">
<div class="col-md-4">
<label for="interface-name">接口名称</label>
<input type="text" class="form-control" id="interface-name" placeholder="输入接口名称">
</div>
<div class="col-md-4">
<label for="interface-url">接口 URL</label>
<input type="text" class="form-control" id="interface-url" placeholder="输入接口 URL">
</div>
<div class="col-md-4">
<label for="interface-method">请求方法</label>
<select class="form-control" id="interface-method">
<option value="GET">GET</option>
<option value="POST">POST</option>
<option value="PUT">PUT</option>
<option value="DELETE">DELETE</option>
</select>
</div>
</div>
<div class="form-group">
<label>接口参数</label>
<div class="form-row">
<div class="col-md-6">
<div id="interface-parameter-container">
<!-- 接口参数表单将动态生成 -->
</div>
<button class="btn btn-sm btn-secondary mt-2" id="add-interface-parameter">添加参数</button>
</div>
<div class="col-md-6">
<textarea class="form-control" id="interface-request-body" rows="2" placeholder="请求体JSON"></textarea>
</div>
</div>
</div>
<div class="form-group">
<label>接口请求头</label>
<div id="interface-header-container">
<!-- 接口请求头表单将动态生成 -->
</div>
<button class="btn btn-sm btn-secondary mt-2" id="add-interface-header">添加请求头</button>
</div>
<button class="btn btn-primary" id="save-interface">保存接口</button>
<button class="btn btn-danger" id="delete-interface">删除接口</button>
<button class="btn btn-secondary" id="export-interfaces">导出接口</button>
<input type="file" id="import-interfaces" accept=".json" style="display: none;">
<button class="btn btn-secondary" id="import-interfaces-btn">导入接口</button>
<div class="mt-4">
<h5>接口列表</h5>
<div class="row" id="interface-list">
<!-- 接口列表将动态生成 -->
</div>
</div>
</div>
</div>
</section>
<!-- 历史记录 -->
<section id="history" class="section">
<div class="card">
<div class="card-header">
历史记录
</div>
<div class="card-body">
<button class="btn btn-danger mb-3" id="clear-history">清空历史记录</button>
<div id="history-container">
<!-- 历史记录将动态生成 -->
</div>
</div>
</div>
</section>
<!-- 设置 -->
<section id="settings" class="section">
<div class="card">
<div class="card-header">
设置
</div>
<div class="card-body">
<div class="form-row">
<div class="col-md-3">
<label for="protocol">协议</label>
<select class="form-control" id="protocol">
<option value="http">HTTP</option>
<option value="https">HTTPS</option>
</select>
</div>
<div class="col-md-9">
<label for="base-url">基础 URL</label>
<input type="text" class="form-control" id="base-url" placeholder="输入基础 URL(例如:10.210.105.53:9000)">
</div>
</div>
<div class="form-group">
<label for="timeout">请求超时 (ms)</label>
<input type="number" class="form-control" id="timeout" value="10000" min="1000" max="60000">
</div>
<div class="form-group">
<label for="max-history">最大历史记录数</label>
<input type="number" class="form-control" id="max-history" value="50" min="10" max="100">
</div>
<button class="btn btn-primary" id="save-settings">保存设置</button>
</div>
</div>
</section>
<!-- README -->
<section id="readme" class="section">
<div class="card">
<div class="card-header">
系统简介
</div>
<div class="card-body">
<div class="markdown-content">
<h1>通用接口调试工具V3.2 - README</h1>
<h2>系统简介</h2>
<p>通用接口调试工具是一个功能强大的HTTP接口测试工具,支持多种请求方法,提供直观的用户界面,方便开发人员和测试人员快速测试和调试API接口。</p>
<h2>主要功能</h2>
<h3>1. 接口测试</h3>
<ul>
<li>支持GET、POST、PUT、DELETE等多种HTTP请求方法</li>
<li>可添加请求参数、请求体参数和请求头</li>
<li>支持JSON格式的请求体编辑</li>
<li>实时显示响应状态、响应时间和响应结果</li>
<li>请求体参数与JSON区域双向联动</li>
</ul>
<h3>2. 接口管理</h3>
<ul>
<li>添加、编辑、删除接口</li>
<li>导出接口配置为JSON格式</li>
<li>导入接口配置</li>
<li>三列布局的接口列表,支持多选操作</li>
</ul>
<h3>3. 历史记录</h3>
<ul>
<li>自动保存请求历史</li>
<li>查看历史请求详情</li>
<li>清空历史记录</li>
</ul>
<h3>4. 系统设置</h3>
<ul>
<li>设置协议(HTTP/HTTPS)</li>
<li>设置基础URL</li>
<li>设置请求超时时间</li>
<li>设置最大历史记录数</li>
</ul>
<h3>5. 其他特性</h3>
<ul>
<li>固定的页头和页脚,提供更好的用户体验</li>
<li>响应式设计,适配不同屏幕尺寸</li>
<li>请求头参数X-lr-request-id自动使用当前时间</li>
<li>JSON类型参数支持子列表编辑</li>
<li>参数组管理功能,支持数组类型JSON的编辑</li>
</ul>
<h2>技术栈</h2>
<ul>
<li>HTML5</li>
<li>CSS3</li>
<li>JavaScript</li>
<li>jQuery</li>
<li>Bootstrap 4</li>
</ul>
<h2>系统要求</h2>
<ul>
<li>现代Web浏览器(Chrome、Firefox、Edge等)</li>
<li>互联网连接(用于加载Bootstrap等依赖)</li>
</ul>
<h2>使用说明</h2>
<ol>
<li>打开系统页面 `index.html`</li>
<li>在"接口测试"页面选择或输入接口信息</li>
<li>添加必要的参数和请求头</li>
<li>点击"发送请求"按钮测试接口</li>
<li>在"接口管理"页面管理您的接口配置</li>
<li>在"历史记录"页面查看过往请求</li>
<li>在"设置"页面配置系统参数</li>
<li>在"操作手册"页面查看详细使用指南</li>
</ol>
<h2>版本信息</h2>
<ul>
<li>版本:V3.2</li>
<li>作者:KTT</li>
<li>日期:2026-04-18</li>
</ul>
</div>
</div>
</div>
</section>
<!-- 操作手册 -->
<section id="manual" class="section active">
<div class="card">
<div class="card-header">
操作手册
</div>
<div class="card-body">
<div class="markdown-content">
<h1>通用接口调试工具V3.2 - 操作手册</h1>
<h2>1. 系统概览</h2>
<p>通用接口调试工具是一个专业的HTTP接口测试工具,提供了直观的用户界面和丰富的功能,帮助开发人员和测试人员快速测试和调试API接口。</p>
<h3>1.1 系统布局</h3>
<ul>
<li><strong>页头</strong>:包含系统名称和导航菜单</li>
<li><strong>内容区域</strong>:根据选择的导航页签显示不同的功能模块</li>
<li><strong>页脚</strong>:显示版权信息</li>
</ul>
<h3>1.2 导航菜单</h3>
<ul>
<li><strong>接口测试</strong>:用于测试HTTP接口</li>
<li><strong>接口管理</strong>:用于管理接口配置</li>
<li><strong>历史记录</strong>:查看过往请求历史</li>
<li><strong>设置</strong>:配置系统参数</li>
<li><strong>README</strong>:查看系统简介</li>
<li><strong>操作手册</strong>:查看详细使用指南</li>
</ul>
<h2>2. 接口测试</h2>
<h3>2.1 基本操作</h3>
<ol>
<li><strong>选择接口</strong>:从下拉菜单中选择已保存的接口,或直接输入接口信息</li>
<li><strong>设置请求方法</strong>:从下拉菜单中选择GET、POST、PUT或DELETE</li>
<li><strong>输入请求URL</strong>:输入完整的接口URL</li>
<li><strong>添加请求参数</strong>:点击"添加参数"按钮添加URL参数</li>
<li><strong>添加请求体参数</strong>:点击"添加参数"按钮添加请求体参数</li>
<li><strong>编辑请求体JSON</strong>:在右侧文本框中直接编辑JSON格式的请求体</li>
<li><strong>添加请求头</strong>:点击"添加请求头"按钮添加请求头</li>
<li><strong>发送请求</strong>:点击"发送请求"按钮发送HTTP请求</li>
<li><strong>查看响应</strong>:在下方查看响应状态、响应时间和响应结果</li>
</ol>
<h3>2.2 高级功能</h3>
<h4>2.2.1 JSON类型参数编辑</h4>
<ol>
<li>在请求体参数列表中,添加一个参数并将类型设置为"JSON"</li>
<li>点击"编辑"按钮打开JSON编辑器</li>
<li>在JSON编辑器中,选择JSON类型(对象或数组)</li>
<li>添加或编辑子参数</li>
<li>如果选择了数组类型,可以添加多个参数组</li>
<li>点击"保存"按钮保存JSON参数</li>
</ol>
<h4>2.2.2 请求体与参数列表联动</h4>
<ul>
<li>修改请求体参数列表中的参数,右侧JSON文本框会自动更新</li>
<li>修改右侧JSON文本框中的内容,左侧参数列表会自动更新</li>
</ul>
<h2>3. 接口管理</h2>
<h3>3.1 接口操作</h3>
<ol>
<li><strong>添加接口</strong>:
<ul>
<li>输入接口名称、URL和请求方法</li>
<li>添加参数和请求头</li>
<li>编辑请求体JSON</li>
<li>点击"保存接口"按钮保存</li>
</ul>
</li>
<li><strong>编辑接口</strong>:
<ul>
<li>在接口列表中点击接口卡片</li>
<li>修改接口信息</li>
<li>点击"保存接口"按钮更新</li>
</ul>
</li>
<li><strong>删除接口</strong>:
<ul>
<li>在接口列表中点击接口卡片</li>
<li>点击"删除接口"按钮</li>
</ul>
</li>
</ol>
<h3>3.2 批量操作</h3>
<ol>
<li><strong>多选接口</strong>:
<ul>
<li>在接口列表中勾选多个接口的复选框</li>
</ul>
</li>
<li><strong>导出接口</strong>:
<ul>
<li>勾选要导出的接口</li>
<li>点击"导出接口"按钮</li>
<li>保存生成的JSON文件</li>
</ul>
</li>
<li><strong>导入接口</strong>:
<ul>
<li>点击"导入接口"按钮</li>
<li>选择要导入的JSON文件</li>
<li>系统会自动添加导入的接口</li>
</ul>
</li>
</ol>
<h2>4. 历史记录</h2>
<h3>4.1 查看历史</h3>
<ul>
<li>在"历史记录"页面查看所有过往请求</li>
<li>每条记录包含接口名称、请求方法、URL、请求头、请求体和响应信息</li>
</ul>
<h3>4.2 清空历史</h3>
<ul>
<li>点击"清空历史记录"按钮清除所有历史记录</li>
</ul>
<h2>5. 系统设置</h2>
<h3>5.1 基本设置</h3>
<ol>
<li><strong>协议</strong>:选择HTTP或HTTPS</li>
<li><strong>基础URL</strong>:输入API服务的基础URL,例如:`10.210.105.53:9000`</li>
<li><strong>请求超时</strong>:设置请求超时时间(毫秒)</li>
<li><strong>最大历史记录数</strong>:设置系统保存的最大历史记录数量</li>
</ol>
<h3>5.2 保存设置</h3>
<ul>
<li>点击"保存设置"按钮保存配置</li>
</ul>
<h2>6. 常见问题</h2>
<h3>6.1 请求失败</h3>
<ul>
<li>检查URL是否正确</li>
<li>检查网络连接</li>
<li>检查请求参数和请求头是否符合接口要求</li>
<li>检查请求体格式是否正确</li>
</ul>
<h3>6.2 接口导入失败</h3>
<ul>
<li>确保导入的文件是有效的JSON格式</li>
<li>确保JSON文件包含正确的接口结构</li>
</ul>
<h3>6.3 历史记录不保存</h3>
<ul>
<li>检查浏览器是否支持localStorage</li>
<li>检查最大历史记录数设置是否合理</li>
</ul>
<h2>7. 技术支持</h2>
<ul>
<li>版本:V3.2</li>
<li>作者:KTT</li>
<li>日期:2026-04-18</li>
</ul>
<p>如有任何问题或建议,请联系技术支持。</p>
</div>
</div>
</div>
</section>
</div>
<!-- JSON参数编辑模态框 -->
<div class="modal fade" id="jsonEditorModal" tabindex="-1" role="dialog" aria-labelledby="jsonEditorModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="jsonEditorModalLabel">编辑JSON参数</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<label for="jsonEditorParameterName">参数名</label>
<input type="text" class="form-control" id="jsonEditorParameterName" placeholder="参数名" readonly>
</div>
<div class="form-group">
<label for="jsonEditorType">JSON类型</label>
<select class="form-control" id="jsonEditorType">
<option value="object">对象</option>
<option value="array">数组</option>
</select>
</div>
<div class="form-group">
<label>子参数列表</label>
<div id="jsonEditorParameters" class="mb-3">
<!-- 子参数表单将动态生成 -->
</div>
<div class="d-flex justify-content-between">
<button type="button" class="btn btn-sm btn-secondary" id="addJsonEditorParameter">添加子参数</button>
<button type="button" class="btn btn-sm btn-primary" id="addJsonEditorParameterGroup" style="display: none;">添加参数组</button>
</div>
</div>
<div class="form-group">
<label for="jsonEditorRaw">原始JSON</label>
<textarea class="form-control" id="jsonEditorRaw" rows="10" placeholder="输入原始JSON"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="saveJsonEditor">保存</button>
</div>
</div>
</div>
</div>
<script src="src/js/jquery-3.5.1.min.js"></script>
<script src="src/js/popper.min.js"></script>
<script src="src/js/bootstrap.min.js"></script>
<script>
// 存储管理
const Storage = {
get(key, defaultValue = []) {
const value = localStorage.getItem(key);
return value ? JSON.parse(value) : defaultValue;
},
set(key, value) {
localStorage.setItem(key, JSON.stringify(value));
}
};
// 接口数据
let defaultInterfaces = [
{
id: '1',
name: '任务组接口',
url: '/rcs/rtas/api/robot/controller/task/group',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"groupCode": "GROUP_001",
"taskList": [
{
"taskId": "TASK_001",
"priority": 1,
"source": "SOURCE_001",
"target": "TARGET_001"
}
]
}, null, 2)
},
{
id: '2',
name: '任务下发接口',
url: '/rcs/rtas/api/robot/controller/task/submit',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"taskId": "TASK_001",
"priority": 1,
"source": "SOURCE_001",
"target": "TARGET_001",
"carrierCode": "CARRIER_001"
}, null, 2)
},
{
id: '3',
name: '任务继续执行接口',
url: '/rcs/rtas/api/robot/controller/task/extend/continue',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"taskId": "TASK_001"
}, null, 2)
},
{
id: '4',
name: '任务取消接口',
url: '/rcs/rtas/api/robot/controller/task/cancel',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"taskId": "TASK_001"
}, null, 2)
},
{
id: '5',
name: '任务优先级设置',
url: '/rcs/rtas/api/robot/controller/task/priority',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"taskId": "TASK_001",
"priority": 5
}, null, 2)
},
{
id: '6',
name: '区域暂停与恢复',
url: '/rcs/rtas/api/robot/controller/zone/pause',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"zoneCode": "ZONE_001",
"pause": true
}, null, 2)
},
{
id: '7',
name: '区域归巢',
url: '/rcs/rtas/api/robot/controller/zone/homing',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"zoneCode": "ZONE_001"
}, null, 2)
},
{
id: '8',
name: '区域驱离',
url: '/rcs/rtas/api/robot/controller/zone/banish',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"zoneCode": "ZONE_001"
}, null, 2)
},
{
id: '9',
name: '区域封锁与恢复',
url: '/rcs/rtas/api/robot/controller/zone/blockade',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"zoneCode": "ZONE_001",
"blockade": true
}, null, 2)
},
{
id: '10',
name: '载具与站点绑定',
url: '/rcs/rtas/api/robot/controller/carrier/bind',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"carrierCode": "CARRIER_001",
"siteCode": "SITE_001"
}, null, 2)
},
{
id: '11',
name: '载具与站点解绑',
url: '/rcs/rtas/api/robot/controller/carrier/unbind',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"carrierCode": "CARRIER_001",
"siteCode": "SITE_001"
}, null, 2)
},
{
id: '12',
name: '存储对象与搬运对象绑定',
url: '/rcs/rtas/api/robot/controller/site/bind',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"storageCode": "STORAGE_001",
"transportCode": "TRANSPORT_001"
}, null, 2)
},
{
id: '13',
name: '载具禁用与启用',
url: '/rcs/rtas/api/robot/controller/carrier/lock',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"carrierCode": "CARRIER_001",
"lock": true
}, null, 2)
},
{
id: '14',
name: '站点禁用与启用',
url: '/rcs/rtas/api/robot/controller/site/lock',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"siteCode": "SITE_001",
"lock": true
}, null, 2)
},
{
id: '15',
name: '外设执行通知(返回0)',
url: '/rcs/rtas/spi/wcs/robot/eqpt/notify',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"eqptCode": "EQPT_001",
"action": "ACTION_001",
"result": 0
}, null, 2)
},
{
id: '16',
name: '预调度任务下发',
url: '/rcs/rtas/api/robot/controller/task/pretask',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"taskId": "TASK_001",
"priority": 1,
"source": "SOURCE_001",
"target": "TARGET_001",
"scheduleTime": "2026-04-15T10:00:00"
}, null, 2)
},
{
id: '17',
name: '查询任务状态',
url: '/rcs/rtas/api/robot/controller/task/query',
method: 'POST',
parameters: [],
headers: [
{ name: 'Content-Type', value: 'application/json;charset=UTF-8' }
],
requestBody: JSON.stringify({
"taskId": "TASK_001"
}, null, 2)
},
{
id: '18',
name: '查询机器人状态',
url: '/rcs/rtas/api/robot/controller/robot/query',
method: 'POST',